Hi,

I have just come across some interesting behaviour regarding the use of the
setOperationName() method.  It turns out that if you do not specify any
Parameters  in your call (which would normally fill the SOAP Body of the
request) then the name of the operation (as set by the setOperationName
method) is used as the SOAP Body content.

For example, I have a getValue() operation on my Web service which I wish to
invoke using a doc/literal style call.  I do not add any parameters to the
call because the operation does not have any input parameters.  In order to
have a <getValue/> element in the body of my SOAP message I am therefore
forced to use call.setOperationName("getValue") in my client program.  This
only ever seems to be used when no parameters are added to the call.

This is all very counter intuitive but I think it is symptomatic of the way
that Axis has been written to map a doc/lit service invocation onto an
RPC-based call mechanism.  It would be easier to either allow Parameters to
be added to a call with no value or type associated or to have a different
call class for doc/lit invocations.

Just my opinion...

Regards
Jim

> -----Original Message-----
> From: Thomas Bayer [mailto:[EMAIL PROTECTED]
> Sent: 26 August 2003 18:07
> To: [EMAIL PROTECTED]
> Subject: AW: Why specify a operationname for a doc/lit client
>
>
> Hi,
>
> > Axis uses the operation name to reference the WSDL description
> > and find the
> > input, output, and fault message definition.
>
> I thought once the client is generated, axis doesn't use WSDL for the
> invokation. This client is yet a static DII client. There must be an other
> reason. Perhaps JAX-RPC impose this behaviour, but I didn't find
> any clue in
> the spec. And the class Call has lots of additions to the spec anyway.
>
> The client generates an RPCElement with PRCParam childs. The operationname
> and namespace are used for the RPCElement. If its not an RPC or WRAPPED
> style only the contents of the RPCElement is serialized. The
> content of the
> RPCElement is a RPCParam element with a reference to the bean used as
> parameter.
>
> The Axis client uses a structure like this:
>
> RPCElement ( name = "doesnt-matter" )
>   RPCParam ( name = "dvd" )
>      MyBean
>          title
>          year
>          ...
>
> and generates using doc/lit the following body:
>
> <soapenv:Body>
>   <dvd xsi:type="ns1:dvd" xmlns="http://style.demo.de";
> xmlns:ns1="http://style.demo.de";>
>    <price>19.95</price>
>    <title>Magnolia</title>
>    <year>2000</year>
>   </dvd>
>  </soapenv:Body>
>
> So the operationname is ignored, but I have to specify it to avoid an
> exception. Knows anybody a reason why the opername has to
> spezified or a way
> to call a doc/lit service without operationname?
>
> Thomas
>
>
> > >I'am wondering why I have to specify an operation name in a no-wrapped
> > >document/literal client. If a operationname is specified it
> > isn't used. If
> > >no operation name is specified, the exception below is thrown?
> > >
> > >
> > >Thomas
> > >
> > >
> > >Client:
> > >
> > >call.setOperationStyle( Style.DOCUMENT);
> > >call.setOperationUse( Use.LITERAL);
> > >
> > >call.setOperationName("doesnt-matter");
> > >
> > >call.registerTypeMapping( DVD.class, new QName( ns, "dvd"),
> > >BeanSerializerFactory.class, BeanDeserializerFactory.class);
> > >call.addParameter( new QName( ns, "dvd"), Constants.XSD_ANY, DVD.class,
> > >ParameterMode.IN);
> > >
> > >call.setReturnType( new QName( xs_ns, "string"));
> > >
> > >
> > >
> > >Exception:
> > >
> > >No operation name specified!
> > >         at org.apache.axis.client.Call.invoke(Call.java:1689)
> > >         at
> > >de.javamagazin.style.DVDClientDocumentLiteral.main(DVDClientDocum
> > entLiteral.
> > >java:44)
> > >
> > >
> > >
> > >
> > >
> > >
> > >Orientation in Objects GmbH
> > >http://www.oio.de
> >
> >
>


Reply via email to