Sorry -- I just realized that I left out the quotes on my suggestions. The corrected definitions should be:
<element name="User" type="tns2:User" /> <element name="UserGroup" type="tns2:UserGroup" /> <part name="body" element="tns2:User" /> <part name="body" element="tns2:UserGroup" /> (the part name "body" can, of course be changed to whatever you want it to be) ----- Original Message ----- From: "Anne Thomas Manes" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 07, 2003 11:26 AM Subject: Re: Deserialization problems with document/literal Web service > Stuart, > > Since you haven't defined global elements in your schema, I suspect there's > an error in your WSDL: > > When using document style, your <part> definitions must use an element= > attribute rather than a type= attribute, and you must reference an <element> > definition rather than a <ComplexType> definition. So you need to define two > additional elements in your schema: > > <element name=User type=tns2:User /> > <element name=UserGroup type=tns2:UserGroup /> > > and you need to modify your message part definitions to reference these > elements: > > <part name=body element=tns2:User /> > > <part name=body element=tns2:UserGroup /> > > And this local element definition in the "User" type would cause trouble: > <element name="marks" nillable="true" type="impl:ArrayOf_xsd_float"/> > > You haven't provided us with the schema for the impl namespace, but I > suspect that this is a SOAP Encoding type. You should define the "marks" > element this way: > <element name="marks" type="xsd:float" minOccurs="0" maxOccurs="unbounded" > /> > > Also, you should replace nillable="true" with minOccurs="0" in all your > definitions. > > Regards, > Anne > > > ----- Original Message ----- > From: "Stuart Barlow" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, August 07, 2003 8:52 AM > Subject: Re: Deserialization problems with document/literal Web service > > > > Could this be related to AXIS generating an invalid WSDL for > > DOCUMENT/LITERAL services? > > > > It is correct that DOCUMENT/LITERAL does not send type info > > over the wire with each call because the client should already have > > the type information from the WSDL. > > > > Brit Ziemendorf wrote: > > > Hi all, > > > > > > I implemented a small document /literal Web service sending and > > > receiving complex objects. > > > The XML Schema looks like listed below. > > > As can be seen a "UserGroup" consists of some String elements and a > > > Hashtable that itself contains "User" objects. > > > > > > The Problem: > > > When the client sends a UserGroup object the contained Hashtable can not > > > be deserialized properly. When I debug it, it looks as if Axis can not > > > find the correct Deserializer and uses a SimpleDeserializer as default. > > > The SimpleDeserializer throws an exception because simple values are not > > > supposed to have child elements. > > > > > > However, when the server sends a UserGroup object back to the client, > > > the result is nearly the same. It seems that the client expects a > > > Hashtable and therefore uses the MapDeserializer, but the included > > > ItemDeserializer is not able to find the correct Deserializer for the > > > items value, a "User" object. Again a SimpleDeserializer is used as > > > default and throws an exception. > > > > > > When debugging it seems that in both cases the SimpleDeserializer is > > > choosen because there are no type information available. > > > How can this be? Is it normal for a document/literal service that no > > > type information is sent over the wire? > > > When I implement the same service as RPC/encoded it works fine. > > > Is there anything that I can do, so that Axis gets the correct > > > Deserializer? (Both objects are already registered in the TypeMapping!) > > > > > > HELP!! > > > > > > > ____________________________________________________________________________ > _________ > > > > > > <schema xmlns="http://www.w3.org/2001/XMLSchema" > > > targetNamespace="http://bookstore.universal"> > > > <complexType name="User"> > > > <sequence> > > > <element name="age" type="xsd:int"/> > > > <element name="name" nillable="true" type="xsd:string"/> > > > <element name="profession" nillable="true" type="xsd:string"/> > > > <element name="userID" nillable="true" type="xsd:string"/> > > > <element name="marks" nillable="true" type="impl:ArrayOf_xsd_float"/> > > > </sequence> > > > </complexType> > > > <complexType name="UserGroup"> > > > <sequence> > > > <element name="groupID" type="xsd:string"/> > > > <element name="groupName" nillable="true" type="xsd:string"/> > > > <element name="groupUsers" nillable="true" type="apachesoap:Map"/> > > > </sequence> > > > </complexType> > > > </schema> > > > <schema xmlns="http://www.w3.org/2001/XMLSchema" > > > targetNamespace="http://xml.apache.org/xml-soap"> > > > <complexType name="mapItem"> > > > <sequence> > > > <element name="key" nillable="true" type="xsd:string"/> > > > <element name="value" nillable="true" type="tns2:User"/> > > > </sequence> > > > </complexType> > > > <complexType name="Map"> > > > <sequence> > > > <element name="item" minOccurs="0" maxOccurs="unbounded" > > > type="apachesoap:mapItem"/> > > > </sequence> > > > </complexType> > > > </schema> > > > > ____________________________________________________________________________ > _______________ > > > > > > > > > Thanks, > > > Brit > > > > > > > > >
