Discussions

XML & Web services: How to send DOM document in Axis?

  1. How to send DOM document in Axis? (2 messages)

    Hi,
    I'm tring to pass a DOM document to a message-style web service in Axis.

    I have deployed a service with the following signature:
        public Document myMethod(Document body)
     
      How can I invoke this service from client side? Actually, I cannot find something like "call.invoke(Document doc)".

    I've try to use the following methods:

       "DOMParser parser = new DOMParser();
       parser.parse("File:///c:/myfile.xml");
       Document doc=parser.getDocument();

       Document dom=(Document)call.invoke(new Object[]{doc});"
     
    and I always got the error:
    faultString: java.io.IOException: No serializer found for class org.apache.xerces.dom.DeferredDocumentImpl in registry org.apache.axis.encoding.TypeMappingImpl@5e13ad
     
     Anyone can help me figure it out? or should I set a proxy first?

     by the way, I'm using Axis 1.1 and Xerces parser.

     Thanks,
     Herman
  2. How to send DOM document in Axis?[ Go to top ]

    The Axis engiine doesn't support serializer/deserializer for DOM Document object. You can either write your own and register it, or use an Element[] something like this:

    public static Element[] getDoc() throws Exception {

      DOMParser parser = new DOMParser();
      parser.parse("File:///c:/myfile.xml");
      Document doc=parser.getDocument();

      Element[] result = new Element[1];
      result[0] = doc.getDocumentElement();
      return result;
    }
  3. How to send DOM document in Axis?[ Go to top ]

    Thanks. It's helpful.