Hi,
I wanted to write a "Raw" style web service as described in the JBoss documentation. But am having problems in adding a org.w3c.dom.Document to the SOAPBody using the SOAPBody.addDocument(Document) method.
My client is trying to create a SOAPMessage as follows:
MessageFactory mf = MessageFactory.newInstance();
 SOAPMessage reqMsg = mf.createMessage();
 String request =
 "<ns1:Order xmlns:ns1='" + "http://testnamespace" +
 "' xmlns:ns2='http://somens' attrval='somevalue'>" +
 " <ns2:Customer>Kermit</ns2:Customer>" +
 " Ferrari" +
 "</ns1:Order>";
 DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
 DocumentBuilder builder = builderFactory.newDocumentBuilder();
 org.w3c.dom.Document doc = builder.parse(new ByteArrayInputStream(request.getBytes()));
 reqMsg.getSOAPBody().addDocument(doc);
 reqMsg.writeTo(System.out);
But the request message is never created because of the following error when adding the document to the SOAPBody:
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces
If anyone could point me in the correct direction it would be hugely appreciated.
Cheers,
Jon.