Reputation: 333
I need to change the xmlns empty string value that is getting generated.
<SOAP-ENV:Body>
<AirShoppingRQ xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="17.2" >
Expected :
<SOAP-ENV:Body>
<AirShoppingRQ xmlns="http://www.iata.org/IATA/EDIST/2017.2"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="17.2" >
Have tried editing packag-info.java as
@javax.xml.bind.annotation.XmlSchema(
xmlns = {
@javax.xml.bind.annotation.XmlNs(prefix = "xsd",
namespaceURI = "http://www.w3.org/2001/XMLSchema"),
@javax.xml.bind.annotation.XmlNs(prefix = "xsi",
namespaceURI = "http://www.w3.org/2001/XMLSchema-instance")
}
)
below is the root element :
@XmlRootElement(name = "AirShoppingRQ")
public class AirShoppingRQ {
}
Even though i tried removing it as attribute, but not able to add it again.
SOAPElement x = (SOAPElement) body.getChildElements().next();
x.removeAttribute("xmlns");
Please note : xmlns should not have any "ns2" or "ns3" prefix ,as server is not accepting it.
Can anyone please help ?
Upvotes: 0
Views: 464
Reputation: 167401
I would try
@XmlRootElement(name = "AirShoppingRQ", namespace = "http://www.iata.org/IATA/EDIST/2017.2")
public class AirShoppingRQ {
}
or if you have a schema with that namespace as the targetNamespace I think you can use e.g.
@XmlRootElement(name = "AirShoppingRQ", namespace = "##default")
public class AirShoppingRQ {
}
Upvotes: 0