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 Madeleine Wright <m....@ru.ac.za> on 2004/12/03 20:13:33 UTC

document style problem

I'm currently using axis-1_2RC1 and have encountered a behaviour I can't 
explain.  I have been experimenting with the different types of 
programming styles available in Axis.  I have no problem with the RPC 
default or the wrapped/literal styles but when I use exactly the same 
wsdd file but substitute "document" for "wrapped", I get the following 
error on calling the service: "SimpleDeserializer encountered a child 
element, which is NOT expected, in something it was trying to 
deserialize".  The service is exactly the same with the other 2 styles 
so why does "Document" cause this problem?  Even when I create a fault 
situation, I have no problem with the other styles.

I generated the WSDLs for the 2 styles (see below): the main difference, 
as explained in the User Guide, is the treatment of the operation 
element.  Neither the default RPC style nor the document style uses the 
<complexType> element so this doesn't look to be the problem.  The 
service accepts a string as input and returns a string as output.

Please does anyone have an answer?

WSDL for wrapped service:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions 
targetNamespace="http://localhost:8080/axis/services/Testing"
    xmlns:apachesoap="http://xml.apache.org/xml-soap"
    xmlns:impl="http://localhost:8080/axis/services/Testing"
    xmlns:intf="http://localhost:8080/axis/services/Testing"
    xmlns:tns1="http://Testing"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace=http://Testing 
xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="process">
    <complexType>
     <sequence>
      <element name="in0" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="processResponse">
    <complexType>
     <sequence>
      <element name="processReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

   <wsdl:message name="processRequest">
      <wsdl:part element="tns1:process" name="parameters"/>
   </wsdl:message>
   <wsdl:message name="processResponse">
      <wsdl:part element="tns1:processResponse" name="parameters"/>
   </wsdl:message>
   <wsdl:portType name="TryIndex">
      <wsdl:operation name="process">
         <wsdl:input message="impl:processRequest" name="processRequest"/>
         <wsdl:output message="impl:processResponse" 
name="processResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="TestingSoapBinding" type="impl:TryIndex">
      <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="process">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="processRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="processResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="TryIndexService">
      <wsdl:port binding="impl:TestingSoapBinding" name="Testing">
         <wsdlsoap:address 
location="http://localhost:8080/axis/services/Testing"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>


WSDL FOR THE DOCUMENT STYLE
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions 
targetNamespace="http://localhost:8080/axis/services/Testing" 
xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:impl="http://localhost:8080/axis/services/Testing" 
xmlns:intf="http://localhost:8080/axis/services/Testing" 
xmlns:tns1="http://Testing" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
  <schema elementFormDefault="qualified" 
targetNamespace="http://Testing" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="in0" type="xsd:string"/>
  </schema>
  <schema elementFormDefault="qualified" 
targetNamespace="http://localhost:8080/axis/services/Testing" 
xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="processReturn" type="xsd:string"/>
  </schema>
 </wsdl:types>
   <wsdl:message name="processRequest">
      <wsdl:part element="tns1:in0" name="in0"/>
   </wsdl:message>
   <wsdl:message name="processResponse">
      <wsdl:part element="impl:processReturn" name="processReturn"/>
   </wsdl:message>
   <wsdl:portType name="TryIndex">
      <wsdl:operation name="process" parameterOrder="in0">
         <wsdl:input message="impl:processRequest" name="processRequest"/>
         <wsdl:output message="impl:processResponse" 
name="processResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="TestingSoapBinding" type="impl:TryIndex">
      <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="process">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="processRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="processResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="TryIndexService">
      <wsdl:port binding="impl:TestingSoapBinding" name="Testing">
         <wsdlsoap:address 
location="http://localhost:8080/axis/services/Testing"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

Thanks.

Madeleine


Re: document style problem

Posted by Madeleine Wright <m....@ru.ac.za>.
Tony,

Thanks so much.  That does help to explain it.

Madeleine



