4 Replies Latest reply on Nov 23, 2005 6:26 AM by thomas.diesler

    Webservice client deployment

    sudhakaratbits

      Hello All
      I am kinda new to webservices and also JBoss. I am trying out the examples given in the JBossWS documentation Wiki. I am trying to develop a document type service and a client for that service. I am able to deploy the service successfully but now the problem is with the client application. I am writing a stand-alone client (a helper class) that accesses this webservice and fetches the information i need. My webservice returns a custom value object as a return type. I am getting an error something like this.

      org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
      at org.jboss.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:206)

      at org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1168)

      at org.jboss.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)

      at org.jboss.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1386)

      at org.jboss.axis.message.RPCElement.deserialize(RPCElement.java:262)


      at org.jboss.axis.message.RPCElement.getParams(RPCElement.java:396)

      at org.jboss.axis.client.Call.invoke(Call.java:2662)

      at org.jboss.axis.client.Call.invoke(Call.java:2538)

      at org.jboss.axis.client.Call.invokeInternal(Call.java:1976)

      at org.jboss.axis.client.Call.invoke(Call.java:1914)



      Here is the code i used for client application....

      // call the webservice

      URL url = new URL(SvcLocation);

      QName svcName = new QName(qn,"ListCustomerService");



      QName opName = new QName(qn,"getListOfCustomers");

      QName retName = new QName(qn,"result");



      Service service = new Service();



      Call call = (Call) service.createCall();

      call.setTargetEndpointAddress(url);



      call.setOperationName(opName);

      call.addParameter("String_1", XMLType.XSD_STRING,ParameterMode.IN);

      call.registerTypeMapping(ListCustomersVO.class, retName,

      new org.jboss.axis.encoding.ser.BeanSerializerFactory(ListCustomersVO.class, retName),new org.jboss.axis.encoding.ser.BeanDeserializerFactory(ListCustomersVO.class, retName));



      call.setReturnType(retName,ListCustomersVO.class );



      ListCustomersVO resListCustomersVO = (ListCustomersVO)call.invoke(new Object[] {CustomerName});



      I am really stuck...n not able to proceed further... pls help.

      thanks
      sudhakar


        • 1. Re: Webservice client deployment
          bogsolomon

          Is the exception given when the server deseralizes the request, or when the client deserializes the response?

          Also if you could set up the org.jboss.axis package to DEBUG in Log4j and look at the deserializartion steps and post here where in the deserialization it is throwing the exception.


          From the exception code it tries to use a SimpleDeserializer to deserialize the object but it gets a child element in it. I am not sure if a SimpleDeserialzer can process children since a SimpleDeserailzer should process Strings, Int, etc - basic values and not complex objects.

          Also useful might be to post your .wsdd file. You can find it in {JBoss_HOME}\server\data\wsdl\{yourarchive}.war

          • 2. Re: Webservice client deployment
            sudhakaratbits

            here is the WSDD file...


            <deployment
            xmlns='http://xml.apache.org/axis/wsdd/'
            xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
            xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
            xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
            xmlns:xsd='http://www.w3.org/2001/XMLSchema'>






            <operation name='getListOfCustomers' qname='ns1:getListOfCustomers' returnQName='ns2:getListOfCustomersResponse' returnType='ns2:getListOfCustomersResponse' xmlns:ns1='http://demobanking.webservices' xmlns:ns2='http://demobanking.webservices/types' >
            <parameter name='parameters' qname='ns2:getListOfCustomers' mode='IN' type='ns2:getListOfCustomers' xmlns:ns2='http://demobanking.webservices/types' />
            <fault name='DemoException' qname='ns2:DemoException' type='ns2:DemoException' class='demobanking.utils.DemoException' xmlns:ns2='http://demobanking.webservices/types' />


            <typeMapping
            qname='ns2:CustomerMasterVO' xmlns:ns2='http://demobanking.webservices/types'
            type='java:demobanking.vo.CustomerMasterVO'
            serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
            deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
            encodingStyle=''>


































            <typeMapping
            qname='ns2:DemoException' xmlns:ns2='http://demobanking.webservices/types'
            type='java:demobanking.utils.DemoException'
            serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
            deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
            encodingStyle=''>












            <typeMapping
            qname='ns2:ListCustomersDTO' xmlns:ns2='http://demobanking.webservices/types'
            type='java:demobanking.dto.ListCustomersDTO'
            serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
            deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
            encodingStyle=''>








            <typeMapping
            qname='ns2:getListOfCustomers' xmlns:ns2='http://demobanking.webservices/types'
            type='java:demobanking.webservices.ListCustomersEndPoint_getListOfCustomers_RequestStruct'
            serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
            deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
            encodingStyle=''>








            <typeMapping
            qname='ns2:getListOfCustomersResponse' xmlns:ns2='http://demobanking.webservices/types'
            type='java:demobanking.webservices.ListCustomersEndPoint_getListOfCustomers_ResponseStruct'
            serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
            deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
            encodingStyle=''>












            The exception is given when the client deserializes the response. the server is working properly since i am able to see the data thats being fetched from my data source.

            any other suggestions?

            • 3. Re: Webservice client deployment
              bogsolomon

              Well

              a) Did the type mapping get cut out cause I can not see ListCustomersVO mapping anywhere

              b) Try using a MetaDataBeanDeserializer in your client app. Not sure if it would solve anything but it might.

              c) Can you set the level to DEBUG and post the message sent on the wire? Either something is being sent wrong, or it's using the wrong deserializer.

              • 4. Re: Webservice client deployment
                thomas.diesler

                Sudhakar, you could use the [ code ] marker to make this more legable