cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT mapping with SOAP Envelope

Former Member
0 Kudos

Hi

I'm trying map SOAP response (with Envelope) to pick two values into the target. Here's the data:

Source (with data):

<?xml version="1.0"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<soap:Body>

<EnumerateResponse xmlns="http://www.approva.net/BizRights/Services">

<EnumerateResult>

<TaskID>-1</TaskID>

<Result>FinishedSuccessfully</Result>

<StatusInfo/>

</EnumerateResult>

<pageObject>

<startIndex>0</startIndex>

<pageSize>10</pageSize>

<totalRows>1</totalRows>

<moreRecords>false</moreRecords>

<rowsReturned>1</rowsReturned>

</pageObject>

<xmlObjects>(large string of valid data in here)</xmlObjects>

</EnumerateResponse>

</soap:Body>

</soap:Envelope>

Target:

Only need Result and xmlObjects into target.

Mapping:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<poll_status_resp_r3>

<Result>

<xsl:value-of select="EnumerateResponse/Result"/>

</Result>

<xmlObjects>

<xsl:value-of select="EnumerateResponse/xmlObjects"/>

</xmlObjects>

</poll_status_resp_r3>

</xsl:template>

</xsl:stylesheet>

The values are not getting picked-up into the target.

What am I missing here?

Any help is appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

former_member206604
Active Contributor
0 Kudos

Hi,

You Xpath should be from the root tag as you have said <xsl:template match="/">

like this

soap:Envelope/soap:/Body/EnumerateResponse/Result

You can also try this

"//Result"

Thanks,

Prakash

Answers (10)

Answers (10)

Former Member
0 Kudos

I am facing a similar problem in my scenario.

The data which is coming out of R/3 has some special charecters which is creating problems for the recieving application.

Does somebody have a java UDF which can clear off these special charecters.

Or better still can these charecters be suppressed in the Proxy Program itself.

The scenario is SOAP -- XI -- Proxy (Synchronous).

Best Regards,

Kanwaljit

(kanwaljit.singh@gmail.com)

Former Member
0 Kudos

This is interesting. Even when I give a static value (wihout special characters in the second field that's not showing-up), it's not getting transferred back into R3.

There is some disconnection.

Any help is appreciated.

Rajendra.

Former Member
0 Kudos

Thanks for the update.

You're right, I hardly have control on the SOAP response.

I'd like to explore both CDATA and the ABAP mapping program options. Appreciate if you can put some sample code for the latter as suggested.

Java UDF is also a good option.

My first goal is to get it to work with any method.

Appreciate all help.

Rajendra.

former_member206604
Active Contributor
0 Kudos

Hi,

Even if you use CDATA you will have the problem COZ CDATA syntax is <!CDATA[. You can notice the < is present even in CDATA. so that will not solve your problem. You need to use UDF and can replace < &lt; and > by &gt; You can also check if there is any other special character and use the same. Hope you are aware of the replace function in Java.. you can use it. If not just try googling replace() java function.

Thanks,

Prakash

Former Member
0 Kudos

Yes, the reponse is mapped correctly.

YES, the large string DOES contain special characters < and >. THIS MAY BE THE REASON.

How do I use '&lt' (dumb question, sorry) to escape the special characters? I now feel 95% close.

Is there a place that I can configure to avoid special characters?

Any help is appreciated.

Rajendra.

Former Member
0 Kudos

Hi Rajendra,

As far as I know you can't solve this easily in the message mapping

I assume that you can't influence the SOAP response ? Otherwise you can try to give an escaped answer in the SOAP response directly. How to do that depends upon which environment is building the soap answer .

In my example, I used a ABAP mapping program as a first mapping step. This program loaded the entire XML response into a XML DOM and then generated a new copied XML document using pure ABAP DOM functions : IN this way , the XML element texts were now in an escaped format.

IF this is what you want to do I can copy some sample code.

Alternatively, you can use an XSLT mapping step to put the entire XML string in a <![CDATA[...]]> section and see if the proxy mapper handles a CDATA section correctly.

I think that if you can see the SOAP reponse ok in XI, it's probably possible to use a JAVA UDF that replaces all special characters as a first mapping step

What would be best in your case, you think ?

Dirk

Former Member
0 Kudos

Mine is synchronous Proxy -> SOAP. My issue is in the return journey from SOAP to Proxy. I've looked for the value in my ABAP Program but does not show up, though sxmb_moni shows all values in the response back into R3.

Do large strings behave differently?

Any help is appreciated.

Rajendra.

Former Member
0 Kudos

Hi Rajendra,

1) Are you sure your response is mapped correctly ?

2) Does your large string contains special characters ?

