Skip to Content
avatar image
Former Member

scenario is proxy to jdbc while response getting error MAPPING">EXCEPTION_DURING_EXECUTE occured .

Hi Experts ,

My scenario is proxy to JDBC,Where request is going to target system and we are getting response  successful but some special character are comming in the response   .

Below is the error  in monitor .

MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>

  <SAP:P1>com/sap/xi/tf/_mm_get_lista_res_to_res_</SAP:P1>

  <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException:</SAP:P2>

  <SAP:P3>Character reference "&#xd83d" is an invalid XML ch</SAP:P3>

  <SAP:P4>aracter.</SAP:P4>

  <SAP:AdditionalText />

  <SAP:Stack>Runtime exception occurred during application mapping com/sap/xi/tf/_mm_get_lista_res_to_res_; com.sap.aii.utilxi.misc.api.BaseRuntimeException:Character reference &quot;&amp;#xd83d&quot; is

After analyzing the response we found response is comming wih some special character like below

  <MESSAGEFORGUEST>Para ajudar aos amigos e familiares segue a lista dos nossos sonhos para nossa casa                  </MESSAGEFORGUEST>

I am attached the screen shot also for error reference.

How to handle the above special character in PI or is there any option to  handle in ECC system.

Please help us to solve the issue.

Regards

Ravi.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Jan 06, 2015 at 01:18 PM

    Ravi,

    Sender system should send well-formed XML. w3c Link. It is highly recommended to fix this in sender system. I agree with Former Member and Former Member. If it can't be fixed in sender system, please implement below solution.

    Solution:-

    1) In OM select below Java mapping before MM.

    2) Tweak the logic, if needed. It is difficult write generic logic as & is Predefined Entities of XML.

    package com.javaMapping;
    
    
    import java.io.*;
    import com.sap.aii.mapping.api.*;
    
    
    public class Wellformed_JavaMapping extends AbstractTransformation {
    
    
        @Override
        public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {
            try {
                InputStream inputstream = transformationInput.getInputPayload().getInputStream();
                OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();
    
    
                // a) Copy Input content to String
                byte[] b = new byte[inputstream.available()];
                inputstream.read(b);
                String inputContent = new String(b);
    
    
                // b) Replace & with &amp; Use this when every & in input is not escaped as &amp;
                inputContent = inputContent.replaceAll("&", "&amp;");
    
    
                // Use this when a few & are escaped as &amp; and a few & are not escaped. This logic will avoid &amp; to become &amp;amp;
                //inputContent = inputContent.replaceAll("&amp;", "____someTEXT_____").replaceAll("&", "&amp;").replaceAll("____someTEXT_____", "&amp;");
               
                outputstream.write(inputContent.getBytes());
            } catch (Exception exception) {
                getTrace().addDebugMessage(exception.getMessage());
                throw new StreamTransformationException(exception.toString());
            }all
        }
    }
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 05, 2015 at 12:14 PM

    Hi Ravi,

    did you try to test the response message mapping with payload (by view source)? Please check if it is because of special char or any other operation/function in message mapping.

    regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 05, 2015 at 12:40 PM

    Hi Ravinder,

    You will need a previous java mapping to omit the special characters. Check this doc: Implementing a Java Mapping in SAP PI to remove Escape Sequences from a file

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Harish,

      Thanks for  the replay.

      I tested the response using view source the above error is due to the special character only.

      If go for java mapping need to maintain the all the special character in the code level right?

      if we maintain some range only these special character some Brasil language we can not avoid the using java mapping Is there any note for the above  issue.

      Regards

      Ravi.

  • Jan 05, 2015 at 01:33 PM

    Hi Ravinder,

    I can notice that your sender system is an ABAP one, you can try to set the connection to unicode like this note explains: 1768901 - PI mapping runtime ParserException

    The java mapping solution can be use to determine what character to accept, easier than to set the erroneous (like this other Dubey Sachi's example Special character’s handling in PI/XI simplest ever.). The Portuguese characters should be accepted in the mapping, i think the problem is with a special control one.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 05, 2015 at 03:00 PM

    Ravi,

    This is not a problem with language characters. It seems Unicode (UTF-8) representation of Emoticons are not properly escaped in XML.

    1) Please download the payload from MONI and save it as .txt file.

    2) Open the payload with notepad++ or foxe editor.

    3) Paste the screenshot here in the SCN, where MESSAGEFORGUEST is present. We would be able to help.

    FYI. In XML &, <, >, ; ,' should not be present in XML data, without escape sequence. Link.

    Emoji Link.


    Portuguese.PNG (56.5 kB)
    Add comment
    10|10000 characters needed characters exceeded