Skip to Content
0

SOAP envelope/header and body addition using XSLT Mapping in SAP PI

Sep 09, 2017 at 05:44 PM

421

avatar image
Former Member

code.txtDear All,

I have a requirement to add the SOAP Envelope, Header and Body segments to match the desired format required by the target party. I have tried to use XSLT to achieve this. I tried with the below code but when I test in the operation mapping using 1 to 2 (1- Message mapping, 2-xslt), it fails with below error in PI Operation mapping test :

Transformer Configuration Exception occurred when loading XSLT SOAP_ENV.xsl; details: Could not compile stylesheet

Can anyone please let me now what could be the root cause and what should be the correct XSLT code to be used if mine below is not correct (if something else to be modified in this code to handle in PI mapping)?

CODE :

http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem=" http://tempuri.org/">

<soap:Header />

<soap:Body> <xsl:copy-of select="."/>

</soap:Body>

</soap:Envelope>

</xsl:template>

</xsl:stylesheet>

PS: I tried in Stylus Studio, there it is giving me the desired output but during testing in PI Operation Mapping, getting the below error. Please help.

Transformer Configuration Exception occurred when loading XSLT SOAP_ENV.xsl; details: Could not compile stylesheet

code.txt (383 B)
10 |10000 characters needed characters left characters exceeded
Former Member

Any pointers please?

0
Former Member

Please help with the XSLT code in order to get the expected output (pfa)expected-output.txt

My input XML to XSLT is like this:

<BillingRequest>

<declarantTin>200000328-1</declarantTin> /* this declarantTin is a field inside Billing Request */

</BillingRequest>

0
Former Member

Hi All,

I am able to run in the Operation Mapping using the attached XSLT code. xsltcode.txt

Now, I am getting the output as attached and below output-xslt.txt. But I need to replace the namespace prefix "ns0" with "tem" at all places in the output. Can you please let me know what can be done to modify the XSLT code to achieve this?

<?xml version="1.0" encoding="utf-8"?>

http://tempuri.org/" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

http://tempuri.org/">

<ns0:declarantTin>abcd</ns0:declarantTin>

</ns0:BillingRequest>

</soap:Body>

</soap:Envelope>

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Evgeniy Kolmakov Sep 10, 2017 at 07:59 AM
0

Hi Amita!

Try to remove the space in Header tag.

The second option is to change XSLT processor to Xalan in your Stylus project and run the test.

Regards, Evgeniy.

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks Evgeniy for the response. I tried to remove the space in Header tag still the same error while testing in PI Operation Mapping. I need to fix this in PI mapping only

Though in XSLT processor, I don't find any option to change to Xalan. Moreover, the intention is to run the xslt successfully in PI which I am not able to do so.

Please suggest what could be the issue and what XSLT code should be used.

My input XML to XSLT is like this:

<BillingRequest>

<declarantTin>200000328-1</declarantTin> /* this declarantTin is a field inside Billing Request */

</BillingRequest>

I want the output like below (also attached expected output)expected-output.txt:

http://tempuri.org/" xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Body>

<ser:BillingRequest>

<ser:declarantTin>200000328-1</ser:declarantTin>

</ser:BillingRequest>

</soapenv:Body>

</soapenv:Envelope>

Please help me with code.

Regards,

Amita

0

I haven't worked with Stylus for quite a long time, but I remember there was an option to select XSLT processor used for transformation both by default and for current scenario. It could be found in scenario settings.

http://www.stylusstudio.com/xslt-editor.html

You can select "Java built-in" processor type. It must be xsltc processor.

The point is that PI uses xsltc java processor based on Xalan. So, to ensure if your XSLT works in PI operation mapping as expected you should test it using Xalan or xsltc. If you perform the test and get errors during it - you will be able to see the error description in Stylus Studio.

Regards, Evgeniy.

0
Former Member
Evgeniy Kolmakov

Hi Evgeniy,

I tried to run the XSLT code using by selecting Java built in processor but it does not support debugging (says XSLT debugging is not possible with this type of XSLT processor)

I think different XSLT code is required to achieve my target desired output, looking forward to it.

0
Former Member

Hi All,

I am able to run in the Operation Mapping using the attached XSLT code. xsltcode.txt

Now, I am getting the output as attached and below output-xslt.txt. But I need to replace the namespace prefix "ns0" with "tem" at all places in the output. Can you please let me know what can be done to modify the XSLT code to achieve this?

<?xml version="1.0" encoding="utf-8"?>

http://tempuri.org/" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

http://tempuri.org/">

<ns0:declarantTin>abcd</ns0:declarantTin>

</ns0:BillingRequest>

</soap:Body>

</soap:Envelope>

xsltcode.txt (453 B)
output-xslt.txt (336 B)
0
avatar image
Former Member Sep 10, 2017 at 06:17 PM
0

Hi All,

I am able to run in the Operation Mapping using the attached XSLT code. xsltcode.txt

Now, I am getting the output as attached and below output-xslt.txt. But I need to replace the namespace prefix "ns0" with "tem" at all places in the output. Can you please let me know what can be done to modify the XSLT code to achieve this?

<?xml version="1.0" encoding="utf-8"?>

http://tempuri.org/" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

http://tempuri.org/">

<ns0:declarantTin>abcd</ns0:declarantTin>

</ns0:BillingRequest>

</soap:Body>

</soap:Envelope>

xsltcode.txt (453 B) output-xslt.txt

(336 B)

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Please let me know the modified XSLT code (please change the existing attached XSLT code to achieve this) to replace the namespace prefix "ns0" with "tem" at all places in the output

xsltcode.txt

xsltcode.txt (453 B)
0
Former Member

Any pointers?

0