tony.q.weddle@gsk.com wrote:
> 
> Madeleine,
> 
> The wrapped style only refers to the parameters to the service, not the 
> response. Consequently, your two WSDLs produce the same input to the 
> same service. However, the output from the service is presumably sending 
> back the following XML fragment:
> 
> <processResponse>
>     <processReturn>the result string</processReturn>
> </processResponse>
> 
> The first WSDL maps this exactly but the second WSDL is not expecting 
> any child elements, hence the error. Try it with the response defined in 
> the same way as for the first WSDL.
> 
> Tony
> 
> "Madeleine Wright" <m....@ru.ac.za> wrote on 03/12/2004 19:13:33:
> 
>  > I'm currently using axis-1_2RC1 and have encountered a behaviour I can't
>  > explain.  I have been experimenting with the different types of
>  > programming styles available in Axis.  I have no problem with the RPC
>  > default or the wrapped/literal styles but when I use exactly the same
>  > wsdd file but substitute "document" for "wrapped", I get the following
>  > error on calling the service: "SimpleDeserializer encountered a child
>  > element, which is NOT expected, in something it was trying to
>  > deserialize".  The service is exactly the same with the other 2 styles
>  > so why does "Document" cause this problem?  Even when I create a fault
>  > situation, I have no problem with the other styles.
>  >
>  > I generated the WSDLs for the 2 styles (see below): the main difference,
>  > as explained in the User Guide, is the treatment of the operation
>  > element.  Neither the default RPC style nor the document style uses the
>  > <complexType> element so this doesn't look to be the problem.  The
>  > service accepts a string as input and returns a string as output.
>  >
>  > Please does anyone have an answer?
>  >
>  > WSDL for wrapped service:
>  > <?xml version="1.0" encoding="UTF-8"?>
>  > <wsdl:definitions
>  > targetNamespace="http://localhost:8080/axis/services/Testing"
>  >     xmlns:apachesoap="http://xml.apache.org/xml-soap"
>  >     xmlns:impl="http://localhost:8080/axis/services/Testing"
>  >     xmlns:intf="http://localhost:8080/axis/services/Testing"
>  >     xmlns:tns1="http://Testing"
>  > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>  >     xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>  >     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  > <wsdl:types>
>  > <schema elementFormDefault="qualified" targetNamespace=http://Testing
>  > xmlns="http://www.w3.org/2001/XMLSchema">
>  >    <element name="process">
>  >     <complexType>
>  >      <sequence>
>  >       <element name="in0" type="xsd:string"/>
>  >      </sequence>
>  >     </complexType>
>  >    </element>
>  >    <element name="processResponse">
>  >     <complexType>
>  >      <sequence>
>  >       <element name="processReturn" type="xsd:string"/>
>  >      </sequence>
>  >     </complexType>
>  >    </element>
>  >
>  >   </schema>
>  >  </wsdl:types>
>  >
>  >    <wsdl:message name="processRequest">
>  >       <wsdl:part element="tns1:process" name="parameters"/>
>  >    </wsdl:message>
>  >    <wsdl:message name="processResponse">
>  >       <wsdl:part element="tns1:processResponse" name="parameters"/>
>  >    </wsdl:message>
>  >    <wsdl:portType name="TryIndex">
>  >       <wsdl:operation name="process">
>  >          <wsdl:input message="impl:processRequest" 
> name="processRequest"/>
>  >          <wsdl:output message="impl:processResponse"
>  > name="processResponse"/>
>  >       </wsdl:operation>
>  >    </wsdl:portType>
>  >    <wsdl:binding name="TestingSoapBinding" type="impl:TryIndex">
>  >       <wsdlsoap:binding style="document"
>  > transport="http://schemas.xmlsoap.org/soap/http"/>
>  >       <wsdl:operation name="process">
>  >          <wsdlsoap:operation soapAction=""/>
>  >          <wsdl:input name="processRequest">
>  >             <wsdlsoap:body use="literal"/>
>  >          </wsdl:input>
>  >          <wsdl:output name="processResponse">
>  >             <wsdlsoap:body use="literal"/>
>  >          </wsdl:output>
>  >       </wsdl:operation>
>  >    </wsdl:binding>
>  >    <wsdl:service name="TryIndexService">
>  >       <wsdl:port binding="impl:TestingSoapBinding" name="Testing">
>  >          <wsdlsoap:address
>  > location="http://localhost:8080/axis/services/Testing"/>
>  >       </wsdl:port>
>  >    </wsdl:service>
>  > </wsdl:definitions>
>  >
>  >
>  > WSDL FOR THE DOCUMENT STYLE
>  > <?xml version="1.0" encoding="UTF-8"?>
>  > <wsdl:definitions
>  > targetNamespace="http://localhost:8080/axis/services/Testing"
>  > xmlns:apachesoap="http://xml.apache.org/xml-soap"
>  > xmlns:impl="http://localhost:8080/axis/services/Testing"
>  > xmlns:intf="http://localhost:8080/axis/services/Testing"
>  > xmlns:tns1="http://Testing"
>  > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>  > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>  > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  > <wsdl:types>
>  >   <schema elementFormDefault="qualified"
>  > targetNamespace="http://Testing" 
> xmlns="http://www.w3.org/2001/XMLSchema">
>  >    <element name="in0" type="xsd:string"/>
>  >   </schema>
>  >   <schema elementFormDefault="qualified"
>  > targetNamespace="http://localhost:8080/axis/services/Testing"
>  > xmlns="http://www.w3.org/2001/XMLSchema">
>  >    <element name="processReturn" type="xsd:string"/>
>  >   </schema>
>  >  </wsdl:types>
>  >    <wsdl:message name="processRequest">
>  >       <wsdl:part element="tns1:in0" name="in0"/>
>  >    </wsdl:message>
>  >    <wsdl:message name="processResponse">
>  >       <wsdl:part element="impl:processReturn" name="processReturn"/>
>  >    </wsdl:message>
>  >    <wsdl:portType name="TryIndex">
>  >       <wsdl:operation name="process" parameterOrder="in0">
>  >          <wsdl:input message="impl:processRequest" 
> name="processRequest"/>
>  >          <wsdl:output message="impl:processResponse"
>  > name="processResponse"/>
>  >       </wsdl:operation>
>  >    </wsdl:portType>
>  >    <wsdl:binding name="TestingSoapBinding" type="impl:TryIndex">
>  >       <wsdlsoap:binding style="document"
>  > transport="http://schemas.xmlsoap.org/soap/http"/>
>  >       <wsdl:operation name="process">
>  >          <wsdlsoap:operation soapAction=""/>
>  >          <wsdl:input name="processRequest">
>  >             <wsdlsoap:body use="literal"/>
>  >          </wsdl:input>
>  >          <wsdl:output name="processResponse">
>  >             <wsdlsoap:body use="literal"/>
>  >          </wsdl:output>
>  >       </wsdl:operation>
>  >    </wsdl:binding>
>  >    <wsdl:service name="TryIndexService">
>  >       <wsdl:port binding="impl:TestingSoapBinding" name="Testing">
>  >          <wsdlsoap:address
>  > location="http://localhost:8080/axis/services/Testing"/>
>  >       </wsdl:port>
>  >    </wsdl:service>
>  > </wsdl:definitions>
>  >
>  > Thanks.
>  >
>  > Madeleine
>  >
>  >


