cancel
Showing results for 
Search instead for 
Did you mean: 

Several namespaces in schema

former_member198060
Participant
0 Kudos

Hello,

I have a question regarding schema files which contain several namespaces and hope that you can help me out.

The scenario is a simple SOAP webservice call. As there are some custom parameters in the soap header required, I decided to make my own schema file containing the soap envelope and including the header fields. This makes it easier and more transparent in the mapping in my opinion. Additionally I have checked the "Do not use SOAP envelope" option on the SOAP receiver communication channel.

The SOAP call I need to make should look something like this:

<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:ns1="http://test.com/ns1"

xmlns:ns2="http://test.com/ns2"

xmlns:ns3="http://test.com/ns3">

    <ns0:Header>

        <ns1:details>

               ...

        </ns1:details>

        <ns2:authentication>

               ...

        </ns2:authentication>

    </ns0:Header>

    <ns0:Body>

        <ns3:data>

          ...

         </ns3:data>

As you can see we have four namespaces and each should be explicitly referenced for certain elements of the message.

In my schema file I am using imports and have created it similar to this:

<xs:schema

    xmlns:xs = "http://www.w3.org/2001/XMLSchema"

    xmlns:ns0 = "http://www.w3.org/2001/12/soap-envelope/"

    xmlns:xsd = "undefined"

    xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/"

    xmlns:ns1 = "http://test.com/ns1"

    xmlns:ns2 = "http://test.com/ns2"

    xmlns:ns3 = "http://test.com/ns3"

    targetNamespace="http://www.w3.org/2001/12/soap-envelope/">

    <xs:import namespace = "http://test.com/ns1" schemaLocation = "ns1.xsd"/>

    <xs:import namespace = "http://test.com/ns1" schemaLocation = "ns2.xsd"/>

    <xs:import namespace = "http://test.com/ns1" schemaLocation = "ns3.xsd"/>

    <!--Envelope, header and body -->

    <xs:element name = "Envelope" type = "ns0:Envelope"/>

    <xs:complexType name = "Envelope">

        <xs:sequence>

            <xs:element ref = "ns0:Header" minOccurs = "0"/>

            <xs:element ref = "ns0:Body" minOccurs = "1"/>

        </xs:sequence>

        <xs:anyAttribute namespace = "##other" processContents = "lax"/>

    </xs:complexType>

    <xs:element name = "Header" type = "ns0:Header"/>

    <xs:complexType name = "Header">

        <xs:sequence>

            <xs:any

                namespace = ""

                minOccurs = "0"

                maxOccurs = "unbounded"

                processContents = "lax"/>

            <xs:element ref = "ns1:details"></xs:element>

            <xs:element ref = "ns2:authentication"></xs:element>

        </xs:sequence>

        <xs:anyAttribute namespace = "##other" processContents = "lax"/>

    </xs:complexType>

    <xs:element name = "Body" type = "ns0:Body"/>

    <xs:complexType name = "Body">

        <xs:sequence>

            <xs:element ref = "ns3::data" minOccurs = "1"/>

         </xs:sequence>    

    </xs:complexType> 

</xs:schema>

Please dont mind syntax errors or similar as this is just sample data to give you a general idea about what I did so far.

My problem:

After processing on PI, the data I am receiving is correct, but the namespaces are missing. In the result data I only have the ns0 (my targetNamespace) namespace. All the other namespaces are gone. This already happens when I test my mapping, so I assume it is a problem with my schema.

It would be great if you could give me some pointers how I could resolve this and how to change my schema in order to have the namespaces showing in my PI messages.

Accepted Solutions (0)

Answers (1)

Answers (1)

sunilchandra007
Active Contributor
0 Kudos

>>After processing on PI, the data I am receiving is correct, but the namespaces are missing.

This is how namespace are handled internally in message mapping.

You have 3 options available to get the expected output.

1. Write simple UDF with use of setNSDeclarations as described in .

2. Go for Java Mapping

3. Check XSLT mapping

Regards,

Sunil Chandra