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:
- the deployment descriptor:
- 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:
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,