I am having problem while deserializing java objects residing in package other than the package of web service. I am using tcp monitor tool to get the SOAP response. I am attaching the SOAP response of two cases first when the java object and web service both are in same package and I am getting the response, second when java object and web service reside in different package and null pointer exception is thrown while deserializing the response. It looks like this is due to namespaces. But I don't know what need to be changed. -------------------------------- First Case: Sucess
<?xml version="1.0" encoding="UTF-8" ?> - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <SOAP-ENV:Body> - <ns1:getEmployeeResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:test2"> <getEmployeeResult href="#id0" /> </ns1:getEmployeeResponse> - <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:Employee" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:test2"> <ns3:Name xsi:type="xsd:string" xmlns:ns3="urn:test1">ABC</ns3:Name> <ns4:Address xsi:type="xsd:string" xmlns:ns4="urn:test1">1234****</ns4:Address> <ID xsi:type="xsd:int">1</ID> <ns5:PhoneNbr xsi:type="xsd:string" xmlns:ns5="urn:test1">1111</ns5:PhoneNbr> </multiRef> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ----------------------------- Second Case: Error <?xml version="1.0" encoding="UTF-8" ?> - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <SOAP-ENV:Body> - <ns1:getMyObjectResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:ws"> <getMyObjectResult href="#id0" /> </ns1:getMyObjectResponse> - <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:MyObject" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:pr"> <description xsi:type="xsd:string">description here</description> <objectTypeID xsi:type="xsd:int">1</objectTypeID> <modified xsi:type="xsd:boolean">false</modified> <new xsi:type="xsd:boolean">false</new> </multiRef> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ----------------------------- The Error I am getting when running the client is: - Exception: >java.lang.NullPointerException > at >org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(Unknown So >urce) > at >org.apache.axis.encoding.DeserializationContextImpl.startElement(Unkn >own Source) > at org.apache.axis.message.SAX2EventRecorder.replay(Unknown >Source) > at org.apache.axis.message.MessageElement.publishToHandler(Unknown >Sourc >e) > at org.apache.axis.encoding.DeserializerImpl.startElement(Unknown >Source >) > at >org.apache.axis.encoding.DeserializationContextImpl.startElement(Unkn >own Source) > at org.apache.axis.message.SAX2EventRecorder.replay(Unknown >Source) > at org.apache.axis.message.MessageElement.publishToHandler(Unknown >Sourc >e) > at org.apache.axis.message.RPCElement.deserialize(Unknown Source) > at org.apache.axis.message.RPCElement.getParams(Unknown Source) > at org.apache.axis.client.Call.invoke(Unknown Source) > at org.apache.axis.client.Call.invoke(Unknown Source) > at org.apache.axis.client.Call.invoke(Unknown Source) > at com.example.webservice.MyNewServiceSoapBindingStub.getDocument >(MyNewServiceSoapBindingStub.java:160) > at com.example.test.MyNewServiceTest.main(MyNewServiceTest.ja >va:20) >Exception in thread "main" java.lang.Exception: Remote Exception caught: >java.la >ng.NullPointerException > at com.example.test.MyNewServiceTest.main(MyNewTest.ja >va:34) ------------------------------- _________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com