cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Namespace in SOAP Body

Former Member
0 Kudos

I have an integration using BPM for sending the below request using the SOAP adapter.  However, the partner is receiving the "request" message with a namespace (see below).

Request Message from PI to partner using the SOAP Adapter:

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

    <SOAP-ENV:Body>

        <m:AuthorizeFileUpload xmlns:m="http://service.xxx.com/">

            <m:xmlData>

                <bulkid>

                    <request>

                        <source-type></source-type>

                        <database-type></database-type>

                    </request>

                </bulkid>

            </m:xmlData>

        </m:AuthorizeFileUpload>

    </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Received message:

<request xmlns="http://service.xxx.com/"><source>1</source><database>2</database></request>

I have the AF_Modules/XMLAnonymizerBean in the SOAP Adapter and it removes all namespaces except xmlns="http://service.xxx.com/".

Any ideas to remove the namespace in the SOAP body?

Thanks!

Accepted Solutions (0)

Answers (2)

Answers (2)

iaki_vila
Active Contributor
0 Kudos

Hi David,

You can try with this XSL:


<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:m="http://service.xxx.com/">

<xsl:output method="xml"/>

<xsl:template match="node()|@*">

     <xsl:copy>

       <xsl:apply-templates select="node()|@*"/>

     </xsl:copy>

</xsl:template>

<xsl:template match="m:*">

  <xsl:element name="{local-name()}">

    <xsl:apply-templates select="node()|@*"/>

  </xsl:element>

</xsl:template>

</xsl:stylesheet>               

And you will get the XML without the m namespace:


<?xml version="1.0"?>

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

<SOAP-ENV:Body>

<AuthorizeFileUpload>

<xmlData>

<bulkid>

<request>

<source-type/>

<database-type/>

</request>

</bulkid>

</xmlData>

</AuthorizeFileUpload>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Regards.

Former Member
0 Kudos

Hi,


This would appear to be a good solution, but I believe the <request xmlns="http://service.xxx.com/"> namespace is being added by the SOAP adapter when invoking the WSDL.

WSDL snippet:

<s:schema elementFormDefault="qualified" targetNamespace="http://service.xxx.com/">

    <s:element name="AuthorizeFileUpload">

I don't believe any XSLT mapping will alleviate this issue.  Are there any changes in the WSDL that we could make?

Thanks again! 

Former Member
0 Kudos

Would I be able to call this XSL from the SOAP Adapter using MessageTransformBean?

markangelo_dihiansan
Active Contributor
0 Kudos

Hi David,


WSDL snippet:

<s:schema elementFormDefault="qualified" targetNamespace="http://service.xxx.com/">

    <s:element name="AuthorizeFileUpload">

WSDL editing should be a last resort, but anyway, yes there is a way.

1. Open the wsdl in a notepad. Change elementFormDefault value from qualified to unqualified.

2. Delete the targetNamespace. Combining 1 and 2


<s:schema elementFormDefault="qualified" targetNamespace="http://service.xxx.com/">

results in


<s:schema elementFormDefault="unqualified">

3. Under the wsdl:message part, look for AuthorizeFileUpload, it should look something like this


  <wsdl:message name="AuthorizeFileUpload">

    <wsdl:part name="AuthorizeFileUploadType" element="m:AuthorizeFileUpload" />

  </wsdl:message>

change it to


<wsdl:message name="AuthorizeFileUpload">

  <wsdl:part name="AuthorizeFileUploadType" element="AuthorizeFileUpload" />

</wsdl:message>

Save and reimport wsdl.

Regards,

Mark

Former Member
0 Kudos

Hi David,

Kindly use m:AuthorizeFileUpload xmlns:m="http://service.xxx.com/" in the parent tag, i.e., where the tag starts with <SOAP-ENV:Envelope xmlns:SOAP-ENV=.......

It should work then.

Regards,

Souvik