Olá, Pessoal!
Eu preciso adicionar no XML request o Soap:Envelope e Soap:Body. Alguém sabe como adiciono essa informação no XML?
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
Estou usando JAXB para passar Java Objects para XML schema. Java 8:
@XmlRootElement(name="Example")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder={"name", "age"})
public class XmlData implements Serializable {}
XML que é criado (sem as informações do soap):
<?xml version="1.0" encoding="UTF-8"?>
<Example xmlns="http://tempuri.org/">
<name></name>
<age></age>
</Example>
Eu preciso que fique assim:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Example xmlns="http://tempuri.org/">
<name></name>
<age></age>
</Example>
</soap:Body>
</<soap:Envelope>
Marshal
JAXBContext jaxbContext = JAXBContext.newInstance(XmlData.class);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
marshaller.setProperty("com.sun.xml.internal.bind.xmlHeaders", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
StringWriter writer = new StringWriter();