Forum Discussion

pf's avatar
pf
Occasional Contributor
14 years ago

xsi:type and namespace prefixes

hello

we have a teststep 'SampleStep' which returns this response:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:Container xmlns="http://example.ch/ws" xmlns:ns2="http://example.ch/container">
<referencedObjects xsi:type="Person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID>21</ID>
<name>sample</name>
</referencedObjects>
</ns2:Container>
</S:Body>
</S:Envelope>


in the next step we add in the request the following xpath because we need the referencedObjects from the SampleStep Response:

${SampleStep#Response#
declare namespace ws='http://example.ch/ws';
//ws:referencedObjects[1]
}


this returns the following xml-fragment:

<ws:referencedObjects xsi:type="Person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://example.ch/ws">
<ws:ID>21</ws:ID>
<ws:name>sample</ws:name>
</ws:referencedObjects>


soapui adds all the prefixes in the tags correctly (ws:), but not in xsi:type="Person" - now we have the problem that jaxb cannot deserialize the person anymore because of the xsi:type="Person" which is in no namespace. when we change it to xsi:type="ws:Person" it works.

has someone an idea how we can use a simple xpath for the same and which add the prefix ws: to the Person too? or what's an easy solution to the problem and why is this not working automatically?

thanks for helping
No RepliesBe the first to reply