According to the SOAP spec, Section 4.3:
   1. A body entry is identified by its fully qualified
       element name, which consists of the namespace
       URI and the local name.

Regardless of whether or not you are using doc/literal or rpc/encoded, the
QName of the env:body entry should be unique, and therefore Axis should be
able to determine what to do based on this QName -- even if it isn't a
method name.

In RPC and WRAPPED styles, this QName is the operation name. In DOCUMENT and
MESSSAGE styles, this QName is the name of the element specified in the
input message <part> definition.

Your WSDL messages don't distinguish between the two operations (both send a
message with a QName of {urn:avaya.test.Doit}in0.) I recommend that you
redesign your WSDL so that your input element names are distinct (e.g.,
"add" and "subtract" rather than "in0").

Note that you shouldn't specify a namespace attribute on the <wsdlsoap:body>
definitions when using doc/literal. Axis will, by default, use the
targetNamespace defined in the <schema> definition (which is where you
define your input element). The <wsdlsoap:body> namespace attribute
overrides the default.

I'm also assuming that getString returns a normal string, so I've changed
the type to "xsd:string".

Here are my suggested changes:

------------------WSDL-------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:avaya.test.Doit"
xmlns:impl="urn:avaya.test.Doit" xmlns:intf="urn:avaya.test.Doit"
xmlns:apachesoap="http://xml.apache.org/xml-soap";
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns="http://schemas.xmlsoap.org/wsdl/";>
 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema";
targetNamespace="urn:avaya.test.Doit">
   <element name="add" type="xsd:int"/>
   <element name="addReturn" type="xsd:int"/>
   <element name="getStringReturn" type="xsd:string"/>
   <element name="subtract" type="xsd:int"/>
   <element name="subtractReturn" type="xsd:int"/>
  </schema>
 </wsdl:types>
   <wsdl:message name="subtractResponse">
      <wsdl:part name="subtractReturn" element="impl:subtractReturn"/>
   </wsdl:message>
   <wsdl:message name="addRequest">
      <wsdl:part name="add" element="impl:add"/>
   </wsdl:message>
   <wsdl:message name="subtractRequest">
      <wsdl:part name="subtract" element="impl:subtract"/>
   </wsdl:message>
   <wsdl:message name="getStringRequest">
   </wsdl:message>
   <wsdl:message name="getStringResponse">
      <wsdl:part name="getStringReturn" element="impl:getStringReturn"/>
   </wsdl:message>
   <wsdl:message name="addResponse">
      <wsdl:part name="addReturn" element="impl:addReturn"/>
   </wsdl:message>
   <wsdl:portType name="Doit">
      <wsdl:operation name="add">
         <wsdl:input name="addRequest" message="impl:addRequest"/>
         <wsdl:output name="addResponse" message="impl:addResponse"/>
      </wsdl:operation>
      <wsdl:operation name="getString">
         <wsdl:input name="getStringRequest"
message="impl:getStringRequest"/>
         <wsdl:output name="getStringResponse"
message="impl:getStringResponse"/>
      </wsdl:operation>
      <wsdl:operation name="subtract">
         <wsdl:input name="subtractRequest" message="impl:subtractRequest"/>
         <wsdl:output name="subtractResponse"
message="impl:subtractResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="DoitSoapBinding" type="impl:Doit">
      <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="add">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="addRequest">
            <wsdlsoap:body use="literal" />
         </wsdl:input>
         <wsdl:output name="addResponse">
            <wsdlsoap:body use="literal" />
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="getString">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getStringRequest">
            <wsdlsoap:body use="literal" />
         </wsdl:input>
         <wsdl:output name="getStringResponse">
            <wsdlsoap:body use="literal" />
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="subtract">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="subtractRequest">
            <wsdlsoap:body use="literal" />
         </wsdl:input>
         <wsdl:output name="subtractResponse">
            <wsdlsoap:body use="literal" />
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="DoitService">
      <wsdl:port name="Doit" binding="impl:DoitSoapBinding">
         <wsdlsoap:address location="http://localhost:8080/Doit"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>


----- Original Message -----
From: "Sanjay Krishnamurthi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 07, 2003 6:30 PM
Subject: Re: Is this a bug?


