Reputation: 1334
I have several xsd files which are used to create a composition of one SOAP message. The problem is that whenever object is build it imports all inherited xmlns. I didn't found anything about this problem. Is there any way to leave only root xmlns?
Example:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<testRes xmlns="http://xxx/xxx/xxx/v1" xmlns:ns2="http://yyy/yyy/yyy/v1" xmlns:ns3="http://zzz/zzz/zzz/v1">
<status>B</status>
<opisBledu>Error msg...</opisBledu>
</testRes>
</S:Body>
</S:Envelope>
I need the message to be:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<testRes xmlns="http://xxx/xxx/xxx/v1"
<status>B</status>
<opisBledu>Error msg...</opisBledu>
</testRes>
</S:Body>
</S:Envelope>
There is need that xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" from S:Envelope and xmlns:ns2="http://yyy/yyy/yyy/v1" xmlns:ns3="http://zzz/zzz/zzz/v1" from testRes has to be removed. Is there any way to achieve this?
Upvotes: 0
Views: 179
Reputation: 257
Yes, you can specify xmlns inside annotations @XmlRootElement
@XmlElement
@XmlType
in your classes or inside package-info.java
.
For example:
@XmlRootElement (name = "testRes", namespace = "http://xxx/xxx/xxx/v1")
public class TestRes
In your case need to remove unnecessary definitions
Upvotes: 1