on 03-07-2013 5:25 PM
We currently have a problem working with a XSL stylesheet we found on another blog post. We try to add the xsi:nil Attribute to empty XML elements. Therefore we copied a XSL stylesheet which is not working when executed on the server, but it works when testing in operation mapping and XML Spy.
The Input Message is:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:writeErrorLogElement xmlns:ns1="http://emmi.efm.bssv.JP580001/types/">
<ns1:userDefinedNumeric1/>
<ns1:orderType/>
<ns1:description05/>
<ns1:units/>
<ns1:description03/>
<ns1:endDate01/>
<ns1:errorCode/>
<ns1:documentOrderNoInvoiceetc/>
<ns1:EDIUserID/>
</ns1:writeErrorLogElement>
The XSLT Stylesheet “set_empty_fields_to_nil” is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="vDoc" select="document('')"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*">
<xsl:copy>
<xsl:copy-of select= "$vDoc/*/namespace::* [name() = 'xsd' or name() = 'xsi']"/>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(node())]">
<xsl:copy>
<xsl:attribute name="xsi:nil">true</xsl:attribute>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Testing in Operation Mapping works fine. There are no errors and the output is correct:
<ns1:writeErrorLogElement
xmlns:ns1="http://emmi.efm.bssv.JP580001/types/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<ns1:userDefinedNumeric1 xsi:nil="true"/>
<ns1:orderType xsi:nil="true"/>
<ns1:description05 xsi:nil="true"/>
<ns1:units xsi:nil="true"/>
<ns1:description03 xsi:nil="true"/>
<ns1:endDate01 xsi:nil="true"/>
<ns1:errorCode xsi:nil="true"/>
<ns1:documentOrderNoInvoiceetc xsi:nil="true"/>
<ns1:EDIUserID xsi:nil="true"/>
</ns1:writeErrorLogElement>
But as soon as the mapping is executed on PI server it fails:
Message Monitor: Status is „Canceled“, message log shows error message:
3/7/2013 5:52:36.964 PM | Information | Application attempting to send an XI message synchronously using connection JPR |
3/7/2013 5:52:36.964 PM | Information | Java proxy runtime (JPR) is transferring the request message to the messaging System |
3/7/2013 5:52:36.964 PM | Information | JPR received "SAP_BPM_Service" as user |
3/7/2013 5:52:36.982 PM | Information | Trying to put the message into call queue |
3/7/2013 5:52:36.983 PM | Information | Message successfully put into the queue |
3/7/2013 5:52:37.133 PM | Information | Message retrieved from call queue |
3/7/2013 5:52:37.133 PM | Information | Message status set to DLNG |
3/7/2013 5:52:37.134 PM | Information | Executing Request Mapping "http://emmi.ch/technical/OM_BPM_to_EFM_WriteErrorLog" (SWCV 13816ef0608611e2a264c2c50a170ab0) |
3/7/2013 5:52:37.231 PM | Error | Mapping "http://emmi.ch/technical/OM_BPM_to_EFM_WriteErrorLog" failed to execute: MappingException: Transformer exception occurred when executing XSLT set_empty_fields_to_nil (http://emmi.ch, -1, 13816ef0-6086-11e2-a264-c2c50a170ab0) |
3/7/2013 5:52:37.375 PM | Error | Transmitting the message using connection JPR failed, due to: com.sap.aii.af.service.mapping.MappingException: Transformer exception occurred when executing XSLT set_empty_fields_to_nil (http://emmi.ch, -1, 13816ef0-6086-11e2-a264-c2c50a170ab0) |
3/7/2013 5:52:38.088 PM | Error | Message status set to FAIL |
3/7/2013 5:52:38.105 PM | Error | Returning to application. Exception: com.sap.aii.af.service.mapping.MappingException: Transformer exception occurred when executing XSLT set_empty_fields_to_nil (http://emmi.ch, -1, 13816ef0-6086-11e2-a264-c2c50a170ab0) |
3/7/2013 5:52:38.114 PM | Error | JPR failed to transfer the request message to the messaging system. Reason: Transformer exception occurred when executing XSLT set_empty_fields_to_nil (http://emmi.ch, -1, 13816ef0-6086-11e2-a264-c2c50a170ab0) |
I tested the XSL stylesheet also in XML Spy, it has no warnings or errors and produces the desired output.
Can anybody explain why the XSL can be executed successfully in OperationMapping-Test and XML Spy but as soon as it is executed on the server it fails?
We have SAP PO 7.31 EHP 6 Java Single Stack.
Thanks in advance,
ben
Hi Benjamin,
May I Know which version of xslt your using?If your not using any sort and group functions.You can Go with XSLT 1.0 .Because XSLT 2.0 version was not supported .
Thanks & Regards,
Anusha Penneru.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try end to end scenario will proper payload, you may sending some empty fields.
Regards,
Sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the same payload in XML Spy and Operation Mapping for testing, this was all successful!
It's only on the server when running the end to end scenario the error is thrown!
Anybody have any ideas??
I also checked the server logs, but there is just the same message as posted above, no further clues for the cause of the error...
It is not wrong, this is all what it is about, please read the question carefully.
--> the payload has empty values, for those values the attribute xsi:nil="true" should be set using an XSL stylesheet.
There is no error message if we remove the XSL step from Operation Mapping. Therefore the error must be in correlation with this stylesheet .
As you suggested, I run a test with values set to all elements in the payload:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:writeErrorLogElement xmlns:ns1="http://emmi.efm.bssv.JP580001/types/">
<ns1:userDefinedNumeric1>1</ns1:userDefinedNumeric1>
<ns1:orderType>a</ns1:orderType>
<ns1:description05>a</ns1:description05>
<ns1:units>1</ns1:units>
<ns1:description03>1</ns1:description03>
<ns1:endDate01>0</ns1:endDate01>
<ns1:errorCode>1</ns1:errorCode>
<ns1:documentOrderNoInvoiceetc>1</ns1:documentOrderNoInvoiceetc>
<ns1:EDIUserID>1</ns1:EDIUserID>
</ns1:writeErrorLogElement>
The same Error occurred, even though the xsl stylesheet did not find any empty element!
3/8/2013 8:38:04.322 AM | Information | Trying to put the message into call queue |
3/8/2013 8:38:04.323 AM | Information | Message successfully put into the queue |
3/8/2013 8:38:04.328 AM | Information | Executing Request Mapping "http://emmi.ch/technical/OM_BPM_to_EFM_WriteErrorLog" (SWCV 13816ef0608611e2a264c2c50a170ab0) |
3/8/2013 8:38:04.328 AM | Information | Message retrieved from call queue |
3/8/2013 8:38:04.328 AM | Information | Message status set to DLNG |
3/8/2013 8:38:04.389 AM | Error | Mapping "http://emmi.ch/technical/OM_BPM_to_EFM_WriteErrorLog" failed to execute: MappingException: Transformer exception occurred when executing XSLT set_empty_fields_to_nil (http://emmi.ch, -1, 13816ef0-6086-11e2-a264-c2c50a170ab0) |
3/8/2013 8:38:04.397 AM | Error | Transmitting the message using connection JPR failed, due to: com.sap.aii.af.service.mapping.MappingException: Transformer exception occurred when executing XSLT set_empty_fields_to_nil (http://emmi.ch, -1, 13816ef0-6086-11e2-a264-c2c50a170ab0) |
3/8/2013 8:38:04.433 AM | Error | Message status set to FAIL |
3/8/2013 8:38:04.442 AM | Error | Returning to application. Exception: com.sap.aii.af.service.mapping.MappingException: Transformer exception occurred when executing XSLT set_empty_fields_to_nil (http://emmi.ch, -1, 13816ef0-6086-11e2-a264-c2c50a170ab0) |
3/8/2013 8:38:04.448 AM | Error | JPR failed to transfer the request message to the messaging system. Reason: Transformer exception occurred when executing XSLT set_empty_fields_to_nil (http://emmi.ch, -1, 13816ef0-6086-11e2-a264-c2c50a170ab0) |
Here is the prove: I removed the xsl mapping step from operation mapping and it worked end to end (same payload).
The Question remains: what is wrong with the xsl stylesheet mapping??
3/8/2013 8:48:41.758 AM | Information | Message successfully put into the queue |
3/8/2013 8:48:41.782 AM | Information | Message retrieved from call queue |
3/8/2013 8:48:41.782 AM | Information | Message status set to DLNG |
3/8/2013 8:48:41.783 AM | Information | Executing Request Mapping "http://emmi.ch/technical/OM_BPM_to_EFM_WriteErrorLog" (SWCV 13816ef0608611e2a264c2c50a170ab0) |
3/8/2013 8:48:42.084 AM | Information | Delivering to channel: CC_SOAP_EFM_WriteErrorLog |
3/8/2013 8:48:42.085 AM | Information | MP: processing local module localejbs/AF_Modules/MessageTransformBean |
3/8/2013 8:48:42.085 AM | Information | Transform: transforming the payload ... |
3/8/2013 8:48:42.085 AM | Information | Transform: using Transform.Class: $identity |
3/8/2013 8:48:42.087 AM | Information | MP: processing local module localejbs/sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean |
3/8/2013 8:48:42.087 AM | Information | Transform: successfully transformed |
Can you try something like this once,
Or why don't you use graphical mapping then if its one to one mapping with use of "map with default" (sorry to suggest one more additional work around).
Changing the mapping methodology might still turn out to be the simplest solution.
Hope this helps.!
Regards,
Sunil
I can try it but this XSL mapping does a completely different thing... It removes the empty elements instead of adding the xsi:nil attribute...
speaking of your additional workaround, unfortunately I cannot modify the datatype because it is from an imported WSDL and not changeable... We would have to do this for all 20 web service interfaces, which is expensive and therefore not a good solution --> with use of a simple XSL mapping, like the one I posted, it would be a good and easy solution but what the heck is that meaningless error message in message log.. 😞
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.