You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by zh...@iapcm.ac.cn on 2005/07/04 13:22:12 UTC

Question about doc\literal?

Hi All,
I write a simple Java file:
package sample;
public class Hello{
public String echo(String str,int a){
return str+"------"+a;
}
}
Then I obtain a wsdl file through Java2WSDL tool which specifies the style is DOCUMENT and the use is Literal.After get the wsdl file,generate associated java files through WSDL2Java.When invoke the service,it throws NullPointerException both the client and server.

But if I specifies the style of the service is WRAPPED and the use is LITERAL,it's OK!

Please let me know if anyone has encountered such
problem before and any pointers would be very useful.

Thanks in Advance,

Best Regards,

Robert Zhang
Email:zhangyu@iapcm.ac.cn
Tel:86-010-62014411-2437


Re: Question about doc\literal?

Posted by Anne Thomas Manes <at...@gmail.com>.
WRAPPED *is* document/literal. WRAPPED just uses a convention that
wraps the input document in an element that has the same name as your
operation. By doing so, it makes it much easier for Axis to figure out
how to dispatch the request. Wrapped also allows you to send multiple
parameters in your request. (SOAP allows only one input element per
operation.)

If you want to use unwrapped doc/literal, then you must do the following:
- you must wrap your multiple input parameters into a single bean
- you must define a mapping of your input element qname to the desired
Java method using the <operation> element in the WSDD (see
http://www.osmoticweb.com/axis-wsdd/operation.htm)

But it's really much easier if you use the WRAPPED convention.

Anne

On 7/4/05, zhangyu@iapcm.ac.cn <zh...@iapcm.ac.cn> wrote:
> Hi All,
> I write a simple Java file:
> package sample;
> public class Hello{
> public String echo(String str,int a){
> return str+"------"+a;
> }
> }
> Then I obtain a wsdl file through Java2WSDL tool which specifies the style is DOCUMENT and the use is Literal.After get the wsdl file,generate associated java files through WSDL2Java.When invoke the service,it throws NullPointerException both the client and server.
> 
> But if I specifies the style of the service is WRAPPED and the use is LITERAL,it's OK!
> 
> Please let me know if anyone has encountered such
> problem before and any pointers would be very useful.
> 
> Thanks in Advance,
> 
> Best Regards,
> 
> Robert Zhang
> Email:zhangyu@iapcm.ac.cn
> Tel:86-010-62014411-2437
> 
>