( e.g. like '<' or '>' )

I had an issue where the RFC adapter did not parse the XML message correctly into the RFC parameters because of this.

Maybe it's the same issue with parsing the parameters back into the proxy response.

I solved my issue by escaping any special character in the response : e.g. use '&lt;'

regards

Dirk

Former Member
0 Kudos

I'm pretty sure there is data in SXMB_MONI.

The test interface mapping works flawlessly passing data. Can you detail little more on the External breakpoint check/debug?

Rajendra.

former_member206604
Active Contributor
0 Kudos

Hi,

What is your scenario?

Is it RFC -> SOAP? Then there is no need for a external breakpoint. You just keep a break point in your calling ABAP program and check of the value is returned from XI duing response.

If not.. then you will be connecting to R/3 by a receiver CC by using a user right.. Not logon to R/3 with the same user and in the RFC keep a External break point so that while executing it will stop there in the breakpoint and there you can see if the value is coming in to R/3.

Thanks,

Prakash

Former Member
0 Kudos

Prakash,

Extremely helpful answer. More than 90% journey through.

I see the (valid) response in XI.

There are two fields in the reply coming into R3 (both defined as strings). Content in one is a small string and the other has a very large string.

I see the small string coming into the R3.

The large string somewhere seems to have fallen through the cracks, can't see it in R3 (valid and visible in XI).

Any end-quotes of your advice?

Rajendra.

former_member206604
Active Contributor
0 Kudos

Hi,

What is your Scenario basically?

Are u sure the value is there in SXMB_MONI..

Try to download the response XML file and check it in Test tab of interface mapping if it looks fine.

Then keep a External Breakpoint in R/3 for the user which you are using in the adapter. IN the debug check if it is passed to R/3.

Thanks,

Prakash

Former Member
0 Kudos

Tired, but still an issue.

Any change in this (this option seems promising) syntax:

"soap:Envelope/soap:/Body/EnumerateResponse/Result".

Anyone facing similar issue(s)?

Rajendra.

former_member206604
Active Contributor
0 Kudos

Hi,

Save the following XSL file as RSpace.xsl

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

  <xsl:output method="xml" indent="no"/>

  <xsl:template match="/|comment()|processing-instruction()">
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="*">
    <xsl:element name="{local-name()}">
      <xsl:apply-templates select="@*|node()"/>
    </xsl:element>
  </xsl:template>

  <xsl:template match="@*">
    <xsl:attribute name="{local-name()}">
      <xsl:value-of select="."/>
    </xsl:attribute>
  </xsl:template>

</xsl:stylesheet>

Zip it and import it under Imported Archive.

In the interface mapping click "+" to add one more mapping.

Use this XSL as first mapping and your XSL mapping as the second mapping.

In your XSLT mapping you can use the XPath as

"Envelope/Body/EnumerateResponse/Result".

I mean remove the namespace and use the XPATH.

Thanks,

Prakash

Former Member
0 Kudos

Will test it thru interface mapping. Currently trying to test in StylusStudio.

Originally, I had used '
Result' which had not worked.

When I use, 'soap:Envelope/soap:/Body/EnumerateResponse/Result

' as suggested, it's giving error like:

-


The namespace prefix 'soap' has not been defined

in value-of followed by <mapping file with path>.

This is in StylusStudio, when testing to get it to work.

-


This is the new mapping tried:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<poll_status_resp_r3>

<Result>

<xsl:value-of select="soap:Envelope/soap:/Body/EnumerateResponse/Result"/>

</Result>

</poll_status_resp_r3>

</xsl:template>

</xsl:stylesheet>

Appreciate the inputs.

Rajendra.

former_member206604
Active Contributor
0 Kudos

Hi,

You need to give "//Result" and not as "
Result"

Thanks,

Prakash

Former Member
0 Kudos

Thanks, Prakash for the quick reply.

Will give it a try.

Is any cache refresh necessary after the XSLT mapping is updated, reimported, configured and activated?

former_member206604
Active Contributor
0 Kudos

Hi,

Generally not needed.. but if you doubt is there is a cache problem do it. Did you test your mapping in the Test tab of the interface mapping. You can check if your output is proper.

Thanks,

Prakash