You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "E. Seifert" <e....@gmx.net> on 2003/03/15 12:16:14 UTC
newbie: "no deserializer defined for array type XYZ" exceptions
Hi,
I'm a newbie to Axis and SOAP, so please forbear with me: I'm currently
working in project using gSOAP 2.2.3b as server and Axis 1.1 RC2 as
client. I used the wsdl file generated by gSOAP and converted it using
wsdl2java, but I ran into an problem with Axis not able to deserialize
an array of complex type data.
The gSOAP wsdl file defines the following complex types:
...
> <complexType name="Property">
> <sequence>
> <element name="name" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="true"/>
> <element name="type" type="xsd:int" minOccurs="1" maxOccurs="1"/>
> <element name="value" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="true"/>
> <element name="readOnly" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
> </sequence>
> </complexType>
>
> <complexType name="ArrayOfProperty">
> <complexContent>
> <restriction base="SOAP-ENC:Array">
> <sequence>
> <element name="property" type="silva:Property" minOccurs="0" maxOccurs="unbounded"/>
> </sequence>
> <attribute ref="SOAP-ENC:arrayType" WSDL:arrayType="silva:Property[]"/>
> </restriction>
> </complexContent>
> </complexType>
>
> <complexType name="Description">
> <sequence>
> <element name="name" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="true"/>
> <element name="description" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="true"/>
> <element name="id" type="xsd:int" minOccurs="1" maxOccurs="1"/>
> <element name="singletree" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
> <element name="modifying" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
> <element name="properties" type="silva:ArrayOfProperty" minOccurs="1" maxOccurs="1" nillable="true"/>
> </sequence>
> </complexType>
...
Additionally it defines an operation to return a description:
> <operation name="getDescriptionAvailable">
> <documentation>Returns the description for an available object.</documentation>
> <input message="tns:getDescriptionAvailableRequest"/>
> <output message="tns:getDescriptionAvailableResponse"/>
> </operation>
The only unresolved issue so far is that Axis throws an "no deserializer
defined for array type Property" when it gets the follwing SOAP code:
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:silva="urn:silvacpp">
> <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
> <silva:getDescriptionAvailableResponse>
> <description>
> <name xsi:type="xsd:string">Erzeuger NeuerBestand</name>
> <description xsi:type="xsd:string">Eine Beschreibung</description>
> <id xsi:type="xsd:int">7007</id>
> <singletree xsi:type="xsd:boolean">true</singletree>
> <modifying xsi:type="xsd:boolean">false</modifying>
> <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="Property[9]">
> <property><name xsi:type="xsd:string">Key00</name>
> <type xsi:type="xsd:int">1</type>
> <value xsi:type="xsd:string">Baumart00</value>
> <readOnly xsi:type="xsd:boolean">false</readOnly>
> </property>
...
> </properties>
> </description>
> </silva:getDescriptionAvailableResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
I've also tried to get the property array from a seperate SOAP operation
in order to avoid the nested array, but it had no effect. It still threw
the same exception:
> org.xml.sax.SAXException: No deserializer defined for array type Property
> at org.apache.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeserializer.java:304)
> at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:428)
> at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:962)
> at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
> at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:718)
> at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:232)
> at org.apache.axis.message.RPCElement.getParams(RPCElement.java:346)
> at org.apache.axis.client.Call.invoke(Call.java:2234)
> at org.apache.axis.client.Call.invoke(Call.java:2133)
> at org.apache.axis.client.Call.invoke(Call.java:1656)
> at silva.soap.Silva_wsdl.SilvaBindingStub.getDescriptionAvailableProperties(SilvaBindingStub.java:303)
> ...
As I haven't found much documentation or examples so far on arrays in
Axis I would be very grateful if someone in this list could help me or
at leat point out the right direction. On the list archive I read about
similar exceptions being related to a bug (#15698). If so, is there a
workaround? Hopefully, I posted everything you need to help me.
Thanks very much in advance
Eric
Re: newbie: "no deserializer defined for array type XYZ" exceptions
Posted by "E. Seifert" <e....@gmx.net>.
Hi Jinesh,
> Can you send me your WSDL or send a link.? I would just like to compare with mine.
I'll send it to you.
> With Question2: I meant there are tools available which would create a SOAP request and send it to
> Port. and retreive a SOAP response as XML file. like XML SPY. download the evaluation version and
> see whether your getDescriptionAvailable function is executing fine. Or you cna use simple perl
> script.
Yes, I used gSOAP's DEBUG functionality and examined both xml messages,
the request response: they're ok.
> In my case, it is working fine. the error seem to have resolved with regards to printing
> ArrayOfProperty but this has to be changed in the bean/array mapping. Does your deploy.wsdd show
> all the beanmapping or typemappings of Property and Description. It is here axis specifyies
> whether to use beanserializer or arrayserializer or arraylistserializer
Actually, I don't have a deploy.wsdd. Is it required to create a client?
Thanks Jinesh,
Eric
Re: newbie: "no deserializer defined for array type XYZ" exceptions
Posted by "E. Seifert" <e....@gmx.net>.
Hi Jinesh,
here's the WSDL file.
Thanks very much
Eric
Jinesh Varia wrote:
> Can you send me your WSDL or send a link.? I would just like to compare with mine.
>
> With Question2: I meant there are tools available which would create a SOAP request and send it to
> Port. and retreive a SOAP response as XML file. like XML SPY. download the evaluation version and
> see whether your getDescriptionAvailable function is executing fine. Or you cna use simple perl
> script.
>
> In my case, it is working fine. the error seem to have resolved with regards to printing
> ArrayOfProperty but this has to be changed in the bean/array mapping. Does your deploy.wsdd show
> all the beanmapping or typemappings of Property and Description. It is here axis specifyies
> whether to use beanserializer or arrayserializer or arraylistserializer
>
> Jinesh
Re: newbie: "no deserializer defined for array type XYZ" exceptions
Posted by Jinesh Varia <ji...@yahoo.com>.
Can you send me your WSDL or send a link.? I would just like to compare with mine.
With Question2: I meant there are tools available which would create a SOAP request and send it to
Port. and retreive a SOAP response as XML file. like XML SPY. download the evaluation version and
see whether your getDescriptionAvailable function is executing fine. Or you cna use simple perl
script.
In my case, it is working fine. the error seem to have resolved with regards to printing
ArrayOfProperty but this has to be changed in the bean/array mapping. Does your deploy.wsdd show
all the beanmapping or typemappings of Property and Description. It is here axis specifyies
whether to use beanserializer or arrayserializer or arraylistserializer
Jinesh
--- "E. Seifert" <e....@gmx.net> wrote:
> Hi Jinesh,
>
> thanks for your reply. To answer you questions:
> > 1. did you get files (when you used WSDL2Java) like getDescriptionAvailableRequest.java and
> > getDescriptionAvailableResponse.java for function :getDescriptionAvailable and similar files
> for
> > each of your functions? Since this is also a data structure, I suspect that the error is due
> to
> > this getDescriptionAvailableResponse.java?
>
> No, I just got Description.java and Property.java, as well as the
> following files for the service: Silva.java, SilvaBindingStub.java,
> SilvaLocator.java, and SilvaPortType.java.
>
> > 2. can you send a simple SOAP message and retrieve it successfully? I mean the error is coming
> > only when you are using the client?
>
> I also have other operations which return string arrays or boolean
> values, no problems here. Did you mean that?
>
> > 3. confirm your code in the type metadata section of property.java and Description.java files
> also
> > getDescriptionAvailableResponse.java? Please read
> > http://www.mail-archive.com/axis-user@xml.apache.org/msg09060.html. Here they say that there
> is a
> > bug in the code generation that instead of ArrayOfXXX they just have XXX but for me it is
> > ArrayOfXXX only
>
> Using 1.1 RC1 wsdl2java generated the following code in Description.java:
>
> typeDesc.addFieldDesc(elemField);
> elemField = new org.apache.axis.description.ElementDesc();
> elemField.setFieldName("properties");
> elemField.setXmlName(new javax.xml.namespace.QName("", "properties"));
> elemField.setXmlType(new javax.xml.namespace.QName("urn:silvacpp",
> "Property"));
> typeDesc.addFieldDesc(elemField);
>
> but since 1.1 RC2 wsdl2java generates:
>
> elemField.setXmlType(new javax.xml.namespace.QName("urn:silvacpp",
> "ArrayOfProperty"));
>
> this should be correct, I think.
>
> > I cannot move further due to this stupid error. Lets try to resolve it together. step by step
>
> I hope we can solve this issue. I'm just wondering if there aren't more
> people having such prolems with arrays, since it is a very common use case.
>
> Bye
> Eric
>
=====
-----------------------------------------------------------------
Jinesh Varia
Graduate Student, Information Systems
Pennsylvania State University
Email: jinesh@psu.edu
-----------------------------------------------------------------
'Self is the author of its actions.'
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com
Re: newbie: "no deserializer defined for array type XYZ" exceptions
Posted by "E. Seifert" <e....@gmx.net>.
Hi Jinesh,
thanks for your reply. To answer you questions:
> 1. did you get files (when you used WSDL2Java) like getDescriptionAvailableRequest.java and
> getDescriptionAvailableResponse.java for function :getDescriptionAvailable and similar files for
> each of your functions? Since this is also a data structure, I suspect that the error is due to
> this getDescriptionAvailableResponse.java?
No, I just got Description.java and Property.java, as well as the
following files for the service: Silva.java, SilvaBindingStub.java,
SilvaLocator.java, and SilvaPortType.java.
> 2. can you send a simple SOAP message and retrieve it successfully? I mean the error is coming
> only when you are using the client?
I also have other operations which return string arrays or boolean
values, no problems here. Did you mean that?
> 3. confirm your code in the type metadata section of property.java and Description.java files also
> getDescriptionAvailableResponse.java? Please read
> http://www.mail-archive.com/axis-user@xml.apache.org/msg09060.html. Here they say that there is a
> bug in the code generation that instead of ArrayOfXXX they just have XXX but for me it is
> ArrayOfXXX only
Using 1.1 RC1 wsdl2java generated the following code in Description.java:
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("properties");
elemField.setXmlName(new javax.xml.namespace.QName("", "properties"));
elemField.setXmlType(new javax.xml.namespace.QName("urn:silvacpp",
"Property"));
typeDesc.addFieldDesc(elemField);
but since 1.1 RC2 wsdl2java generates:
elemField.setXmlType(new javax.xml.namespace.QName("urn:silvacpp",
"ArrayOfProperty"));
this should be correct, I think.
> I cannot move further due to this stupid error. Lets try to resolve it together. step by step
I hope we can solve this issue. I'm just wondering if there aren't more
people having such prolems with arrays, since it is a very common use case.
Bye
Eric
Re: newbie: "no deserializer defined for array type XYZ" exceptions
Posted by Jinesh Varia <ji...@yahoo.com>.
Hi Eric,
I am also entangled at the exactly similar situation. I have Publications and Persons.
I also tried retriving only persons so that it is not array of arrays. but got the same error
Can you confirm the following?
1. did you get files (when you used WSDL2Java) like getDescriptionAvailableRequest.java and
getDescriptionAvailableResponse.java for function :getDescriptionAvailable and similar files for
each of your functions? Since this is also a data structure, I suspect that the error is due to
this getDescriptionAvailableResponse.java?
2. can you send a simple SOAP message and retrieve it successfully? I mean the error is coming
only when you are using the client?
3. confirm your code in the type metadata section of property.java and Description.java files also
getDescriptionAvailableResponse.java? Please read
http://www.mail-archive.com/axis-user@xml.apache.org/msg09060.html. Here they say that there is a
bug in the code generation that instead of ArrayOfXXX they just have XXX but for me it is
ArrayOfXXX only
I cannot move further due to this stupid error. Lets try to resolve it together. step by step
Jin
--- "E. Seifert" <e....@gmx.net> wrote:
> Hi,
>
> I'm a newbie to Axis and SOAP, so please forbear with me: I'm currently
> working in project using gSOAP 2.2.3b as server and Axis 1.1 RC2 as
> client. I used the wsdl file generated by gSOAP and converted it using
> wsdl2java, but I ran into an problem with Axis not able to deserialize
> an array of complex type data.
>
> The gSOAP wsdl file defines the following complex types:
>
> ...
>
> > <complexType name="Property">
> > <sequence>
> > <element name="name" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="true"/>
> > <element name="type" type="xsd:int" minOccurs="1" maxOccurs="1"/>
> > <element name="value" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="true"/>
> > <element name="readOnly" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
> > </sequence>
> > </complexType>
> >
> > <complexType name="ArrayOfProperty">
> > <complexContent>
> > <restriction base="SOAP-ENC:Array">
> > <sequence>
> > <element name="property" type="silva:Property" minOccurs="0" maxOccurs="unbounded"/>
> > </sequence>
> > <attribute ref="SOAP-ENC:arrayType" WSDL:arrayType="silva:Property[]"/>
> > </restriction>
> > </complexContent>
> > </complexType>
> >
> > <complexType name="Description">
> > <sequence>
> > <element name="name" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="true"/>
> > <element name="description" type="xsd:string" minOccurs="1" maxOccurs="1"
> nillable="true"/>
> > <element name="id" type="xsd:int" minOccurs="1" maxOccurs="1"/>
> > <element name="singletree" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
> > <element name="modifying" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
> > <element name="properties" type="silva:ArrayOfProperty" minOccurs="1" maxOccurs="1"
> nillable="true"/>
> > </sequence>
> > </complexType>
>
> ...
>
> Additionally it defines an operation to return a description:
>
> > <operation name="getDescriptionAvailable">
> > <documentation>Returns the description for an available object.</documentation>
> > <input message="tns:getDescriptionAvailableRequest"/>
> > <output message="tns:getDescriptionAvailableResponse"/>
> > </operation>
>
> The only unresolved issue so far is that Axis throws an "no deserializer
> defined for array type Property" when it gets the follwing SOAP code:
>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:silva="urn:silvacpp">
> > <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
> > <silva:getDescriptionAvailableResponse>
> > <description>
> > <name xsi:type="xsd:string">Erzeuger NeuerBestand</name>
> > <description xsi:type="xsd:string">Eine Beschreibung</description>
> > <id xsi:type="xsd:int">7007</id>
> > <singletree xsi:type="xsd:boolean">true</singletree>
> > <modifying xsi:type="xsd:boolean">false</modifying>
> > <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="Property[9]">
> > <property><name xsi:type="xsd:string">Key00</name>
> > <type xsi:type="xsd:int">1</type>
> > <value xsi:type="xsd:string">Baumart00</value>
> > <readOnly xsi:type="xsd:boolean">false</readOnly>
> > </property>
>
> ...
>
> > </properties>
> > </description>
> > </silva:getDescriptionAvailableResponse>
> > </SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
>
> I've also tried to get the property array from a seperate SOAP operation
> in order to avoid the nested array, but it had no effect. It still threw
> the same exception:
>
> > org.xml.sax.SAXException: No deserializer defined for array type Property
> > at org.apache.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeserializer.java:304)
> > at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:428)
> > at
>
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:962)
> > at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
> > at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:718)
> > at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:232)
> > at org.apache.axis.message.RPCElement.getParams(RPCElement.java:346)
> > at org.apache.axis.client.Call.invoke(Call.java:2234)
> > at org.apache.axis.client.Call.invoke(Call.java:2133)
> > at org.apache.axis.client.Call.invoke(Call.java:1656)
> > at
>
silva.soap.Silva_wsdl.SilvaBindingStub.getDescriptionAvailableProperties(SilvaBindingStub.java:303)
> > ...
>
> As I haven't found much documentation or examples so far on arrays in
> Axis I would be very grateful if someone in this list could help me or
> at leat point out the right direction. On the list archive I read about
> similar exceptions being related to a bug (#15698). If so, is there a
> workaround? Hopefully, I posted everything you need to help me.
>
> Thanks very much in advance
> Eric
>
>
>
=====
-----------------------------------------------------------------
Jinesh Varia
Graduate Student, Information Systems
Pennsylvania State University
Email: jinesh@psu.edu
-----------------------------------------------------------------
'Self is the author of its actions.'
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com