Deserializing issue when returning array of java bean from JAX-RPC web service

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Deserializing issue when returning array of java bean from JAX-RPC web service

nayal.ashish
I have created a JAX-RPC web service.The web service is returning an Array of Java Bean objects.When I am calling this web service through java client it is giving me error:


Error:

org.xml.sax.SAXException: Deserializing parameter 'getLeaveDetailsReturn':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}LeaveDetailsForm



Please resolve my issue as soon as possible.

Client code:

       
String endPoint= "http://localhost:8080/leavewebservice/services/LeaveDetailsServiceImpl";
             String targetNamespace = "http://services.nic.in";
             String serviceName = "LeaveDetailsServiceImplService";
             String portName = "LeaveDetailsServiceImpl";
            QName qname = new QName("http://forms.leave.nic.in","LeaveDetailsForm");
                    // Service lookup
                    ServiceFactory serviceFactory = ServiceFactory.newInstance();
                    javax.xml.rpc.Service service = serviceFactory.createService(
                        new QName(targetNamespace, serviceName));
 
                     //Service access
                    Call call = (Call) service.createCall();
                    call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
                    call.setProperty(Call.OPERATION_STYLE_PROPERTY, "wrapped");
 
                call.setTargetEndpointAddress(endPoint);
                 call.removeAllParameters();
                call.setPortTypeName(new QName(targetNamespace, portName));
                call.setOperationName(new QName(targetNamespace, "getLeaveDetails"));
 
                call.registerTypeMapping(LeaveDetailsForm.class, qname,
                        new org.apache.axis.encoding.ser.BeanSerializerFactory(LeaveDetailsForm.class, qname),
                        new org.apache.axis.encoding.ser.BeanDeserializerFactory(LeaveDetailsForm.class, qname));
                    if (call.isParameterAndReturnSpecRequired(call.getOperationName())){
                        call.addParameter(
                            "in0",
                            new QName("http://www.w3.org/2001/XMLSchema", "string"),
                    String.class, javax.xml.rpc.ParameterMode.IN);
                        call.addParameter(
                                "in1",
                                new QName("http://www.w3.org/2001/XMLSchema", "string"),
                        String.class, javax.xml.rpc.ParameterMode.IN);
                        call.addParameter(
                                "in2",
                                new QName("http://www.w3.org/2001/XMLSchema", "string"),
                        String.class, javax.xml.rpc.ParameterMode.IN);
                        call.addParameter(
                                "in3",
                                new QName("http://www.w3.org/2001/XMLSchema", "string"),
                        String.class, javax.xml.rpc.ParameterMode.IN);
                        call.setReturnClass(LeaveDetailsForm[].class);
                        call.setReturnType(
                            new QName("http://www.w3.org/2001/XMLSchema", "LeaveDetailsForm"));
                        call.setReturnQName(new javax.xml.namespace.QName("http://services.nic.in", "getLeaveDetailsReturn"));
                   }
 String[] params = {scForm.getEmpCode(),scForm.getLeaveYear(),"ashish","6295"};
                    /* Service invocation */
                    LeaveDetailsForm[] aLeaveDetails= (LeaveDetailsForm[])(call.invoke(params));



LeaveDetailsForm.javaLeaveDetailsServiceImpl.wsdl