on 2014 Nov 06 6:49 AM
Hi All,
Can someone please help me to parse this using XSLT mapping.
I am doing SOAP to RFC scenario. The sender adapter is not able to pick this file.
This is the sample format coming from source
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:http="http:\www.test.com\POC">
<soapenv:Header>
<http:XHeader>
<applicationName></applicationName>
<correlationId></correlationId>
<UserInfo>
<UserType></UserType>
<Id></Id>
</UserInfo>
</http:XHeader>
</soapenv:Header>
<soapenv:Body>
<http:MT_SRC>
<N1></N1>
<N2></N2>
</http:MT_SRC>
</soapenv:Body>
</soapenv:Envelope>
In the target after mapping I am passing only N1 and N2. The problem is not able to parse this. Can someone help me with XSLT mapping.
Target
<?xml version="1.0" encoding="UTF-8"?>
<ns1:ZpiTest xmlns:ns1="urn:sap-com:document:sap:soap:functions:mc-style"><Num1></Num1><Num2></Num2></ns1:ZpiTest>
Hi Amit,
You only need to be careful with the prefixes.
With this input XML:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:http="http:\www.test.com\POC">
<soapenv:Header>
<http:XHeader>
<applicationName/>
<correlationId/>
<UserInfo>
<UserType/>
<Id/>
</UserInfo>
</http:XHeader>
</soapenv:Header>
<soapenv:Body>
<http:MT_SRC>
<N1>HELLO</N1>
<N2>WORLD</N2>
</http:MT_SRC>
</soapenv:Body>
</soapenv:Envelope>
And with this XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:http="http:\www.test.com\POC" exclude-result-prefixes="soapenv http">
<xsl:output method="xml"/>
<xsl:template match="/">
<ns1:ZpiTest xmlns:ns1="urn:sap-com:document:sap:soap:functions:mc-style">
<Num1>
<xsl:value-of select="/soapenv:Envelope/soapenv:Body/http:MT_SRC/N1"/>
</Num1>
<Num2>
<xsl:value-of select="/soapenv:Envelope/soapenv:Body/http:MT_SRC/N2"/>
</Num2>
</ns1:ZpiTest>
</xsl:template>
</xsl:stylesheet>
You will get this:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:ZpiTest xmlns:ns1="urn:sap-com:document:sap:soap:functions:mc-style">
<Num1>HELLO</Num1>
<Num2>WORLD</Num2>
</ns1:ZpiTest>
If you don't have the SOAP envelope inside the PI you can ommit the SOAP prefixes.
Hope this helps.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
You can set several XSL/message mappinds/Java mapping inside one operation mapping.
You can use this XSL to skip the SOAP header like first mapping:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="soapenv:Envelope/soapenv:Header"/>
</xsl:stylesheet>
Regards.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.