cancel
Showing results for 
Search instead for 
Did you mean: 

XSL Mapping Exception: Transformer exception occurred

Ben
Participant
0 Kudos

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 PMInformationApplication attempting to send an XI message synchronously using connection JPR
3/7/2013 5:52:36.964 PMInformationJava proxy runtime (JPR) is transferring the request message to the messaging System
3/7/2013 5:52:36.964 PMInformationJPR received "SAP_BPM_Service" as user
3/7/2013 5:52:36.982 PMInformationTrying to put the message into call queue
3/7/2013 5:52:36.983 PMInformationMessage successfully put into the queue
3/7/2013 5:52:37.133 PMInformationMessage retrieved from call queue
3/7/2013 5:52:37.133 PMInformationMessage status set to DLNG
3/7/2013 5:52:37.134 PMInformationExecuting Request Mapping "http://emmi.ch/technical/OM_BPM_to_EFM_WriteErrorLog" (SWCV 13816ef0608611e2a264c2c50a170ab0)
3/7/2013 5:52:37.231 PMErrorMapping "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 PMErrorTransmitting 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 PMErrorMessage status set to FAIL
3/7/2013 5:52:38.105 PMErrorReturning 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 PMErrorJPR 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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

Ben
Participant
0 Kudos

The XSL mapping is <xsl:stylesheet version="1.0">

You see the whole XSL stylesheet at the top of the blog post (see question)

smavachee
Active Contributor
0 Kudos

Try end to end scenario will proper payload, you may sending some empty fields.

Regards,

Sunil

Ben
Participant
0 Kudos

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...

smavachee
Active Contributor
0 Kudos

Is there any issue to test it end to end, you are surely sending some wrong values or an empty payload.

Try it and check if its working.

Regards,

Sunil

Ben
Participant
0 Kudos

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 .

Ben
Participant
0 Kudos

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 AMInformationTrying to put the message into call queue
3/8/2013 8:38:04.323 AMInformationMessage successfully put into the queue
3/8/2013 8:38:04.328 AMInformationExecuting Request Mapping "http://emmi.ch/technical/OM_BPM_to_EFM_WriteErrorLog" (SWCV 13816ef0608611e2a264c2c50a170ab0)
3/8/2013 8:38:04.328 AMInformationMessage retrieved from call queue
3/8/2013 8:38:04.328 AMInformationMessage status set to DLNG
3/8/2013 8:38:04.389 AMErrorMapping "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 AMErrorTransmitting 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 AMErrorMessage status set to FAIL
3/8/2013 8:38:04.442 AMErrorReturning 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 AMErrorJPR 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)
smavachee
Active Contributor
0 Kudos

Posted screenshot of error clearly shows the Mapping Exception during the execution of “set_empty_fields_to_nil”.

Till it get processed and put on Queue, its been process properly and when it calls for mapping, its throwing and exception.

Regards,

Sunil

Ben
Participant
0 Kudos

Sure, but what is the problem with the xsl mapping when it is working fine in manual test?

Ben
Participant
0 Kudos

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 AMInformationMessage successfully put into the queue
3/8/2013 8:48:41.782 AMInformationMessage retrieved from call queue
3/8/2013 8:48:41.782 AMInformationMessage status set to DLNG
3/8/2013 8:48:41.783 AMInformationExecuting Request Mapping "http://emmi.ch/technical/OM_BPM_to_EFM_WriteErrorLog" (SWCV 13816ef0608611e2a264c2c50a170ab0)
3/8/2013 8:48:42.084 AMInformationDelivering to channel: CC_SOAP_EFM_WriteErrorLog
3/8/2013 8:48:42.085 AMInformationMP: processing local module localejbs/AF_Modules/MessageTransformBean
3/8/2013 8:48:42.085 AMInformationTransform: transforming the payload ...
3/8/2013 8:48:42.085 AMInformationTransform: using Transform.Class:  $identity
3/8/2013 8:48:42.087 AMInformationMP: processing local module localejbs/sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean
3/8/2013 8:48:42.087 AMInformationTransform: successfully transformed
smavachee
Active Contributor
0 Kudos

Can you try something like this once,

Remove empty tags by XSLT

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

Ben
Participant
0 Kudos

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.. 😞