0 Replies Latest reply on Apr 13, 2007 9:41 AM by Markus Wilthaner

    SoapBodyImpl, JDK5 and JDom

    Markus Wilthaner Newbie


      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");
      MessageFactory messageFactory = MessageFactory.newInstance();
      // Create the SOAP Message
      SOAPMessage requestSoapMessage = messageFactory.createMessage();
      DOMOutputter converter = new DOMOutputter();
      org.w3c.dom.Document iDoc = converter.output(doc);

      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.