cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime mapping error due to the special characters in source XML

Former Member
0 Kudos

Hi All,

I am facing problem with the special characters coming in the source XML message. it is failing at runtime in the mapping level. when i test with the same XML message manually in graphical message mapping it works.

it looks like a UNICODE problem which we face noramlly in ABAP as well. but looking for a solution.

For your reference i am giving the data which i am recivieing and the error message below.

the problem is with the character .

Source payload error:-

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

-

-


An invalid character was found in text content. Error processing resource 'file:///C:/WINNT/profiles/CG1009/Local Settings/Temp/a173eb8_2721HTML000003'. Line 26, Position 22

Early response is appreciated.

Thank you

Accepted Solutions (0)

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Raghu,

your input message should have a declaration like:

<?xml version="1.0" encoding="ISO-8859-1"?>  

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

I applied this encoding manually in the XML message and uploaded it. it works.

Actually this encoding="ISO-8859-1" is done at source system(Web methods). but the problem is XI is recieving the XML message like this <?xml version="1.0"?>

not like this <?xml version="1.0" encoding="ISO-8859-1"?>

.

what are the available options for me to change the XML header from <?xml version="1.0"?>

to

<?xml version="1.0" encoding="ISO-8859-1"?>

before it reaches the message mapping.

Thank you again

Raghu

udo_martens
Active Contributor
0 Kudos

Hi Raghu,

you have to use an additional ABAP mapping. DOM knowledge is not required (nevertheless of course usefull). Replace (ABAP keywords REPLACE or SEARCH) the declaration in a common way.

The ABAP method 'execute' is using parameter input and result type XSTRING. - Convert the incoming X-String to String with FM ECATT_CONV_XSTRING_TO_STRING, back to X-String with FM ECATT_CONV_STRING_TO_XSTRING.

Add a line (first place) in your IF mapping and refer the ABAP mapping - ready

Regards,

Udo

henrique_pinto
Active Contributor
0 Kudos

If your message contains special chars and the encoding is not being set, then the error is of the system which is sending the message, not XI's. The webserver should return the correct encoding.

At adapter engine, You can set the enconding for the messages you send (for example, in Soap adapter module, set XMBWS.XMLEncoding parameter with value iso-8859-1), but not for the messages you receive.

As a workaround, you could try using a Java Mapping to change the encoding manually. For that, set the encoding of the OutputFormat of the XML you'll serialize. Try the following code piece for the mapping (inside a try/catch declaration):

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder documentBuilder = factory.newDocumentBuilder();

Document input = documentBuilder.parse(in);

OutputFormat format = new OutputFormat(XML, "ISO-8859-1", false);

XMLSerializer serializer = new XMLSerializer(out, format);

serializer.serialize(input);

For that code to work, you'll need to import xercesImpl.jar and xml-apis.jar in Imported Archives of mapping objects, in Integration Repository. Both are available at http://xerces.apache.org/xerces2-j/ .

Regards,

Henrique.

former_member206604
Active Contributor
0 Kudos

Hi,

Use this XSL code to do it.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output encoding="ISO-8859-1"/>
<xsl:template match="/">
<xsl:copy-of select="*"/>
</xsl:template>
</xsl:stylesheet>

This will convert UTF-8 to ISO-8859-1

You can use it in your interface mapping.

But first try to make it in the adapter encoding.

Thanks,

Prakash

former_member206604
Active Contributor
0 Kudos

Hi,

Are u using File adapter as Sender.. set it to Binary mode. Also try changing the encoding format in the XML.

Thanks,

Prakash

Former Member
0 Kudos

Hi,

I am using XI adapter connecting to Webmethods.

and how do i do XML encoding? in this case.

Thanks

Former Member
0 Kudos

Hey,

y dont u try specifying the encoding technique in the source xml which u sent.

this is how u add the encoding technique in ur xml

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

U can also try using encodoing technique like UTF-16

cheers

jithesh