>
>  The issue here is that DOC/Lit does not carry method
> name in the SOAP body whereas SOAP/RPC does. As a
> result AXIS doesn't know how to dispatch the method
> and my guess is that it will work correctly as long as
> you don't have two methods that take the same
> parameters. You could get AXIS to use SOAPAction for
> doing the dispatch but keep in mind that use of
> SOAPAction for dispatching is not a "standard". It is
> meant to be a "hint".
>
>   As mentioned by others in various threads, for
> DOC/Lit I would recommend WSDL as the starting point
> and design it so that reqest SOAP body contains an
> <addRequest> document. (You would have to define a
> corresponding complex type in your WSDL)
>
>    Sanjay
>
>
>
> --- Jeff Greif <[EMAIL PROTECTED]> wrote:
> > I think that when you use doc/lit operations, you
> > must provide a each with a
> > distinct SoapAction in the bindings, e.g.
> >
> wsdlsoap:soapAction="http://mycompany.com/mySubtract";
> > .
> >
> > This might not be necessary if the Wrapped style is
> > used, but better to be
> > safe.
> >
> > Jeff
> > ----- Original Message -----
> > From: "Yakulis, Ross (Ross)" <[EMAIL PROTECTED]>
> > To: "Axis User (E-mail)" <[EMAIL PROTECTED]>
> > Sent: Thursday, August 07, 2003 2:45 PM
> > Subject: Is this a bug?
> >
> >
> > Given below ( the interface, the client, the
> > generated WSDL and the SOAP
> > messages generated).  When I use the generated
> > stubs, methods with the same
> > signature ( int add( int ) and int subtract( int ) )
> > are not distinguished
> > on the server side.  What happens is that add gets
> > called when subtract
> > should.  This seems like a bug?
> > Things work fine if I use RPC Encoded though. I am
> > using Axis 1.1 release
> > build.
> >
> > Ross
> >
> >
> > ------------ Intergace ------------------------
> > public interface Doit {
> > public int add( int value );
> > public int subtract( int value );
> > public String getString();
> > }
> > ------------- Client
> > ----------------------------------------
> >    DoitServiceLocator locator = new
> > DoitServiceLocator();
> >    Doit doit = locator.getDoit(new
> > URL("http://localhost:6060/axis/services/Doit";));
> >    org.apache.axis.client.Stub stub = (Stub) doit;
> >    stub.setTimeout(45000);//in milliseconds
> >    stub.setMaintainSession(true);
> >    // Invoke Service
> >    int result = doit.add(5);
> >    result = doit.subtract(2);
> >    String str = doit.getString();
> > ------------ Java2WSDL
> > --------------------------------------------
> > java -org.apache.axis.wsdl.Java2WSDL
> > -oC:\eclipse\runtime-workspace\Doit/ws
> > dl/doit.wsdl -lhttp://localhost:8080/doit -T1.2
> > -yDocument -uLiteral -nurn:N
> > S.doit Doit
> > ------------ WSDL2Java
> > --------------------------------------------
> > java
> > org.apache.axis.wsdl.WSDL2Java  -T1.2 -O45 -dSession
> > -s -Sfalse -px.y -oC:\e
> > clipse\runtime-workspace\doit/.
> > C:/eclipse/runtime-workspace/Doit/wsdl/doit.wsdl
> >
> ------------------WSDL-------------------------------------------
> > <?xml version="1.0" encoding="UTF-8"?>
> > <wsdl:definitions
> > targetNamespace="urn:avaya.test.Doit"
> > xmlns:impl="urn:avaya.test.Doit"
> > xmlns:intf="urn:avaya.test.Doit"
> > xmlns:apachesoap="http://xml.apache.org/xml-soap";
> >
> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
> >
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> > xmlns="http://schemas.xmlsoap.org/wsdl/";>
> >  <wsdl:types>
> >   <schema xmlns="http://www.w3.org/2001/XMLSchema";
> > targetNamespace="urn:avaya.test.Doit">
> >    <element name="in0" type="xsd:int"/>
> >    <element name="addReturn" type="xsd:int"/>
> >    <element name="getStringReturn"
> > type="soapenc:string"/>
> >    <element name="in0" type="xsd:int"/>
> >    <element name="subtractReturn" type="xsd:int"/>
> >   </schema>
> >  </wsdl:types>
> >    <wsdl:message name="subtractResponse">
> >       <wsdl:part name="subtractReturn"
> > element="impl:subtractReturn"/>
> >    </wsdl:message>
> >    <wsdl:message name="addRequest">
> >       <wsdl:part name="in0" element="impl:in0"/>
> >    </wsdl:message>
> >    <wsdl:message name="subtractRequest">
> >       <wsdl:part name="in0" element="impl:in0"/>
> >    </wsdl:message>
> >    <wsdl:message name="getStringRequest">
> >    </wsdl:message>
> >    <wsdl:message name="getStringResponse">
> >       <wsdl:part name="getStringReturn"
> > element="impl:getStringReturn"/>
> >    </wsdl:message>
> >    <wsdl:message name="addResponse">
> >       <wsdl:part name="addReturn"
> > element="impl:addReturn"/>
> >    </wsdl:message>
> >    <wsdl:portType name="Doit">
> >       <wsdl:operation name="add"
> > parameterOrder="in0">
> >          <wsdl:input name="addRequest"
> > message="impl:addRequest"/>
> >          <wsdl:output name="addResponse"
> > message="impl:addResponse"/>
> >       </wsdl:operation>
> >       <wsdl:operation name="getString">
> >          <wsdl:input name="getStringRequest"
> > message="impl:getStringRequest"/>
> >          <wsdl:output name="getStringResponse"
> > message="impl:getStringResponse"/>
> >       </wsdl:operation>
> >       <wsdl:operation name="subtract"
> > parameterOrder="in0">
> >          <wsdl:input name="subtractRequest"
> > message="impl:subtractRequest"/>
> >          <wsdl:output name="subtractResponse"
> > message="impl:subtractResponse"/>
> >       </wsdl:operation>
> >    </wsdl:portType>
> >    <wsdl:binding name="DoitSoapBinding"
> > type="impl:Doit">
> >       <wsdlsoap:binding style="document"
> > transport="http://schemas.xmlsoap.org/soap/http"/>
> >       <wsdl:operation name="add">
> >          <wsdlsoap:operation soapAction=""/>
> >          <wsdl:input name="addRequest">
> >             <wsdlsoap:body use="literal"
> > namespace="urn:avaya.test.Doit"/>
> >          </wsdl:input>
> >          <wsdl:output name="addResponse">
> >             <wsdlsoap:body use="literal"
> > namespace="urn:avaya.test.Doit"/>
> >          </wsdl:output>
> >       </wsdl:operation>
> >       <wsdl:operation name="getString">
> >          <wsdlsoap:operation soapAction=""/>
> >          <wsdl:input name="getStringRequest">
> >             <wsdlsoap:body use="literal"
> > namespace="urn:avaya.test.Doit"/>
> >          </wsdl:input>
> >          <wsdl:output name="getStringResponse">
> >             <wsdlsoap:body use="literal"
> > namespace="urn:avaya.test.Doit"/>
> >          </wsdl:output>
> >       </wsdl:operation>
> >       <wsdl:operation name="subtract">
> >          <wsdlsoap:operation soapAction=""/>
> >          <wsdl:input name="subtractRequest">
> >             <wsdlsoap:body use="literal"
> > namespace="urn:avaya.test.Doit"/>
> >          </wsdl:input>
> >          <wsdl:output name="subtractResponse">
> >             <wsdlsoap:body use="literal"
> > namespace="urn:avaya.test.Doit"/>
> >          </wsdl:output>
> >       </wsdl:operation>
> >    </wsdl:binding>
> >    <wsdl:service name="DoitService">
> >       <wsdl:port name="Doit"
> > binding="impl:DoitSoapBinding">
> >          <wsdlsoap:address
> > location="http://localhost:8080/Doit"/>
> >       </wsdl:port>
> >    </wsdl:service>
> > </wsdl:definitions>
> > -------------------------------------------------
> > SOAP MESSAGES
> >
> > (add request )
> > POST /axis/services/Doit HTTP/1.0 Content-Type:
> > text/xml; charset=utf-8
> > Accept: application/soap+xml, application/dime,
> > multipart/related, text/*
> > User-Agent: Axis/1.1 Host: localhost Cache-Control:
> > no-cache Pragma:
> > no-cache SOAPAction: "" Content-Length: 329
> > <?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>
> >   <in0 xsi:type="xsd:int"
> > xmlns="urn:avaya.test.Doit">5</in0>
> >  </soapenv:Body>
> > </soapenv:Envelope>
> >
> > (subtract request)
> >
> === message truncated ===
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>

Reply via email to