Wrong Serialization when rpc/literal style is used?
fpitschi Jul 7, 2005 8:16 AMI am using jboss4.0.1sp1 and have used rpc/enc for my deployed webservices until now (which worked fine after solving some initial problems...)
I want to change to rpc/lit now.
To do that, I created my wsdl from my java-interface again with wscompile, using the -f:rpclit option. It looks ok, and I think that jboss is creating the right typemapping for my SimpleInfoBean in the wsdd (encoding style is now ''):
<typeMapping qname='ns1:SimpleInfo' xmlns:ns1='http://db.bioinfo.rzg.mpg.de' type='java:de.mpg.rzg.bioinfo.db.SimpleInfo' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='intProperty' xmlName='intProperty'/> <elementDesc fieldName='stringArrayProperty' xmlName='stringArrayProperty'/> <elementDesc fieldName='stringProperty' xmlName='stringProperty'/> <elementOrder> <element name='intProperty'/> <element name='stringArrayProperty'/> <element name='stringProperty'/> </elementOrder> </typeDesc> </typeMapping>
Is this correct for rpc/lit?
I am calling the webservice-method (method takes a String, returns a SimpleInfo-Object) using a DII client.
The request SOAP message looks like:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:getObjekt soapenv:encodingStyle="x" xmlns:ns1="http://db.bioinfo.rzg.mpg.de"> <String_1>diimitwsdl</String_1> </ns1:getObjekt> </soapenv:Body> </soapenv:Envelope>
I use the soapenv:encodingStyle="x" (instead of "") becuase otherwise, an ""-namespace is created for the child element and jboss doesn't like that ;-)
The response is:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:getObjektResponse xmlns:ns1="http://db.bioinfo.rzg.mpg.de"> <ns1:SimpleInfo> <intProperty>10</intProperty> <stringArrayProperty>a</stringArrayProperty> <stringArrayProperty>bc</stringArrayProperty> <stringArrayProperty>diimitwsdl</stringArrayProperty> <stringProperty>diimitwsdl</stringProperty> </ns1:SimpleInfo> </ns1:getObjektResponse> </soapenv:Body> </soapenv:Envelope>
I wonder why a
<ns1:SimpleInfo>element is used instead of
<result>.
becuase the WSDL defines that the returned element's name is "result":
<message name="SeqReferenceInfoEndpoint_getObjektResponse"> <part name="result" type="tns:SimpleInfo"/>
Looks like the server-side is creating the right response except that it uses ns1:SimpleInfo instead of result.
On the client side, can i use
typemappingLIT.register(SimpleInfo.class, simpleinfoQNAME, new BeanSerializerFactory(SimpleInfo.class, simpleinfoQNAME), new BeanDeserializerFactory(SimpleInfo.class, simpleinfoQNAME));
to register the right Serializers/Deserializers (i did that with rpc/enc)?
If I need custom-(de)serializers on the client or server - side, which tool should I use to create them (wscompile?wsdl2java?)? Are there any examples for doing this somewhere?
Thanks for your help!!!
Regards
Florian Pitschi