axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Ayzma" <robay...@gmail.com>
Subject Re: Targetnamespace confusion with autogenerated WSDL!?
Date Sun, 17 Dec 2006 22:28:36 GMT
Well it certainly cleared the fog a little, no doubt I misunderstood what I
read, so thanks.

Now the client soap envelope, in my little test, is created with the Ksoap2
libraries and it seems the attributes(id and root) are ignored by Axis2.

Some things connected to my former question that I need cleared up is then
this:

As it is atm, then to get an autogenerated WSDL file from Axis it looks like
you need  to make a services.xml file that looks a little something like
this:
<service name="SimpleService" scope="application">
<description>
Simple Echo service
</description>
<operation name="echo">
<messageReceiver  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"
/>
<actionMapping>urn:echo</actionMapping>
</operation>
<parameter name="ServiceClass" locked="false">SimpleService</parameter>
</service>

Of course I could create a WSDL file from a POJO by using the java2wsdl tool
or even have Eclipse do it for me, then I might be able to understand what
goes on a little better with those messageReceivers.
But I think that it is essential to understand them if I want to do it
RPC/encoded or... ? I did try to look at the Axis documentation but I
haven't gotten wiser.

-Robert


On 12/17/06, Anne Thomas Manes <atmanes@gmail.com> wrote:
>
> Whatever sources you are referencing are in error.
>
> The WSDL defines what the document in the message on the wire looks
> like, but that doesn't mean that elements in the document on the wire
> must be in the WSDL targetNamespace.
>
> The WSDL defines a set of elements (e.g., messages, portTypes,
> operations, bindings, services, and ports). All of these defined
> elements are in the WSDL targetNamespace. A <wsdl:message> definition
> defines the contents of a message on the wire. In your case:
>
>              <wsdl:message name="echoMessage">
>                  <wsdl:part name="part1" element="ns0:echo"/>
>              </wsdl:message>
>
> indicates that the <soap:Body> should contain an element called
> "ns0:echo", as defined in the schema in the <wsdl:types> section, for
> example:
>
>               <ns0:echo xmlns:ns0="http://ws.apache.org/axis2/xsd">
>                  <ns0:param0>some string</ns0:param0>
>               </ns0:echo>
>
> NOTE: This is a document/literal interface, which means that the
> message on the wire should conform to the schema that defines the
> message contents. The schema for ns0:echo does not define any
> attributes, therefore the message that you've created, which contains
> "id="o0" c:root="1"", is not valid. These attributes should only be
> used when using RPC/encoded.
>
> If you were using an RPC style service, then there is no explicit
> definition of the message schema, but you can infer the schema
> definition from the message, operation, and binding definitions. It
> works like this:
>
> The local name of the child element of the <soap:Body> is the taken
> from the operation name in the <wsdl:portType> definition. The
> qualifying namespace for the operation name comes from the namespace
> attribute in the <soap:body> definition in the <wsdl:binding>. The
> child elements of the operation element must be unqualified, and they
> take their local names from the names of the <wsdl:part> elements in
> the <wsdl:message>.
>
> Hope this helps.
>
> Anne
>
> On 12/17/06, Robert Ayzma <robayzma@gmail.com> wrote:
> > I have made a very simple web service on an Axis2 Tomcat driven server.
> > Axis generates the wsdl fine heres a snippet.
> >
> >
> > <wsdl:definitions targetNamespace="http://ws.apache.org/axis2 ">
> > <wsdl:documentation>SimpleService</wsdl:documentation>
> > −
> >        <wsdl:types>
> > −
> >        <xs:schema attributeFormDefault="qualified"
> > elementFormDefault="qualified"
> > targetNamespace="http://ws.apache.org/axis2/xsd">
> > −
> >        <xs:element name="echo">
> > −
> >        <xs:complexType>
> > −
> >        <xs:sequence>
> > <xs:element name="param0" nillable="true" type="xs:string"/>
> > </xs:sequence>
> > </xs:complexType>
> > </xs:element>
> > −
> >        <xs:element name="echoResponse">
> > −
> >        <xs:complexType>
> > −
> >        <xs:sequence>
> > <xs:element name="return" nillable="true" type="xs:string"/>
> > </xs:sequence>
> > </xs:complexType>
> > </xs:element>
> > </xs:schema>
> > </wsdl:types>
> > −
> >        <wsdl:message name="echoMessage">
> > <wsdl:part name="part1" element="ns0:echo"/>
> > </wsdl:message>
> > −
> >        <wsdl:message name="echoResponse">
> > <wsdl:part name="part1" element="ns0:echoResponse"/>
> > </wsdl:message>
> > −
> >        <wsdl:portType name="SimpleServicePortType">
> > −
> >        <wsdl:operation name="echo">
> > <wsdl:input message="axis2:echoMessage" wsaw:Action="urn:echo"/>
> > <wsdl:output message="axis2:echoResponse"/>
> >  </wsdl:operation>
> > </wsdl:portType>
> > −
> >        <wsdl:binding name="SimpleServiceSOAP11Binding"
> > type="axis2:SimpleServicePortType">
> > <soap:binding transport="
> > http://schemas.xmlsoap.org/soap/http"
> > style="document"/>
> > −
> >        <wsdl:operation name="echo">
> > ......snippet ends
> >
> > I have also made a client that can communicate with the echo service
> > but ONLY if I use the targetnamespace of the schema and not the one for
> > wsdl definitions, and I have absolutely no idea why.
> >
> > The request for the client request looks like this:
> > <v:Envelope xmlns:i="
> > http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:d="http://www.w3.org/2001/XMLSchema"
> > xmlns:c=" http://schemas.xmlsoap.org/soap/encoding/"
> > xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"><v:Header
> > /><v:Body><n0:echo id="o0" c:root="1"
> > xmlns:n0="http://ws.apache.org/axis2/xsd"><param0
> > i:type="d:string">Test af Soap
> > Webservice</param0></n0:echo></v:Body></v:Envelope>
> >
> > The response looks like this:
> > <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> > xmlns:soapenv="
> >  http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header
> > /><soapenv:Body><ns:echoResponse
> > xmlns:ns="http://ws.apache.org/axis2/xsd"><ns:return>echo
> > value is: Test af Soap
> >
> Webservice</ns:return></ns:echoResponse></soapenv:Body></soapenv:Envelope>
> >
> > And all is fine, but if I change the namespace to: "xmlns:ns="
> >  http://ws.apache.org/axis2" instead, then I get a faultcode with
> unknown
> > method echo.
> >
> > According to all sorts of books and ressources on the net, the WSDL
> > definitions namespace address ALL the elements in the document, so why
> > is it that if I change the namespace to the defintions namespace then
> > my client gets a faultcode saying that the echo method is not known? I
> > am missing out on something here I know so please point me in the right
> > direction.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Mime
View raw message