3 Replies Latest reply on Nov 30, 2004 11:29 PM by Shawn Dahlen

    Create SOAPElement from DOM Document

    Shawn Dahlen Newbie

      I am having issues trying to build a SOAPElement from a DOM Document. The code is as follows:

      MessageFactory factory = MessageFactory.newInstance();
      SOAPMessage msg = factory.createMessage();
      SOAPBody body = msg.getSOAPPart().getSOAPEnvelope().getSOAPBody();
      SOAPElement element = body.addDocument(doc);

      Unfortunately, the addDocument() method does not seem to work (adds nothing). Is there another approach I can take?

      Shawn Dahlen

        • 1. Re: Create SOAPElement from DOM Document
          Shawn Dahlen Newbie

          As a follow up, I attempted to use SOAPElementAxisImpl directly by:

          SOAPElement element = new SOAPElementAxisImpl(doc.getDocumentElement());

          This had no effect either. I am currently using 4.0.1 RC1, has this bug been fixed in a more recent version in CVS?

          Shawn Dahlen

          • 2. Re: Create SOAPElement from DOM Document
            Shawn Dahlen Newbie

            After some hours of digging around, the actual issue seems to be related to serialization of the response object. The response object looks as follows:

            public class GetByUserResponse {
             protected javax.xml.soap.SOAPElement _any;
             public GetByUserResponse() {
             public GetByUserResponse(javax.xml.soap.SOAPElement _any) {
             this._any = _any;
             public javax.xml.soap.SOAPElement get_any() {
             return _any;
             public void set_any(javax.xml.soap.SOAPElement _any) {
             this._any = _any;

            No matter what type of content I place in the SOAPElement, nothing is returned. I had a look at the generated Apache Axis WSDD file, and the type mapping for the object looks as follows:

             qname='ns1:>getByUserResponse' xmlns:ns1='http://iss.lmco.com/service/action-item-summary'
             <elementDesc fieldName="_any" xmlName="ns1:null"/>

            Now I haven't investigated exactly what the xmlName should be for the field, _any, but ns1:null doesn't seem right. Am I looking into the right area? Any help would be appreciated.


            Shawn Dahlen

            • 3. Re: Create SOAPElement from DOM Document
              Shawn Dahlen Newbie

              I have now confirmed both issues:

              1) Unable to use SOAPBody.addDocument() method to create SOAPElement from DOM Document

              2) Response object with xsd:any does not serialize properly (no matter what is set in the SOAPElement object).

              Wish I could continue this, but its time for bed. Thoughts?

              Shawn Dahlen