You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Ruane, Conleth" <co...@hp.com> on 2004/06/23 13:23:55 UTC

Accessing Axis service using Axis client (JSP)

Hi All.
I am currently trying to migrate a SOAP client (JSP page) from Apache SOAP to Axis.

I can now successfully send and receive simple messages but I'm having a problem with the deserialization of Complex types.

This is the relevant piece of code (adapted from the Axis bidbuy sample):

            //build a Call object
            org.apache.axis.client.Service service = new org.apache.axis.client.Service();
            org.apache.axis.client.Call call = (org.apache.axis.client.Call)service.createCall();
//            call.setTargetEndpointAddress(new java.net.URL(targetObjectURI));
            call.setTargetEndpointAddress(new java.net.URL(ewsUrl));
            call.setUseSOAPAction(true);
            call.setSOAPActionURI("urn:ews-structs");

            // register the ActionResult class
            QName arqn = new QName("urn:ews-structs",
                               "ActionResult");
            Class cls = ActionResult.class;
            call.registerTypeMapping(cls, arqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);

            call.setOperation("putCustomer");
//            call.registerTypeMapping(ActionResult.class, new QName("urn:ews-structs", "ActionResult"), BeanSerializer.class, BeanSerializer.class);

            call.addParameter("sessionToken", XMLType.XSD_STRING, ParameterMode.IN); 
            call.addParameter("customer", new QName("urn:ews-structs", "CRMCustomer"), ParameterMode.IN); 
            call.setReturnType( new QName("urn:ews-structs", "ActionResult"));
            ar = (ActionResult)call.invoke(new Object[] {ewsToken, cust});


The error I'm getting is 
"
Error: org.xml.sax.SAXException: Deserializing parameter 'putCustomerReturn':  could not find deserializer for type {urn:ews-structs}ActionResult
"

I also tried it without specifying a mapping for ActionResult.
What I find odd is that the class CRMCustomer is being serialized ok (checked using tcp-tunnel) although I'm not specifying any mapping for CRMCustomer.

Any helpful suggestions are greatly appreciated.

Thanks
Con 

Re: Accessing Axis service using Axis client (JSP)

Posted by Scott Nichol <sn...@scottnichol.com>.
I don't know the answer to either of your questions (why doesn't Axis de-serialize the return value, and how does Axis know how to serialize the CRMCustomer-type).  I suggest you give the Axis list a whirl (axis-user@ws.apache.org).

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Ruane, Conleth" <co...@hp.com>
To: <so...@ws.apache.org>
Sent: Wednesday, June 23, 2004 7:23 AM
Subject: Accessing Axis service using Axis client (JSP)


Hi All.
I am currently trying to migrate a SOAP client (JSP page) from Apache SOAP to Axis.

I can now successfully send and receive simple messages but I'm having a problem with the deserialization of Complex types.

This is the relevant piece of code (adapted from the Axis bidbuy sample):

            //build a Call object
            org.apache.axis.client.Service service = new org.apache.axis.client.Service();
            org.apache.axis.client.Call call = (org.apache.axis.client.Call)service.createCall();
//            call.setTargetEndpointAddress(new java.net.URL(targetObjectURI));
            call.setTargetEndpointAddress(new java.net.URL(ewsUrl));
            call.setUseSOAPAction(true);
            call.setSOAPActionURI("urn:ews-structs");

            // register the ActionResult class
            QName arqn = new QName("urn:ews-structs",
                               "ActionResult");
            Class cls = ActionResult.class;
            call.registerTypeMapping(cls, arqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);

            call.setOperation("putCustomer");
//            call.registerTypeMapping(ActionResult.class, new QName("urn:ews-structs", "ActionResult"), BeanSerializer.class, BeanSerializer.class);

            call.addParameter("sessionToken", XMLType.XSD_STRING, ParameterMode.IN); 
            call.addParameter("customer", new QName("urn:ews-structs", "CRMCustomer"), ParameterMode.IN); 
            call.setReturnType( new QName("urn:ews-structs", "ActionResult"));
            ar = (ActionResult)call.invoke(new Object[] {ewsToken, cust});


The error I'm getting is 
"
Error: org.xml.sax.SAXException: Deserializing parameter 'putCustomerReturn':  could not find deserializer for type {urn:ews-structs}ActionResult
"

I also tried it without specifying a mapping for ActionResult.
What I find odd is that the class CRMCustomer is being serialized ok (checked using tcp-tunnel) although I'm not specifying any mapping for CRMCustomer.

Any helpful suggestions are greatly appreciated.

Thanks
Con