cancel
Showing results for 
Search instead for 
Did you mean: 

Namespace in SOAP Body Request Structure

Former Member
0 Kudos

Hi,

I have a soap request structure created manually in PI.

The soap body starts with the following

<shipmentRequest>

<Request>

<RequestOption>4EV527680000075</RequestOption>

</Request>

</ShipmentRequest>

Please note that I have created a datatype called ShipmentRequest.

The problem is that the webservice requests expects the structure to be like this.

ShipmentRequest xmlns:m="http://www.test.com/XMLSchema/Xxxxx/Ship/v1.0">

Request xmlns="http://www.test.com/XMLSchema/XOxxxS/Common/v1.0"


How do i insert these namespace at the datatype element level. I tried exporting the datatype into xsd and modifying it, but did not work.

Basically they are expecting the target structure to be like this

<shipmentRequest xmlns:m="http://www.test.com/XMLSchema/Xxxxx/Ship/v1.0">

<Request 

xmlns="http://www.test.com/XMLSchema/XOxxxS/Common/v1.0">

<RequestOption>4EV527680000075</RequestOption>

</Request>

</ShipmentRequest>


Let me know how to handle this.

Regards

Anandh.B

Accepted Solutions (1)

Accepted Solutions (1)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

I something that is not clear at all for me,if you want to send data to WSDL, why you didnt import the WSDL as External Definition????

I you do that you dont need to do any XSLT mapping and any other object because you use the structure of the WSDL imported.

REgards

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

I was able to resolve this by removing the " in the constant function. Just by giving an url, PI automatically adds double quotes.

Thanks Everyone for your inputs.

Regards

Anandh.B

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

i you cannot import the WSDL (i dont think so), you can change the structure of your DT

<shipmentRequest>

<Request>

---> ATTRIBUTE called  xmlns

<RequestOption>

</Request>

</ShipmentRequest>

then in mapping add the value http://www.test.com/XMLSchema/XOxxxS/Common/v1.0 to the attribute.

Former Member
0 Kudos

Hello,

I was able to achieve the namespace just by adding it as an attribute.

The only issue i get is the following

xmlns="&quot;http://www.ups.com/XMLSchema/XOLTWS/Ship/v1.0"">

You can see &quot coming after double quotes.  I have declared the attribute xmlns as string.

Let me know how i can overcome without giving this character.

Regards

Anandh

Former Member
0 Kudos

Hi, Simplest way would be to write a xslt mapping,

It'll be 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 method="xml" encoding="UTF-8"/>

 

<xsl:template match="/">

 

<ns0:MT_Ex xmlns:ns0="yournamespace">

 

  <xsl:copy-of select="." />

 

</ns0:MT_Ex>

 

</xsl:template>

</xsl:stylesheet>

Also Refer this

UDF to add xml namespace tag

Former Member
0 Kudos

Hi,

This is how the structure looks like.

I am pretty new to XSLT.  The above XSLT will just add a new element with the namespace.  But i need to add the namespace in existing node and element.

<shipmentRequest xmlns:m="http://www.test.com/XMLSchema/Xxxxx/Ship/v1.0">

<Request

xmlns="http://www.test.com/XMLSchema/XOxxxS/Common/v1.0">

Even a udf would be great help to do this.

Regards

Anandh.B

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Alright, then the simplest way to do this to put new namespace in the message type -

This will overwrite your repository namespace.

http://help.sap.com/saphelp_banking60/helpdata/en/ba/d4c23b95c8466ce10000000a114084/frameset.htm

Thanks

Amol

ambrish_mishra
Active Contributor
0 Kudos

Hi Anandha,

create an XSD out of the XML structure which third party expects (use Altova or other tools available) and import it as external definition in PI and use it in your mapping.

that should work.

Ambrish

Muniyappan
Active Contributor
0 Kudos

Hi,

i think you can handle in the message mapping.

check this.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/13/write-java-mapping-directly-in-es...

create a string.

first concatenate this to string.

<shipmentRequest xmlns:m="http://www.test.com/XMLSchema/Xxxxx/Ship/v1.0">

then concatenate the below input xml file to string.

<shipmentRequest>

<Request>

<RequestOption>4EV527680000075</RequestOption>

</Request>

</ShipmentRequest>


finally replace <Request> with

<Request

xmlns="http://www.test.com/XMLSchema/XOxxxS/Common/v1.0">

Regards,

Muniyappan.