[jboss-user] [JBossWS] - SoapBodyImpl, JDK5 and JDom

wilth do-not-reply at jboss.com
Fri Apr 13 09:41:37 EDT 2007


I recently tried to upgrade from JDK 1.4 to JDK 5 (we are talking Jboss 4.0.5) but I'm having trouble with the following piece of code:

  | org.jdom.Document doc = new org.jdom.Document();
  | org.jdom.Element root = new org.jdom.Element("inputData");
  | doc.setRootElement(root);
  | MessageFactory messageFactory = MessageFactory.newInstance();
  | // Create the SOAP Message
  | SOAPMessage requestSoapMessage = messageFactory.createMessage();
  | DOMOutputter converter = new DOMOutputter();
  | org.w3c.dom.Document iDoc = converter.output(doc);
  | requestSoapMessage.getSOAPBody().addDocument(iDoc);

As you can see, I'm creating an XML Document programmatically with JDom, then I'm converting it into a "standard" DOM and then I'm putting it into a SOAP envelope. The addDocument method throws:

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.

Now this error should be raised when a prefix is used, but no namespace or the qualified name is malformed. However, I'm not using namespaces in my document (other than the empty default NS).

I have tried to add a namespace to the Dom4j Document - that solves the problem. The document (when outputted through a transformer) is well-formed. The problem also does not occur with JDK 1.4 or JDK 6 u1. I'm not sure the problem is with the Jboss WS package either, so please let me know if this is not related to the jboss ws implementation.

Any ideas on why I'm facing this? Thanks for any pointers.

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

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

More information about the jboss-user mailing list