cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in transforming XML to string using XSLT

Former Member
0 Kudos

Hi there,

I have a R/3 -> XI -> WebService scenario where the message from XI to webservice needs to be sent in document/wrapped mode (the message xml must be embedded in a string element) and this message needs to be digitally signed.

We are using another webservice to sign the messages, also with the message being sent in a string. To transform the XML's into string and vice-versa, we are using XSLT (/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping).

The problem is that both the signer and the final webservice understand the special characters (like '<', '>', '&', '"' etc) in one way but the XSLT generates them in another way. For example, the character '<', in both webservices, is returned as "&#60;" but the XSL Transformation results in "&lt;".

The problem now is that our messages are always being rejected because the signature is not being recognized as true, though we are almost 100% sure that it's being done correctly. The only possibility to the error that we found is this character mapping being done differently.

So, it's like this:

XI sends string to signer as "&lt;"

XI receives string from signer as "&#60;"

XI processes the message

XI sends string to webservice as "&lt;"

XI receives string from webservice (containing error message) as "&#60;"

Is there a way of making the XSLT to return "&#60;" instead of "&lt;"?

Thanks in advace,

Henrique.

Accepted Solutions (0)

Answers (2)

Answers (2)

henrique_pinto
Active Contributor
0 Kudos

Problem solved.

Best regards,

Henrique.

moorthy
Active Contributor
0 Kudos

Hi,

I think, you can go for Java functions in XSLT to achieve this. This error occurs, while parsing of xml documents happens. In java function, you can explicitly check for these special charcaters and replace with as required.

This type of problem is solved with Java mapping very easily. Because while starting of the xml document, we can check for the special chars, and we can replace.But in XSLT you can try.

Just my views~

Regards,

Moorthy

henrique_pinto
Active Contributor
0 Kudos

I've never done java mapping before.

Do you have some instructions for a easy way of doing this (transforming xml in string) with java mapping?

Thanks a lot,

Henrique.

moorthy
Active Contributor
0 Kudos

For Java Mapping, you can refer this-

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii

In Java Mapping, in the startdocument event , you need to check for the specialchars, and just repalce the value required.

But, what i am thinking is , just try with Java functions inside the XSLT mapping instead of going for Java Mapping. You can call java functions from the XSLT. So before the document starts pasring, you need to replace the special characters. I did not try in XSLT like this.

For this , you can think with this e.g

/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners

Regards,

Moorthy

former_member206604
Active Contributor
0 Kudos

Hi,

As Krishnamoorthy said you can go with Java mapping or if you are aware of adapter modules and if you have a simple adapter module already just do a replace string to do it. This will not affect your existing XSLT mapping.

Thanks,

Prakash