axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MKW <m.wri...@ru.ac.za>
Subject Re: deserialization problem: unexpected child element
Date Sun, 03 Apr 2005 16:53:56 GMT
Thanks, Anne.

I looked up similar examples and found they had used NMTOKEN, but I had 
doubts about that (wasn't sure why the examples I'd seen had used it) 
and have since changed it back to string. I tried separating out the pos 
bit (see below for the change) in the hope that it might be a namespace 
problem and this would solve it - but it didn't. I'm inferring from your 
comments about the accuracy of the wsdl and the soap messages that it's 
more of a deserialization problem at the server end, after the message 
has been received, and not that the wsdl is somehow badly expressed, 
even though it's accurate?

Madeleine

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:ns0="http://dct/types" xmlns:ns1="http://dct" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dct">
<wsdl:types>
<xs:schema targetNamespace="http://dct/types" 
xmlns="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="posType">
<xs:restriction base="xs:string">
<xs:enumeration value="noun"/>
<xs:enumeration value="verb"/>
<xs:enumeration value="adjective"/>
<xs:enumeration value="adverb"/>
<xs:enumeration value="article"/>
<xs:enumeration value="preposition"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="DictEntry">
<xs:sequence>
<xs:element name="headword" type="xs:string" nillable="false"/>
<xs:element name="plural" type="xs:string" nillable="false"/>
<xs:element name="pos" type="ns0:posType" nillable="false">
</xs:element>
</xs:sequence>
</xs:complexType>