Re: document style problem

Posted by to...@gsk.com.
Madeleine,

The wrapped style only refers to the parameters to the service, not the 
response. Consequently, your two WSDLs produce the same input to the same 
service. However, the output from the service is presumably sending back 
the following XML fragment:

<processResponse>
    <processReturn>the result string</processReturn>
</processResponse>

The first WSDL maps this exactly but the second WSDL is not expecting any 
child elements, hence the error. Try it with the response defined in the 
same way as for the first WSDL.

Tony

"Madeleine Wright" <m....@ru.ac.za> wrote on 03/12/2004 19:13:33:

> I'm currently using axis-1_2RC1 and have encountered a behaviour I can't 

> explain.  I have been experimenting with the different types of 
> programming styles available in Axis.  I have no problem with the RPC 
> default or the wrapped/literal styles but when I use exactly the same 
> wsdd file but substitute "document" for "wrapped", I get the following 
> error on calling the service: "SimpleDeserializer encountered a child 
> element, which is NOT expected, in something it was trying to 
> deserialize".  The service is exactly the same with the other 2 styles 
> so why does "Document" cause this problem?  Even when I create a fault 
> situation, I have no problem with the other styles.
> 
> I generated the WSDLs for the 2 styles (see below): the main difference, 

> as explained in the User Guide, is the treatment of the operation 
> element.  Neither the default RPC style nor the document style uses the 
> <complexType> element so this doesn't look to be the problem.  The 
> service accepts a string as input and returns a string as output.
> 
> Please does anyone have an answer?
> 
> WSDL for wrapped service:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions 
> targetNamespace="http://localhost:8080/axis/services/Testing"
>     xmlns:apachesoap="http://xml.apache.org/xml-soap"
>     xmlns:impl="http://localhost:8080/axis/services/Testing"
>     xmlns:intf="http://localhost:8080/axis/services/Testing"
>     xmlns:tns1="http://Testing"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>     xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <wsdl:types>
> <schema elementFormDefault="qualified" targetNamespace=http://Testing 
> xmlns="http://www.w3.org/2001/XMLSchema">
>    <element name="process">
>     <complexType>
>      <sequence>
>       <element name="in0" type="xsd:string"/>
>      </sequence>
>     </complexType>
>    </element>
>    <element name="processResponse">
>     <complexType>
>      <sequence>
>       <element name="processReturn" type="xsd:string"/>
>      </sequence>
>     </complexType>
>    </element>
> 
>   </schema>
>  </wsdl:types>
> 
>    <wsdl:message name="processRequest">
>       <wsdl:part element="tns1:process" name="parameters"/>
>    </wsdl:message>
>    <wsdl:message name="processResponse">
>       <wsdl:part element="tns1:processResponse" name="parameters"/>
>    </wsdl:message>
>    <wsdl:portType name="TryIndex">
>       <wsdl:operation name="process">
>          <wsdl:input message="impl:processRequest" 
name="processRequest"/>
>          <wsdl:output message="impl:processResponse" 
> name="processResponse"/>
>       </wsdl:operation>
>    </wsdl:portType>
>    <wsdl:binding name="TestingSoapBinding" type="impl:TryIndex">
>       <wsdlsoap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"/>
>       <wsdl:operation name="process">
>          <wsdlsoap:operation soapAction=""/>
>          <wsdl:input name="processRequest">
>             <wsdlsoap:body use="literal"/>
>          </wsdl:input>
>          <wsdl:output name="processResponse">
>             <wsdlsoap:body use="literal"/>
>          </wsdl:output>
>       </wsdl:operation>
>    </wsdl:binding>
>    <wsdl:service name="TryIndexService">
>       <wsdl:port binding="impl:TestingSoapBinding" name="Testing">
>          <wsdlsoap:address 
> location="http://localhost:8080/axis/services/Testing"/>
>       </wsdl:port>
>    </wsdl:service>
> </wsdl:definitions>
> 
> 
> WSDL FOR THE DOCUMENT STYLE
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions 
> targetNamespace="http://localhost:8080/axis/services/Testing" 
> xmlns:apachesoap="http://xml.apache.org/xml-soap" 
> xmlns:impl="http://localhost:8080/axis/services/Testing" 
> xmlns:intf="http://localhost:8080/axis/services/Testing" 
> xmlns:tns1="http://Testing" 
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <wsdl:types>
>   <schema elementFormDefault="qualified" 
> targetNamespace="http://Testing" 
xmlns="http://www.w3.org/2001/XMLSchema">
>    <element name="in0" type="xsd:string"/>
>   </schema>
>   <schema elementFormDefault="qualified" 
> targetNamespace="http://localhost:8080/axis/services/Testing" 
> xmlns="http://www.w3.org/2001/XMLSchema">
>    <element name="processReturn" type="xsd:string"/>
>   </schema>
>  </wsdl:types>
>    <wsdl:message name="processRequest">
>       <wsdl:part element="tns1:in0" name="in0"/>
>    </wsdl:message>
>    <wsdl:message name="processResponse">
>       <wsdl:part element="impl:processReturn" name="processReturn"/>
>    </wsdl:message>
>    <wsdl:portType name="TryIndex">
>       <wsdl:operation name="process" parameterOrder="in0">
>          <wsdl:input message="impl:processRequest" 
name="processRequest"/>
>          <wsdl:output message="impl:processResponse" 
> name="processResponse"/>
>       </wsdl:operation>
>    </wsdl:portType>
>    <wsdl:binding name="TestingSoapBinding" type="impl:TryIndex">
>       <wsdlsoap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"/>
>       <wsdl:operation name="process">
>          <wsdlsoap:operation soapAction=""/>
>          <wsdl:input name="processRequest">
>             <wsdlsoap:body use="literal"/>
>          </wsdl:input>
>          <wsdl:output name="processResponse">
>             <wsdlsoap:body use="literal"/>
>          </wsdl:output>
>       </wsdl:operation>
>    </wsdl:binding>
>    <wsdl:service name="TryIndexService">
>       <wsdl:port binding="impl:TestingSoapBinding" name="Testing">
>          <wsdlsoap:address 
> location="http://localhost:8080/axis/services/Testing"/>
>       </wsdl:port>
>    </wsdl:service>
> </wsdl:definitions>
> 
> Thanks.
> 
> Madeleine
> 
>