Hi!

In User's Guide of Axis there is stated that  Axis supports messaging with three types of methods:
public Element [] method(Vector v);
public Document method(Document doc);
public void method(MessageContext mc);

The sample in samples/messaging is using the first method (public Element [] method(Vector v);). I was trying to get it working with the second, but with no success.
This is what I did:
- my service looks like:
        import org.w3c.dom.Document;
        public class XMLService
        {
            public Document addElement(Document doc) throws Exception
            {
                doc.getDocumentElement().setAttribute("service", "XMLService");
                return doc;       
            }
        }
- the deployment descriptor:
        <deployment
              xmlns="http://xml.apache.org/axis/wsdd/"
              xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
              xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
          <service name="XMLService" provider="java:MSG">
            <parameter name="className" value="XMLService" />
            <parameter name="allowedMethods" value="addElement" />
          </service>
        </deployment>

- the client's main method:

        String endpointURL = "http://localhost:8080/axis/services/XMLService";
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(endpointURL));
       
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder1 = factory.newDocumentBuilder();
        Document doc2 = builder1.newDocument();
        Element kovi= doc2.createElement("kovi");
        kovi.setNodeValue("neki");
        doc2.appendChild(kovi);
        call.setOperationName("addElement");
        call.addParameter("doc", Constants.XSD_ANYTYPE, Document.class, javax.xml.rpc.ParameterMode.IN);
        call.setReturnType(Constants.XSD_ANYTYPE, Document.class);
        System.out.println("DOC = " + doc2);
        Document a = (Document) call.invoke(new Document[] {doc2});

The created doc2 Document is of type org.apache.crimson.tree.XmlDocument.

- after running this I get an exception:
        Exception in thread "main" AxisFault
        faultCode: {http://xml.apache.org/axis/}Server.userException
        faultString: java.io.IOException: No serializer found for class
        org.apache.crimson.tree.XmlDocument in registry
        org.apache.axis.encoding.TypeMappingImpl@4cee32
        faultActor: null
        faultDetail:
        stackTrace: java.io.IOException: No serializer found for class org.apache.crimson.tree.XmlDocument in registry
        org.apache.axis.encoding.TypeMappingImpl@4cee32 at
        org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1109)at
        org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:684)at
        org.apache.axis.encoding.SerializationContextImpl.outputMultiRefs(SerializationContextImpl.java:736)
        ......

I also tried creating the doc2 with JDOM, but at the end I end up with the same org.apache.crimson.tree.XmlDocument type document.

Can anyone please tell me what I am doing wrong ?

Best regards,
        Kovi

Reply via email to