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 Martin Wunderlich <ma...@gmx.net> on 2006/04/07 21:47:35 UTC

Re[4]: Problem using deployed Axis web services

Hi Gregg,

Thanks for the hint. I've managed to generate the test client now.
Everything works fine, except for validating the result I get. The
returned String is still null (which confirms the results of my other
method calls).

I went again through the process of setting up the web service and
generating the code. The only odd thing I noticed is with the
interface for the Java class from which I want to build the service.
The class would be something like myPackage.SayHello; The interface
generated by WSDL2Java has the exact same name, which makes it kinda
hard for the class and the interface to coexist. I don't know, if this
could be relevant.

Cheers,

Martin

> http://ws.apache.org/axis/java/reference.html

> -t builds testClient

>    good luck,



> -----Original Message-----
> From: axis-user-return-42843-GREGG.E.MCMULLIN=saic.com@ws.apache.org
> [mailto:axis-user-return-42843-GREGG.E.MCMULLIN=saic.com@ws.apache.org]
> On Behalf Of Martin Wunderlich
> Sent: Wednesday, April 05, 2006 3:57 PM
> To: Jinyuan Zhou
> Subject: Re[2]: Problem using deployed Axis web services

> Thanks a lot for the quick replies, Jinyuan.

> I checked WSDL2Java for the JUnit option you mentioned, but couldn't
> find it.
> As for the URL I call the web service with, it's a bit different from
> the one you provided. I tried the following:
> http://localhost/WSTest/services/SayHello2?method=hello&in0=Bla
> and
> http://localhost/WSTest/services/SayHello2?method=hello&in=Bla

> Neither of this works.

> I have also pasted the client code below. This only returns a null
> value.

> Cheers,

> Martin



Re[2]: Problem using deployed Axis web services

Posted by Martin Wunderlich <ma...@gmx.net>.
Thanks a lot, Dies, for your detailed explanation! I understand the
principles behind the workings of WSDL2Java much better now. This
whole thing has cost me the better part of an entire week. Then again,
it's my own fault for not having checked the actual method
implementation.
I'm off defining my interfaces now...

All the best,

Martin

> Hello Martin,

> WSDL2Java creates a template for the impl file for your convenience. All
> methods with a return value are generated with "return null;" or some 
> primitive value so that they compile. WSDL2Java will not copy the method
> body from your original class.

> Note that actually the idea when you start with a Java class is that you
> start with an interface (no method bodies), use Java2WSDL to generate a
> WSDL, then use WSDL2Java to generate the server-side interface and a 
> template in which you fill the method bodies.