Anne Thomas Manes wrote:
> The WSDL appears to be valid, and the SOAP message matches the WSDL
> description. (The SOAP Body contains only one child element,
> <storeEntryInDB>, which in turn contains one child element, <de>,
> which in turn contains three child elements, <headword>, <plural>, and
> <pos>.)
> 
> Is there a reason why you've defined <pos> as a restriction of NMTOKEN
> rather than of string?
> 
> Anne
> 
> On Mar 31, 2005 12:30 PM, MKW <m.wright@ru.ac.za> wrote:
> 
>>I've got the following Server.userException exception I don't know how
>>to handle because I'm not sure what's caused it:
>>"org.xml.sax.SAXException: SimpleDeserializer encountered a child
>>element, which is NOT expected, in something it was trying to
>>deserialize".  I'm assuming it was a fault in the request message caused
>>by the fact that it is actually sending 3 child elements (as parts of
>>the DictEntry) rather than the one-liner (DictEntry) that the wsdl
>>states?? The return message was only a string so I doubt that was the
>>problem?? If that is the case, can't the deserializing mechanism see
>>that there are 3 child parts to it from the schema type definition? Do I
>>need to include all the child elements at each stage???
>>
>>I mostly hand-coded the wsdl (which I've checked is valid) and have just
>>tested it with soap messages.
>>
>>I've attached the wsdl at the end.
>>
>>I sent this SOAP message:
>><SOAP-ENV:Envelope
>>xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
>>  <SOAP-ENV:Header/>
>>     <SOAP-ENV:Body>
>>         <storeEntryInDB xmlns="http://dct/types">
>>             <de xmlns="">
>>                 <headword>dance</headword>
>>                 <plural>dances</plural>
>>                 <pos>noun</pos>
>>             </de>
>>         </storeEntryInDB>
>>     </SOAP-ENV:Body>
>></SOAP-ENV:Envelope>
>>
>>and got back this SOAP response:
>><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>
>>         <soapenv:Fault>
>>             <faultcode>soapenv:Server.userException</faultcode>
>>             <faultstring>org.xml.sax.SAXException: SimpleDeserializer
>>encountered a child element,
>>                 which is NOT expected, in something it was trying to
>>deserialize.</faultstring>
>>             <detail>
>>                 <ns1:hostname
>>xmlns:ns1="http://xml.apache.org/axis/">Mad</ns1:hostname>
>>             </detail>
>>         </soapenv:Fault>
>>     </soapenv:Body>
>></soapenv:Envelope>
>>
>>Thanks.
>>Madeleine
>>
>>The wsdl:
>><?xml version="1.0" encoding="UTF-8"?>
>><wsdl:definitions xmlns:ns0="http://dct/types" xmlns:ns1="http://dct"
>>xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>>xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>>xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dct">
>><wsdl:types>
>>  <xs:schema targetNamespace="http://dct/types"
>>xmlns="http://www.w3.org/2001/XMLSchema">
>>  <xs:complexType name="DictEntry">
>>    <xs:sequence>
>>     <xs:element name="headword" type="xs:string" nillable="false"/>
>>     <xs:element name="plural" type="xs:string" nillable="false"/>
>>     <xs:element name="pos" nillable="false">
>>      <xs:simpleType>
>>       <xs:restriction base="xs:NMTOKEN">
>>        <xs:enumeration value="noun"/>
>>        <xs:enumeration value="verb"/>
>>        <xs:enumeration value="adjective"/>
>>        <xs:enumeration value="adverb"/>
>>        <xs:enumeration value="article"/>
>>        <xs:enumeration value="preposition"/>
>>       </xs:restriction>
>>      </xs:simpleType>
>>     </xs:element>
>>    </xs:sequence>
>>   </xs:complexType>
>>   <xs:element name="storeEntryInDB">
>>    <xs:complexType>
>>     <xs:sequence>
>>      <xs:element name="de" type="ns0:DictEntry"/>
>>     </xs:sequence>
>>    </xs:complexType>
>>   </xs:element>
>>  <xs:element name="storeEntryInDBResponse">
>>  <xs:complexType>
>>   <xs:sequence>
>>    <xs:element name="storeEntryInDBReturn" type="xs:string"/>
>>   </xs:sequence>
>>  </xs:complexType>
>>  </xs:element>
>>  <xs:element name="returnEntry">
>><xs:complexType>
>>  <xs:sequence>
>>   <xs:element name="hw" type="xs:string"/>
>>  </xs:sequence>
>></xs:complexType>
>></xs:element>
>><xs:element name="returnEntryResponse">
>><xs:complexType>
>><xs:sequence>
>><xs:element name="returnEntryReturn" type="ns0:DictEntry"/>
>></xs:sequence>
>></xs:complexType>
>></xs:element>
>><xs:element name="storeMultiple">
>><xs:complexType>
>><xs:sequence>
>><xs:element maxOccurs="unbounded" name="de" type="ns0:DictEntry"/>
>></xs:sequence>
>></xs:complexType>
>></xs:element>
>><xs:element name="storeMultipleResponse">
>><xs:complexType>
>><xs:sequence>
>><xs:element name="storeMultipleReturn" type="xs:string"/>
>></xs:sequence>
>></xs:complexType>
>></xs:element>
>><xs:element name="returnMultiple">
>><xs:complexType>
>><xs:sequence>
>><xs:element maxOccurs="unbounded" name="hw" type="xs:string"/>
>></xs:sequence>
>></xs:complexType>
>></xs:element>
>><xs:element name="returnMultipleResponse">
>><xs:complexType>
>><xs:sequence>
>><xs:element maxOccurs="unbounded" name="returnMultipleReturn"
>>type="ns0:DictEntry"/>
>></xs:sequence>
>></xs:complexType>
>></xs:element>
>></xs:schema>
>></wsdl:types>
>><wsdl:message name="storeEntryInDBRequest">
>><wsdl:part name="parameters" element="ns0:storeEntryInDB"/>
>></wsdl:message>
>><wsdl:message name="storeEntryInDBResponse">
>><wsdl:part name="parameters" element="ns0:storeEntryInDBResponse"/>
>></wsdl:message>
>><wsdl:message name="storeMultipleRequest">
>><wsdl:part name="parameters" element="ns0:storeMultiple"/>
>></wsdl:message>
>><wsdl:message name="storeMultipleResponse">
>><wsdl:part name="parameters" element="ns0:storeMultipleResponse"/>
>></wsdl:message>
>><wsdl:message name="returnEntryRequest">
>><wsdl:part name="parameters" element="ns0:returnEntry"/>
>></wsdl:message>
>><wsdl:message name="returnEntryResponse">
>><wsdl:part name="parameters" element="ns0:returnEntryResponse"/>
>></wsdl:message>
>><wsdl:message name="returnMultipleRequest">
>><wsdl:part name="parameters" element="ns0:returnMultiple"/>
>></wsdl:message>
>><wsdl:message name="returnMultipleResponse">
>><wsdl:part name="parameters" element="ns0:returnMultipleResponse"/>
>></wsdl:message>
>><wsdl:portType name="DictService">
>><wsdl:operation name="storeEntryInDB">
>><wsdl:input name="storeEntryInDBRequest"
>>message="ns1:storeEntryInDBRequest"/>
>><wsdl:output name="storeEntryInDBResponse"
>>message="ns1:storeEntryInDBResponse"/>
>></wsdl:operation>
>><wsdl:operation name="returnEntry">
>><wsdl:input name="returnEntryRequest" message="ns1:returnEntryRequest"/>
>><wsdl:output name="returnEntryResponse" message="ns1:returnEntryResponse"/>
>></wsdl:operation>
>><wsdl:operation name="storeMultiple">
>><wsdl:input name="storeMultipleRequest" message="ns1:storeMultipleRequest"/>
>><wsdl:output name="storeMultipleResponse"
>>message="ns1:storeMultipleResponse"/>
>></wsdl:operation>
>><wsdl:operation name="returnMultiple">
>><wsdl:input name="returnMultipleRequest"
>>message="ns1:returnMultipleRequest"/>
>><wsdl:output name="returnMultipleResponse"
>>message="ns1:returnMultipleResponse"/>
>></wsdl:operation>
>></wsdl:portType>
>><wsdl:binding name="DictServiceImplSoapBinding" type="ns1:DictService">
>><wsdlsoap:binding style="document"
>>transport="http://schemas.xmlsoap.org/soap/http"/>
>><wsdl:operation name="storeEntryInDB">
>>  <wsdlsoap:operation soapAction=""/>
>><wsdlsoap:operation/>
>><wsdl:input>
>><wsdlsoap:body use="literal"/>
>></wsdl:input>
>><wsdl:output>
>><wsdlsoap:body use="literal"/>
>></wsdl:output>
>></wsdl:operation>
>><wsdl:operation name="returnEntry">
>>   <wsdlsoap:operation soapAction=""/>
>><wsdlsoap:operation/>
>><wsdl:input>
>><wsdlsoap:body use="literal"/>
>></wsdl:input>
>><wsdl:output>
>><wsdlsoap:body use="literal"/>
>></wsdl:output>
>></wsdl:operation>
>><wsdl:operation name="storeMultiple">
>>  <wsdlsoap:operation soapAction=""/>
>><wsdlsoap:operation/>
>><wsdl:input>
>><wsdlsoap:body use="literal"/>
>></wsdl:input>
>><wsdl:output>
>><wsdlsoap:body use="literal"/>
>></wsdl:output>
>></wsdl:operation>
>><wsdl:operation name="returnMultiple">
>>  <wsdlsoap:operation soapAction=""/>
>><wsdlsoap:operation/>
>><wsdl:input>
>><wsdlsoap:body use="literal"/>
>></wsdl:input>
>><wsdl:output>
>><wsdlsoap:body use="literal"/>
>></wsdl:output>
>></wsdl:operation>
>></wsdl:binding>
>><wsdl:service name="DictServiceImpl">
>><wsdl:port name="DictService" binding="ns1:DictServiceImplSoapBinding">
>><wsdlsoap:address
>>location="http://localhost:8080/axis/services/DictServiceImpl"/>
>></wsdl:port>
>></wsdl:service>
>></wsdl:definitions>
>>
>>
> 


Mime
View raw message