on 09-22-2005 8:54 PM
We have a mapping from an RFC to a specific XML message format - the weird thing is the webservice we are sending it to requires that it be sent as a single string <xmlDocument><b>string</b></xmlDocument> even though there are a couple hundred elements. So I need transform the result of my formentioned map into a string and also add a namespace. Can I do this with a custom java function? This is what the scenario looks like in the webservice we are hitting ...
SOAP
The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.
POST /Mmmm.Application.Appl.Electronic.Order/Request.asmx HTTP/1.1
Host: staging.omm.appl.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://www.appl.com/Mmmm.Application.Appl.Electronic.Order/Execute"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<RequestSoapHeader xmlns="https://www.appl.com/Mmmm.Application.Appl.Electronic.Order/">
<correlationId>guid</correlationId>
</RequestSoapHeader>
</soap:Header>
<soap:Body>
<Execute xmlns="https://www.appl.com/Mmmm.Application.Appl.Electronic.Order/">
<xmlDocument><b>string</b></xmlDocument>
</Execute>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ExecuteResponse xmlns="https://www.appl.com/Mmmm.Application.Appl.Electronic.Order/">
<ExecuteResult>string</ExecuteResult>
</ExecuteResponse>
</soap:Body>
</soap:Envelope>
Hi Andrew,
serialize with:
<xmlDocument>
<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[
]]
>
]]>
Regards,
Udo
Deserialize with:
<xsl:for-each select="//xmlDocument">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:for-each>
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Andrew
I did that using Java mappings.Just write a simple Java class which implements StreamTransform interface and include that in the Interface Map.
You can implement execute method which gives source structure as inputstream.You can manupulate this input stream to generate output stream.
Refer to http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
for more info about Java map.
Hope that will help.
Regards
Rajeev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can easily do it with a xslt mapping. There are some generic stlyesheets available in the web to do this. Take a look at this link:
http://www.xmlportfolio.com/xml-to-string/
This has the xsl stylesheet that can help you convert a xml document to string. If you want to add a namespace, you can try editing the xslt.
Regards,
Suresh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.