cancel
Showing results for 
Search instead for 
Did you mean: 

XML structure inside WS string response

Former Member
0 Kudos

Hi all,

I have a PI scenario and I can find a solution.

The scenario is a ABAP PROXY that consume a WS, this is no problem, the problem is that the web service returns a string parameter, and inside the string parameter there is a XML structure.

My doubt is, how can mapping it to get the response in a structured data type instead of a string??

Thanks a lot

Raú

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

PI version is 7.1

The XML has a fixed structure.

Id like do it without JAVA mapping.

Thanks

stefan_grube
Active Contributor
0 Kudos

> Id like do it without JAVA mapping.

This is not possible.

It is a bad design and it is better to change the web service in a way, that the response is a plain XML.

When the structure is fixe, then there is no reason to hide the XML in a string.

Former Member
0 Kudos

I have several ws that works in that way, Can I do JAVA mapping for all them? Or reuse one with low changes?

anupam_ghosh2
Active Contributor
0 Kudos

Hi,

you can keep a common java class. This java class may be instantiated from multiple interfaces within same SWCV. There may be smaller java mapping class within each interface which will pass different values of parameters to the common class.

regards

Anupam

stefan_grube
Active Contributor
0 Kudos

If the element which contains the XML always the same, you can use a simple XSLT mapping.

Something like:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output indent="no" method="xml" encoding="UTF-8"/>
    <!-- copy payload -->
    <xsl:value-of select="//string"/>
</xsl:template>

</xsl:stylesheet>

You can use a second mapping step to trasnform the result of this mapping to the ABAP proxy message structure.

Answers (1)

Answers (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi ,

Is the return type is an XML structure? Then use java mapping using DOM parser to extract the string from response. Then the mapping program can generate the required target structure from the string.

you can if possible let the forum members know, the response xml message and the structure of target XML as per your requirement. Finally also the version of PI you are working is also important as java mapping procedure is different for PI7.0 and PI 7.1.

___________________________________________________________________________________________

As Stefan has pointed out without java mapping it will be almost impossible to extract the target XML from String. Still you can try out with XSLT mapping, but I don't think that will be easy task to do. Java mapping is the correct procedure to solve your problem. Finally forum members will be able to assist you if you provide complete source and target XML structure alog with sample string response. you can reuse java mapping code for multiple interfaces within same SWCV. The part or module which will be calling the common code with different input parameters will vary accross interfaces depending on your need.

_________________________________________________________________________________________________

regards

Anupam

Edited by: anupamsap on Sep 29, 2011 1:55 PM

Edited by: anupamsap on Sep 29, 2011 2:21 PM