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: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED]
>> 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
----------------------------------------------------------

Reply via email to