Skip to main content

Encoding saaj api

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
nick2011
Offline
Joined: 2011-09-02

Hi

I am programming a client application in Java using the soap saaj api, my source code is the following:

SOAPEnvelope env = msg.getSOAPPart().getEnvelope();

SOAPHeaderElement h;
env.addNamespaceDeclaration(CWMP, URN_CWMP);
env.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
env.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
h = msg.getSOAPHeader().addHeaderElement(spf.createName("ID ", CWMP, URN_CWMP));

h.setMustUnderstand(true);

h.setValue(id);

Y el mensaje xml que recibe el servidor es el siguiente:

<SOAP-ENV: Envelope>

xmlns:SOAP-ENV="http://sc hemas.xmlsoap.org/soap/envelope/"

xmlns:cwmp=& ;quo t;urn:dslforum-org:cwmp-1-0"

xmlns:xsd="http ://www.w3.org/2001/XMLSchema"

xmlns:xsi="htt p://www.w3.org/2001/XMLSchema-instance"

<SOAP-ENV:Header>

<cwmp:ID>

SOAP- ENV:mustUnderstand="1"

897

</cwmp:I D>

</SOAP-ENV:Header>

¿Is this XML format right? I have this question because I think the xmlns and mustUnderstand must be inside the last label (between <>). If it is wrong, ¿how can I correct it?

Thank you very much. Regards.