When using unwrapped document style, your method must accept an object (not individual parameters) as input. Therefore a method signature like

   String /*data*/ workWithInstance(String id, String param);

isn't valid with unwrapped document style.

Also, when using unwrapped document style, you need to use a different input object for each method. A SOAP message signature is defined by the QName of the child element of the SOAP Body -- which, in the case of unwrapped document style, is the input parameter. If you have two methods that take the same input parameter, Axis has no way to distinguish the two method signatures. Also, you must tell Axis how to map the input element to the appropriate method, which you do using the <operation> definition in the WSDD. Think about it -- Axis receives a request containing <id>. How is it supposed to figure out that you actually want to invoke disposeInstance?

It's generally a really bad idea to try to generate unwrapped document style using java2wsdl. It's much better to use wrapped document style. If you want to use unwrapped document style, then you should start with WSDL rather than with Java.

See http://atmanes.blogspot.com/2005/03/wrapped-documentliteral-convention.html for a description of the wrapped convention.

Anne

On 10/7/05, Merten Schumann <[EMAIL PROTECTED]> wrote:
Thank you, Anne! I think I tried to make a web service doc/lit which is not meant to be doc/lit. My AxisClient ist not really working, the next method I called, I ran into the next problem.
 
What I have is this (I'm starting with the service interface and generate with Axis java2wsdl the WSDL, I have to use this approach for some reason):
   String /*id*/ getInstance();
   boolean /*success*/ disposeInstance(String id);
   String /*data*/ workWithInstance(String id, String param);
   ... some more methods taking "String id" and all ...
 
Now, with rpc/enc rpc/lit and wrapped/lit my clients work fine.
 
With doc/lit I could successfully call getInstance(). But when I call then workWithInstance(), things go wrong. My Tomcat/Axis server "responds" with a NPE and WebSphere complains about method disposeInstance() not matching (!). It seems, the mechanism to find the correct method for the SOAP request goes wrong for some reason.
 
So, I think my idea just to provide all the possible flavors of style/use against the same service interface was wrong. I did not catch the idea of document-style web services. I think I tried to make a typical rpc-style problem (exposing my underlying API) to be a doc-style web service and ran into problems.
   Merten


From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 06, 2005 2:47 PM
To: axis-user@ws.apache.org
Subject: Re: problems against doc/lit service with AxisClient or Axis JAX-RPC client

When using document style, if your input object does not have the same local name as the operation, then you need to specify an <operation> definition in the WSDD that tells Axis how to map the incoming QName to the appropriate method. See http://www.osmoticweb.com/axis-wsdd/operation.htm .

When using wrapped style, the wrapper element for your input message has the same name as the operation, so from a programming perspective, it looks and feels like RPC style -- but it is in fact document style.

Anne

On 10/6/05, Merten Schumann <[EMAIL PROTECTED]> wrote:
Got my AxisClient working against doc/lit! The problem was, besides from
call.setOperationStyle("document") I have to use a QName with the
namespace set correctly instead of just a String for my method
parameters in call.addParameter() ... Uff.

I'm still not able to get my JAX-RPC (Dynamic Invocation Interface)
client running. It's not working with both Sun JAX-RPC and Axis JAX-RPC.
There's no possibility there to set a QName in addParameter, as far as I
can see ...

Bhuvan Gupta sent me a helpful link,
http://www-128.ibm.com/developerworks/webservices/library/ws-whichwsdl/ .
The document leads me to the impression, that for a web service to be
"document style ready" the method parameter names should be named in a
way to allow the web service server side to find out (by given parameter
names only) which method to be called (since in the SOAP envelope no
operation name is included). Is this correct?

Ummm, it's not really easy with this style/use combinations :-)
   Merten


> -----Original Message-----
> From: Merten Schumann [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 06, 2005 11:08 AM
> To: axis-user@ws.apache.org
> Subject: RE: problems against doc/lit service with AxisClient
> or Axis JAX-RPC client
>
> Ummm, I think I need to learn my lessons.
> As I mentioned, clients are working against wrapped/literal.
> Well, I thought wrapped/literal is a kind of document-style?!?
> But when I do use
>    call.setOperationStyle("document")
> it's not working (I get the message "No such operation 'txt'" back).
> It's working, when I do
>    call.setOperationStyle("rpc")
> or nothing (so "rpc" seems to be the default).
>
> Ummm, so is wrapped/literal at the end "rpc" style?
>    Merten
>
> > -----Original Message-----
> > From: Merten Schumann [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, October 06, 2005 10:45 AM
> > To: axis-user@ws.apache.org
> > Subject: problems against doc/lit service with AxisClient or
> > Axis JAX-RPC client
> >
> > Hello,
> >
> > I'm trying to invoke a simple web service method String
> > bounceMessage(String txt). I'm testing all style/use combinations,
> > rpc/enc rpc/lit doc/lit wrap/lit. My clients are JAX-RPC clients
> > (Dynamic Invocation Interface and Dynamic Proxy) and
> > AxisClient. The web
> > service is sitting in either a J2EE container (WebSphere) or in
> > Tomcat+Axis (1.2.1).
> >
> > Well, for all style/use combinations things seem to work
> fine, "even"
> > wrapped/lit works. But it's not working with doc/lit. Here is what
> > happens, when my web service is hosted by Tomcat/Axis:
> >
> > When I use call.setOperationStyle("document") in my AxisClient or
> > call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document") in my
> > JAX-RPC DII code, I end up with a message
> >    "No such operation 'txt'"
> > So it seems the server is trying to take "txt" (the
> parameter) for the
> > operation.
> >
> > When I do not try to set the style to "document", I end up with a
> > message
> >    "SimpleDeserializer encountered a child element, which is NOT
> > expected, in something it was trying to deserialize."
> > I searched for this error message the net, found some
> information that
> > things should be fine with Axis 1.2.1, well, that's what I
> > use but it's
> > not working, anyway. :-)
> >
> > BTW: things are not working with doc/lit web service if I
> > test the with
> > Sun JAX-RPC RI from J2EE 1.4 package too
> >
> > So, is doc/lit in Axis (1.2.1) well supported? I could try to
> > switch to
> > 1.3, would make sense if doc/lit support has been enhanced there ...
> >    Merten
> >
>


Reply via email to