cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Preamble header of CIDX message in SAP PI

Former Member
0 Kudos

Hi

We are using the CIDX adapter in PI 7.3 dual stack for sending ChemXMLs to partner.

We are not sending the reference to the DTD for Preamble and ServiceHeader part:

Partner is expecting Preamble header as below:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE Preamble SYSTEM "PreamblePartMessageGuideline.dtd">

<Preamble><DateTimeStamp>20130925T090131.599Z</DateTimeStamp><GlobalAdministeringAuthorityCode>CIDX</GlobalAdministeringAuthorityCode><GlobalUsageCode>Production</GlobalUsageCode><VersionIdentifier>1.1</VersionIdentifier></Preamble>

We are able to send as below:

<?xml version="1.0" encoding="UTF-8"?><Preamble><DateTimeStamp>20130925T090131.599Z</DateTimeStamp><GlobalAdministeringAuthorityCode>CIDX</GlobalAdministeringAuthorityCode><GlobalUsageCode>Production</GlobalUsageCode><VersionIdentifier>1.1</VersionIdentifier></Preamble>

As per my understanding, we are not mapping anything for this header. This gets created automatically.

Is there something I forgot to set up? Where I have to give the reference of PreamblePartMessageGuideline.dtd ?

Please help me.

Thanks,

Rama.

Accepted Solutions (1)

Accepted Solutions (1)

marksmyth
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Rama,

Check the note 1382040 DOCTYPE inclusion in Preamble and Service headerCIDX adapter. Maybe this will help you resolve the error.

Regards

Mark

Answers (1)

Answers (1)

former_member208404
Participant
0 Kudos

Hi Rama,

If you are using as wsdl in your service interface, you can include a targetnamespace there. This should include that xml tag in your output.

Hope it helps.

Abhishek

Former Member
0 Kudos

Hi


Thanks for your reply.

We are directly using the external definition from CIDX package as service interface in our message mapping.

Regards,

Rama

anupam_ghosh2
Active Contributor
0 Kudos

Hi Rama,

                  I think  you can alter the XSD in external definition  using notepad to include the preamble header.

Regards

Anupam

Former Member
0 Kudos

Hi Anupam

Pramble header is not part of the XSD. It is getting created at runtime using CIDX receiver adapter.

Regards,

Rama

anupam_ghosh2
Active Contributor
0 Kudos

Hi Rama,

                 I guess you have a OM/IM in your scenario.In the OM try adding this java mapping code (below message mapping) which includes the missing part.

import java.io.BufferedReader;

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.OutputStream;

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

import com.sap.aii.mapping.api.StreamTransformationException;

public class CIDXHeaderAdd  extends AbstractTransformation {

         public void execute(InputStream in, OutputStream out)

                   throws StreamTransformationException {

              

              try

              {

                   BufferedReader br=new BufferedReader(new InputStreamReader(in));

                   String s="",data="";

                   StringBuilder sb = new StringBuilder();

                   int i,j=0;

                   while(2>1)

                   {

                       s=br.readLine();

                       if(s==null)

                       {

                           break;

                       }

                       sb=sb.append(s);

                   }

                   data=sb.toString();

                   i=data.indexOf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

                   if(i>=0)

                   {

                       j=i+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>".length();

                   }

                   s="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"

                       +"<!DOCTYPE Preamble SYSTEM \"PreamblePartMessageGuideline.dtd\">"+

                       data.substring(j);

                   out.write(s.getBytes("UTF-8"));

              }

              catch(Exception e)

              {

                   e.printStackTrace();

              }

              

         }

    

     }

@Override

public void transform(TransformationInput arg0, TransformationOutput arg1)

   throws StreamTransformationException {

  // TODO Auto-generated method stub

  this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());

 

}

}

Also attached the jar file in case you need it.

Try this and lets hope error resolves.

Regards

Anupam

Former Member
0 Kudos

Thanks Anupam.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Rama,

                   Could you please confirm if this resolved the issue or you took some other approach.

Your answer can help people looking for answers in future.

Regards

Anupam