One of the reasons why you want to use "wrapped" style rather than
"document" style (especially if you are generating the WSDL from code)
is that if you choose "wrapped", Axis will automatically create a
unique wrapper element for each method. But, if you choose "document"
style, then Axis does not create a unique wrapper element -- it
generates the input element from your input parameter. If you have two
methods that take the same object as input, Axis will not generate
unique input elements, and Axis will not be able to distinguish your
methods at run time.

As a best practice, and for best interoperability, you should always
use the wrapped convention unless you have a really compelling reason
not to.

(And just in case you haven'y seen the many previous posts on the
topic, "wrapped" style *is* document/literal. "Wrapped" is a
programming convention that allows a SOAP engine to automatically
marshal the request and response for you. "Wrapped" generates pure
document/literal on the wire.)

Anne

On Fri, 4 Mar 2005 09:54:17 -0800, Dino Chiesa <[EMAIL PROTECTED]> wrote:
> There is a request-element wrapper  in the SOAP Body.
> If you have multiple methods, they will each get a unique request
> element.
> 
> For example, In one of my test webservices, the SOAP Body looks like:
> <soap:Body>
>   <GetArrayOfString xmlns="urn:ionic.basics.nowrapper.2005.03">
>     <caller>192.168.1.38</caller>
>   </GetArrayOfString>
> </soap:Body>
> 
> The <GetArrayOfString> must be unique for the webservice endpoint.
> 
> 
> -----Original Message-----
> From: Ketan Deshpande [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 04, 2005 12:21 PM
> To: [email protected]
> Subject: Re: Newbie question for Doc/literal web service using Axis
> 
> Hi!
> 
> Thanks for both your responses. They were both very helpful.
> 
> I will retry with a single object as a param.
> 
> Though, another question arose in my mind from these: Since the client
> is not sending method info (in a doc-literal scenario), my interface
> could only have one method in it. I could not have two methods, since
> axis wouldn't know which method to call. (Is that just so glaringly
> obvious I should have seen it?) I will try this as well...
> 
> Thanks again very much!
> 
> -K
> 
> --- Anne Thomas Manes <[EMAIL PROTECTED]> wrote:
> > <flameOn>
> > The documentation in the user guide is terrible. You should always
> > start with WSDL -- not from Java.
> > </flameOn>
> >
> > Here are some basic rules:
> >
> > If you want to generate a web service from your Java interface, then
> > you should always use wrapped/literal. Wrapped/literal supports
> > multiple parameters, whereas document/literal does not.
> >
> > If you want to generate document/literal from your Java interface,
> > then you need to design your interface such that it accepts a single
> > object as input and returns a single object.
> >
> > Better yet, write your WSDL first, and generate your Java code from
> it.
> >
> > Anne
> >
> >
> > On Fri, 04 Mar 2005 13:17:30 +0900, Bill Keese
> > <[EMAIL PROTECTED]> wrote:
> > > Do you really want document/literal rather than wrapped/literal?
> > > Most people send messages like
> > >
> > > <concatentate>
> > >   <in0>hello</in0>
> > >   <in0>world</in0>
> > > </concatenate>
> > >
> > > ...which is wrapped literal (since the top tag is the name of the
> > function).
> > >
> > > Ketan Deshpande wrote:
> > >
> > > >Hi all!
> > > >
> > > >I am a newbie at this, so please be gentle...
> > > >
> > > >I am trying to write a web service that is document-literal. I am
> > > >following the example give in the Axis guide:
> > > >(I am using axis-1_2RC2)
> > > >
> > > >1. Create an interface & Compile it to .class public interface
> > > >MyWebService {
> > > >  public String concatenate(String str1, String str2); } 2.
> > > >Generate WSDL from it:
> > > >java -classpath %MY_CLASSPATH% org.apache.axis.wsdl.Java2WSDL -o
> > > >myws.doc.wsdl -u LITERAL --style DOCUMENT -l%MY_LOCATION% -n
> > > >"urn:MyWebServiceNS"
> > > >MyWebService
> > > >
> > > >3. Now generate server code from it:
> > > >java -classpath %MY_CLASSPATH% org.apache.axis.wsdl.WSDL2Java -W -s
> 
> > > >-S true -o server.doc.generated myws.doc.wsdl
> > > >
> > > >When I run this, I get a NullPointerException on the Server side,
> > > >in Axis code.
> > > >
> > > >
> > > >SOAPMonitor shows the client sending this message in the envelope:
> > > ><soapEnv:Body>
> > > >       <in0 xmlns="urn:MyWebServiceNS">A</in0>
> > > >       <in1 xmlns="urn:MyWebServiceNS">B</in1>
> > > ></soapEnv:Body>
> > > >
> > > >When I looked into the server code, I saw that the server skeleton
> > > >was more like RPC or Wrapped:
> > > >    public java.lang.String concatenate(java.lang.String in0,
> > > >java.lang.String
> > > >in1) throws java.rmi.RemoteException
> > > >    {
> > > >        java.lang.String ret = impl.concatenate(in0, in1);
> > > >        return ret;
> > > >    }
> > > >
> > > >
> > > >What am I doing wrong? Any pointers you can provide will be most
> > > >gratefully appreciated.
> > > >
> > > >Thanks much!
> > > >
> > > >-Ketan
> > > >
> > > >=====
> > > >Ketan Deshpande
> > > >[EMAIL PROTECTED]
> > > >
> > > >__________________________________________________
> > > >Do You Yahoo!?
> > > >Tired of spam?  Yahoo! Mail has the best spam protection around
> > > >http://mail.yahoo.com
> > > >
> > > >
> > > >
> > > >
> > >
> >
> 
> Ketan Deshpande
> [EMAIL PROTECTED]
> 
> __________________________________
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web
> http://birthday.yahoo.com/netrospective/
>

Reply via email to