How to include the soap envelope tag when marshalling using JAXB?

emublimbifigo

New Member
I am marshalling a soap request using JAXB. It is working but the resulting XML does not contain the \[code\]soap:Envelope\[/code\] tag. Also, the namespace is indicated on root element instead of inside the \[code\]soap:Envelope\[/code\] tag. There is also an additional \[code\]standalone\[/code\] attribute on the xml tag. How can I achieved an output similar to the 2nd XML below using JAXB's marshaller?Currently, here's how my marshalled XML looks like:\[code\]<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Customer xmlns:ns="http://www.example.org/beanLevelNamespace"> <ns:id>201200001</ns:id> <ns:name>Name</ns:name> <ns:age>18</ns:age></Customer>\[/code\]And here is how I want it to look like:\[code\]<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:ns="http://www.example.org/beanLevel1Namespace" xmlns:ns1="http://www.example.org/beanLevel2Namespace"> <ns:Customer> <ns1:id>201200001</ns:id> <ns1:name>Name</ns:name> <ns1:age>18</ns:age> </ns:Customer> </soap:Body></soap:Envelope>\[/code\]
 
Back
Top