Hi friends:
I am developing WebService with axis. I want to publish a webservice in server.So I�@write a method:
--------------------------------------------------------------------------------
public List getPeople(User user){ ArrayListlist=new ArrayList(); list.add(user); return list; }
--------------------------------------------------------------------------------
See the above code ,the User Object!
After publish this method to web, when client invoke this method,Axis will serialize the User object and deserialize the User object for us. I don't have to declared anything in deploy.wsdd.
But if I change the method to the following :
--------------------------------------------------------------------------------
public List getPeople(String userid){ User user=new User(); ArrayListlist=new ArrayList(); list.add(user); return list; }
--------------------------------------------------------------------------------
I new an User object in this method, now Axis couldnd't deserialize the User object! It report an exception when client invoke this method:
--------------------------------------------------------------------------------
AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXException: No deserializer for {http://localhost:8080/axis/services/TestService}User faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace rg.xml.sax.SAXException: No deserializer for {http://localhost:8080/axis/services/TestService}User at org.apache.axis.encoding.DeserializerImpl.onStartElement(DeserializerImpl.java:453) at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:393) at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:369) at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:369) at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2467) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.test.webservice.TestServiceSoapBindingStub.getPeople(TestServiceSoapBindingStub.java:199) at com.test.webservice.Test.main(Test.java:28) {http://xml.apache.org/axis/}hostname:liren
--------------------------------------------------------------------------------
So I add typeMapping in deploy.wsdd,But it is not useful ,Axis report that exception too. :-(
:
--------------------------------------------------------------------------------
<typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" qname="ns2:User" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.test.User" xmlns:ns2="http://localhost:8080/axis/services/TestService"/>
--------------------------------------------------------------------------------
What's different between the two web service method?
Why Axis couldn't deserialize the User Object in the second method? Thks!