on 06-28-2011 11:00 AM
Hello,
I have a File to SOAP scenario and it requires the SOAP message with a custom SOAP envelope. I have searched SDN and could only find that SOAP envelope can be created using a JAVA or XSLT mapping. However, I could not find any blog/ article which will help me understand, with an example, how this is actually coded (creating of a custom SOAP envelope).
Can anyone please point me to a valid blog/ article/ wiki which describes the procedure?
Thanks,
Pankaj.
P.S. Please no spamming of post with links on SOAP Envelope; I have already searched on SDN
Hello,
Here is a wiki using PI 7.1
https://wiki.sdn.sap.com/wiki/display/XI/SampleJAVAMappingcodeusingPI7.1+API
If you want to create a SOAP Envelope, comment out the codes
private static final DynamicConfigurationKey KEY_FILENAME =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String inParam = arg0.getInputParameters().getString("PARAM_IN1");
getTrace().addInfo("Input Parameter: " +inParam);
int offset = inData.indexOf(inParam);
//7. Reader Message ID from Message Header
InputHeader messageHeader = arg0.getInputHeader();
String messageId = messageHeader.getMessageId();
//8. A DynamicConfiguration is a map containing adapter specific message attributes.
// It associates DynamicConfigurationKeys with string values. The DynamicConfiguration object is obtained using
// method getDynamicConfiguration()of class com.sap.aii.mapping.api.TransformationInput;
DynamicConfiguration conf = arg0.getDynamicConfiguration();
conf.put(KEY_FILENAME, "This Test file is set by JAVA Mapping");
String outData = "";if(offset > 0){
int offset1 = inData.indexOf(">", offset);
String StartString =inData.substring(0,offset1);
String DocumentNameSpace = " xmlns=\"urn:iso:std:iso:20022:tech:xsd:pain.002.001.02\"";
String RemainingString = inData.substring(offset1);
lastly, instead of using
outData = StartString + DocumentNameSpace + RemainingString;
replace it with something like this
String outData = "";
outData = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:tem=\"http://yournamespace/\"><soap:Header/><soap:Body>"+inData.substring(inData.indexOf("?>")+2)+"</soap:Body></soap:Envelope>";
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have a payload like one given below (should be output of PI):
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<a:Information xmlns:a="http://com/somenamespace">
<a:Data xmlns:java="somenamespace">
<java:Container>
<java:Name>Val1</java:Name>
<java:Value>Val2</java:Value>
</java:Container>
</a:Data>
</a:Information>
</soapenv:Body>
I am trying to convert this into an XSD but after converting it into XSD (using Stylus Studio) and using it in mapping I am not getting the prefix as soapenv, a, java; the prefixes now get changed to ns0, ns1, ns2.
How should I design the XSD so that the tags required in the envelope remain as I want (shown in above example).
I do not want to include any module to change the prefixes; I would like to handle the envelope in the structure itself.
Thanks,
Pankaj.
Hello,
I am not getting the prefix as soapenv, a, java; the prefixes now get changed to ns0, ns1, ns2.
This is how namespaces are internally handled in PI.
How should I design the XSD so that the tags required in the envelope remain as I want (shown in above example).
Not possible in message mapping part. You have to add XSLT/Java Mapping at the last part of your operation mapping to replace the ns0, ns1 and ns2 to soapenv, a and java respectively.
Hope this helps,
Mark
Hi Mark,
Not possible in message mapping part. You have to add XSLT/Java Mapping at the last part of your operation mapping to
replace the ns0, ns1 and ns2 to soapenv, a and java respectively.
Ok. So it means that we cannot achieve the requirement by developing a custom structure (xsd) and then referring in mapping. I assumed that if we define the XSD then there was no need of a JAVA mapping; however it seems that we have to make use of JAVA/ XSLT mappings.
Thanks,
Pankaj.
Hello Mr,
I suggest you to use an XSLT mapping.
You can find some instructions in my blog:
http://simonlesflex.wordpress.com/2011/01/26/sap-pi-customize-message-with-xslt-mapping/
Here the Guide to xslt mapping:
http://www.riyaz.net/blog/beginners-guide-to-xslt-mapping-in-sap-pi/technology/sap/769/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.