on 10-13-2014 5:08 PM
Hello Experts,
I am working on a Proxy to SOAP synchronous scenario in which i need to ignore the soap envelope and allow only the body of the response to pass through the source. Please find the structure of the response below:-
<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:ns="urn:ebay:api:PayPalAPI" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> -<SOAP-ENV:Header> <Security xsi:type="wsse:SecurityType" xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext"> </Security> -<RequesterCredentials xsi:type="ebl:CustomSecurityHeaderType" xmlns="urn:ebay:api:PayPalAPI"> -<Credentials xsi:type="ebl:UserIdPasswordType" xmlns="urn:ebay:apis:eBLBaseComponents"> <Username xsi:type="xs:string"> </Username> <Password xsi:type="xs:string"> </Password> <Signature xsi:type="xs:string"> </Signature> <Subject xsi:type="xs:string"> </Subject> </Credentials> </RequesterCredentials> </SOAP-ENV:Header> -<SOAP-ENV:Body id="_0"> -<DoReferenceTransactionResponse xmlns="urn:ebay:api:PayPalAPI"> <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2014-09-19T03:57:35Z</Timestamp> <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack> <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">ceb69d0e58bd2</CorrelationID> <Version xmlns="urn:ebay:apis:eBLBaseComponents">94.0</Version> <Build xmlns="urn:ebay:apis:eBLBaseComponents">12896494</Build> -
<DoReferenceTransactionResponseDetails xsi:type="ebl:DoReferenceTransactionResponseDetailsType" xmlns="urn:ebay:apis:eBLBaseComponents"> <BillingAgreementID xsi:type="xs:string">B-8XB79036VH779623L</BillingAgreementID> -<PaymentInfo xsi:type="ebl:PaymentInfoType"> <TransactionID>5GX48751EK6276517</TransactionID> <ParentTransactionID xsi:type="ebl:TransactionId"> </ParentTransactionID> <ReceiptID> </ReceiptID> <TransactionType xsi:type="ebl:PaymentTransactionCodeType">mercht-pmt</TransactionType> <PaymentType xsi:type="ebl:PaymentCodeType">instant</PaymentType> <PaymentDate xsi:type="xs:dateTime">2014-09-19T03:57:34Z</PaymentDate> <GrossAmount xsi:type="cc:BasicAmountType" currencyID="AUD">10.00</GrossAmount> <FeeAmount xsi:type="cc:BasicAmountType" currencyID="AUD">0.54</FeeAmount> <TaxAmount xsi:type="cc:BasicAmountType" currencyID="AUD">0.00</TaxAmount> <ExchangeRate xsi:type="xs:string"> </ExchangeRate> <PaymentStatus xsi:type="ebl:PaymentStatusCodeType">Completed</PaymentStatus> <PendingReason xsi:type="ebl:PendingStatusCodeType">none</PendingReason> <ReasonCode xsi:type="ebl:ReversalReasonCodeType">none</ReasonCode> <ProtectionEligibility xsi:type="xs:string">Ineligible</ProtectionEligibility> <ProtectionEligibilityType xsi:type="xs:string">None</ProtectionEligibilityType> </PaymentInfo> </DoReferenceTransactionResponseDetails> </DoReferenceTransactionResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
can some1 help me with the XSLT code for the same.?
Thanks in advance.
Hi Subham,
Check my response in this thread
Also, you can use the intruction value-of select or copy-of select directly in the root tag from your payload, check Vijaya answer in this thread:
Another way:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
<xsl:template match="/">
<xsl:apply-templates select="SOAP-ENV:Envelope/SOAP-ENV:Body/*"/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
From XSLT to get the XML from the body of a SOAP message - Stack Overflow
Regards.
Regards.
Message was edited by: Iñaki Vila
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Inaki,
I have already referred the above mentioned thread and have already tried the code posted by Vijaya as below:-
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<ns0:c>
<xsl:copy-of select="SOAP-ENV:Envelope/SOAP-ENV:Body/" />
</ns0:c>
</xsl:template>
</xsl:stylesheet>
But After uploading the code as a XSL in imported archive and testing the same in operational mapping it gives me the following error:-
Transformer Configuration Exception occurred when loading XSLT res.xsl; details: Syntax error in 'SOAP-ENV:Envelope/SOAP-ENV:Body/'. See error logs for details
Kindly suggest.
Hi Inaki,
I have tried the XSL code using <xsl:copy-of select="SOAP-ENV:Envelope/SOAP-ENV:Body/*" /> and now it is not giving any error but now getting error in the graphical mapping that is executing after this. Please find the error below:-
Error stack from response: Runtime exception occurred during application mapping com/sap/xi/tf/_MM_RESP_; com.sap.aii.mappingtool.tf7.IllegalInstanceException: Cannot create target element /ns2:MT_RESP. Values missing in queue context. Target XSD requires~
Kindly suggest.
Regards,
Shubham.
If you test this using payload in the Operation Mapping you can verify the output from each step of the mapping. In this case maybe it will be clear what part of the 2nd mapping is missing. If it is the root level it could be simple as namespace or maybe there is another level of XML you were not expecting.
Here is a nice online tool you can also use to test your XSLT, then you can side by side compare the GUI mapping test message source structure with what is being output.
Hi Shubam,
Have you used the XSL that i posted?, you need to skip <ns0:c> , it was a mistake mine. The XSL would be:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<xsl:copy-of select="SOAP-ENV:Envelope/SOAP-ENV:Body/*" />
</xsl:template>
</xsl:stylesheet>
Regards.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.