cancel
Showing results for 
Search instead for 
Did you mean: 

To send dynamic message ID using java mapping

Former Member
0 Kudos

Hi All

We developed a scenario File to SOAP(connecting third party).

Third party provided wsdl and xsd files.

No Message mapping.

We developed a Java mapping to send input file as base64 encoded output file to one of the field in XSD file.

PI will pick the file and java mapping encode the input file to Base64 and SOAP request will be sent to third party.

Please provide your valuable inputs on below requirement :

"Message Id should be sent from PI for one of the field as this is unique for each file"


Regards

Anitha

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Anitha,

               Can you please provide target XML structure.

Regards

Anupam

Former Member
0 Kudos

Hi Anupam

The below is the expected structure at Target as per the wsdl provided by third party.

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header/>

<SOAP:Body>

<ns0:sampleFile xmlns:ns0="TargetURL
">
<ns0:fileID>16cd6da9-9911-11e5-81da-000005cad803</ns0:fileID>

<ns0:fileType>text</ns0:fileType>

<ns0:mimeType>text/plain</ns0:mimeType>

<ns0:fileName>xyz.txt</ns0:fileName>

<ns0:fileContent>zc84qoL7ATOyQjLGxgiQExdigSQ1tUuvT3pKRpSj1Y59PZ55PjQy5yvQMAGkCKzSNYjhhubT2MWobmXU9t040f/Rz6VldST9K/urFSCEvhvG6J3cGHFRUqgnK8VAA4n2SrymDH5bF4</ns0:fileContent>

</ns0:sampleFile>
</SOAP:Body>

</SOAP:Envelope>


We are able to generate this structure through Java mapping.

In field "fileContent" we are passing base64 encoded file.

Now my requirement is to pass dynamic message ID through field "fileID"


I would like insert the code for dynamic message ID in the same mapping


Regards

Anitha

former_member186851
Active Contributor
0 Kudos

Anitha just add the logic for that field to get messageID

Former Member
0 Kudos

Hi Raghu ram

Can I add as below:

java.util.Map map;

fileID=TransformationInput.getInputHeader().getMessageId();

String messageID= (String) fileID.get(StreamTransformationConstants.MESSAGE_ID);

Please correct this if wrong.

Former Member
0 Kudos

Hi Anitha,

  The following statement is good enough.


fileID=TransformationInput.getInputHeader().getMessageId();


You don't require the next line


String messageID= (String) fileID.get(StreamTransformationConstants.MESSAGE_ID);

unless you are using the field messageID somewhere else.

Regards

Charan

former_member186851
Active Contributor
0 Kudos

Yes Anitha..

Even Charan logic should work.

Try and incase of any errors let us know

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Charan and Raghu

Thanks for your inputs.

I am facing issue when trying to export the java file as .jar file.Hence not able to test.

Please provide me the below library jar files if you have else guide me where can I get them.

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

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

    import java.io.*;

    import javax.xml.bind.DatatypeConverter;

former_member186851
Active Contributor
0 Kudos

Hello Saranya,

Try using these import statements in the beginning of code.

Former Member
0 Kudos

Hi Anitha,

Check the following links on how to get the jars for the Java mapping development.

https://wiki.scn.sap.com/wiki/display/XI/Where+to+get+the+libraries+for+XI+development

https://wiki.scn.sap.com/wiki/display/XI/XI+libraries+for+development

Regards

Charan

Former Member
0 Kudos

Thank you Raghu and Charan

The issue is resolved.Now I can able to get dynamic message ID for "fileID" field.

<ns0:fileID>C8CD9507DFD645CC2B10EB9FE8B76874</ns0:fileID>

Logic used in Java mapping :

InputHeader messageHeader = transformationInput.getInputHeader();

            String messageId = messageHeader.getMessageId();

I am closing the thread.

former_member186851
Active Contributor
0 Kudos

Nice to hear Anitha,

Did you use import statment and imported the JArs.Please share the experience so that it will be useful to us.

Former Member
0 Kudos

Hi Raghu

I imported the below jar file.

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

Former Member
0 Kudos

kindly help if we can also achieve this by AF_Modules/DynamicConfigurationBean

former_member186851
Active Contributor
0 Kudos

Hello Anitha,

Use the code in the below link to get the message ID

Former Member
0 Kudos

Hi Raghuram

Thanks for your reply.

I have to send message ID to the target field "fileID".

As we are not using message mapping we cant create UDF.

Can we send this in same java mapping or do we need to have another java mapping for this field?

If so please guide me with code to send to "fileID".

former_member186851
Active Contributor
0 Kudos

Hello Anitha,

The same message mapping will do, Just for this field use the logic of getting message ID.