> Although Java2WSDL allows you to specify a concrete class (not 
> interface) as input interface, it treats it as an interface (i.e. does
> not look at the methods' bodies, decompile them and copy the source into
> the generated impl file's method bodies).

> The WSDL defines the interface of your web service. Therefore, it is not
> strange to lose your method implementations in the Java->WSDL->Java 
> conversions.

> Regards,
> Dies



Re: Problem using deployed Axis web services

Posted by Dies Koper <di...@jp.fujitsu.com>.
Hello Martin,

WSDL2Java creates a template for the impl file for your convenience. All 
methods with a return value are generated with "return null;" or some 
primitive value so that they compile. WSDL2Java will not copy the method 
body from your original class.

Note that actually the idea when you start with a Java class is that you 
start with an interface (no method bodies), use Java2WSDL to generate a 
WSDL, then use WSDL2Java to generate the server-side interface and a 
template in which you fill the method bodies.

Although Java2WSDL allows you to specify a concrete class (not 
interface) as input interface, it treats it as an interface (i.e. does 
not look at the methods' bodies, decompile them and copy the source into 
the generated impl file's method bodies).

The WSDL defines the interface of your web service. Therefore, it is not 
strange to lose your method implementations in the Java->WSDL->Java 
conversions.

Regards,
Dies


Martin Wunderlich wrote:
> Dear all,
> 
> Further to my recent problems with creating a simple web service and
> getting only null values as return values (see below), I seem to have
> located the problem.
> 
> WSDL2Java, which creates the required server-side files, doesn't seem
> to implement the original method properly. In particular, the file
> <MyClass>SoapBindingImpl.java, where the actual method implementation
> is located, doesn't seem to be correct. For instance, I have the
> following simple class:
> 
> package mypackage;
> 
> public class SayHello {
>     public java.lang.String hello(java.lang.String input) {
>         return ("Hello, " + input");
>     }
> }
> 
> The class SayHelloSoapBindingImpl, which is created by WSDL2Java looks
> like this:
> 
> package mypackage;
> 
> public class SayHelloSoapBindingImpl implements mypackage.SayHello{
>     public java.lang.String hello(java.lang.String input) throws java.rmi.RemoteException {
>         return null;
>     }
> 
> }
> 
> Note the hard-coded null value that is returned instead of the
> original implementation of the method. If I change this incorrect
> implementation, everything works fine.
> 
> Am I missing something here? It seems like a lot of unnecessary extra
> work, if I have to recreate all the methods when I start building real web
> services. I'd rather avoid that.
> 
> Cheers,
> 
> Martin
> 
> 
>> Thanks for the hint. I've managed to generate the test client now.
>> Everything works fine, except for validating the result I get. The
>> returned String is still null (which confirms the results of my other
>> method calls).
> 
>> I went again through the process of setting up the web service and
>> generating the code. The only odd thing I noticed is with the
>> interface for the Java class from which I want to build the service.
>> The class would be something like myPackage.SayHello; The interface
>> generated by WSDL2Java has the exact same name, which makes it kinda
>> hard for the class and the interface to coexist. I don't know, if this
>> could be relevant.
> 
>> Cheers,
> 
>> Martin
> 
>>> http://ws.apache.org/axis/java/reference.html
> 
>>> -t builds testClient
> 
>>>    good luck,
> 
> 
> 
>>> -----Original Message-----
>>> From: axis-user-return-42843-GREGG.E.MCMULLIN=saic.com@ws.apache.org
>>> [mailto:axis-user-return-42843-GREGG.E.MCMULLIN=saic.com@ws.apache.org]
>>> On Behalf Of Martin Wunderlich
>>> Sent: Wednesday, April 05, 2006 3:57 PM
>>> To: Jinyuan Zhou
>>> Subject: Re[2]: Problem using deployed Axis web services
> 
>>> Thanks a lot for the quick replies, Jinyuan.
> 
>>> I checked WSDL2Java for the JUnit option you mentioned, but couldn't
>>> find it.
>>> As for the URL I call the web service with, it's a bit different from
>>> the one you provided. I tried the following:
>>> http://localhost/WSTest/services/SayHello2?method=hello&in0=Bla
>>> and
>>> http://localhost/WSTest/services/SayHello2?method=hello&in=Bla
> 
>>> Neither of this works.
> 
>>> I have also pasted the client code below. This only returns a null
>>> value.
> 
>>> Cheers,
> 
>>> Martin


Re[5]: Problem using deployed Axis web services

Posted by Martin Wunderlich <ma...@gmx.net>.
Dear all,

Further to my recent problems with creating a simple web service and
getting only null values as return values (see below), I seem to have
located the problem.

WSDL2Java, which creates the required server-side files, doesn't seem
to implement the original method properly. In particular, the file
<MyClass>SoapBindingImpl.java, where the actual method implementation
is located, doesn't seem to be correct. For instance, I have the
following simple class:

package mypackage;

public class SayHello {
    public java.lang.String hello(java.lang.String input) {
        return ("Hello, " + input");
    }
}

The class SayHelloSoapBindingImpl, which is created by WSDL2Java looks
like this:

package mypackage;

public class SayHelloSoapBindingImpl implements mypackage.SayHello{
    public java.lang.String hello(java.lang.String input) throws java.rmi.RemoteException {
        return null;
    }

}

Note the hard-coded null value that is returned instead of the
original implementation of the method. If I change this incorrect
implementation, everything works fine.

Am I missing something here? It seems like a lot of unnecessary extra
work, if I have to recreate all the methods when I start building real web
services. I'd rather avoid that.

Cheers,

Martin


> Thanks for the hint. I've managed to generate the test client now.
> Everything works fine, except for validating the result I get. The
> returned String is still null (which confirms the results of my other
> method calls).

> I went again through the process of setting up the web service and
> generating the code. The only odd thing I noticed is with the
> interface for the Java class from which I want to build the service.
> The class would be something like myPackage.SayHello; The interface
> generated by WSDL2Java has the exact same name, which makes it kinda
> hard for the class and the interface to coexist. I don't know, if this
> could be relevant.

> Cheers,

> Martin

>> http://ws.apache.org/axis/java/reference.html

>> -t builds testClient

>>    good luck,



>> -----Original Message-----
>> From: axis-user-return-42843-GREGG.E.MCMULLIN=saic.com@ws.apache.org
>> [mailto:axis-user-return-42843-GREGG.E.MCMULLIN=saic.com@ws.apache.org]
>> On Behalf Of Martin Wunderlich
>> Sent: Wednesday, April 05, 2006 3:57 PM
>> To: Jinyuan Zhou
>> Subject: Re[2]: Problem using deployed Axis web services

>> Thanks a lot for the quick replies, Jinyuan.

>> I checked WSDL2Java for the JUnit option you mentioned, but couldn't
>> find it.
>> As for the URL I call the web service with, it's a bit different from
>> the one you provided. I tried the following:
>> http://localhost/WSTest/services/SayHello2?method=hello&in0=Bla
>> and
>> http://localhost/WSTest/services/SayHello2?method=hello&in=Bla

>> Neither of this works.

>> I have also pasted the client code below. This only returns a null
>> value.

>> Cheers,

>> Martin



-- 
----------------------------------------------------------
Martin Wunderlich, M.A.
Translation/Localisation EN <-> DE

 www.martinwunderlich.com
----------------------------------------------------------
Free / open-source software for translation/localisation:
 www.martinwunderlich.com/foss-links.html
----------------------------------------------------------
Random aphorism: 
 "La follia è una condizione umana. In noi la follia esiste ed è presente come lo è la ragione. Il problema è che la società, per dirsi civile, dovrebbe accettare tanto la ragione quanto la follia."
"Madness is a human condition. Madness is inside us as much as reason. The point is that a so called civil society should accept madness as much as reason."
 - Franco Basaglia
----------------------------------------------------------