[jboss-user] [JBossWS] - Simple Problem ? - SOAPBody.addDocument()

Jonathan.Martin do-not-reply at jboss.com
Wed Nov 15 06:27:11 EST 2006


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.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986091#3986091

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986091



More information about the jboss-user mailing list