Forum Discussion

kefile's avatar
15 years ago

Property transfert: problem with namespace used in xsi:type

Hi

I try to transfert a node ('toTransfert') from a response to a request.

Here is the Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:ns1="http://ns1">
<soapenv:Header/>
<soapenv:Body>
<ns1:Response>
<toTransfert xsi:type="ns2:myType" xmlns:ns2="http://ns2">
.....
</toTransfert>
</ns1:Response>
</soapenv:Body>
</soapenv:Envelope>


and here is the Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ns1">
<soapenv:Header/>
<soapenv:Body>
<ns1:Request>
<toTransfert>
<!--Zero or more repetitions:-->
...
</toTransfert>
</ns1:Request>
</soapenv:Body>
</soapenv:Envelope>


I use these xpaths:

--> Source: (with declared namespaces)
/soap:Envelope[1]/soap:Body[1]/ns1:Response/toTransfert


--> Target: (with declared namespaces)
/soap:Envelope[1]/soap:Body[1]/ns1:Request/toTransfert



My problem is that this method doesn't transfert the definition of the namespace used in xsi:type (xmlns:ns2="http://ns2"):

The obtained Request is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ns1">
<soapenv:Header/>
<soapenv:Body>
<ns1:Request>
<toTransfert xsi:type="ns2:myType"> <!-- xmlns:ns2="http://ns2" is missing here-->
.....
</toTransfert>
</ns1:Request>
</soapenv:Body>
</soapenv:Envelope>


How can I do to transfert this namespace declaration?

Thanks in advance!!!

1 Reply

  • Hi,

    Try declaring the xsi namespace before transforming it.

    Regards,
    Rohit Shingalapur