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

> The generated code won't get Endpoint address right. Yours is 
> http://localhost/WSTest/services/SayHello2. 
> See if the following code or something simailar  can help:

> call.setTargetEndpointAddress( new
> java.net.URL("http://localhost/WSTest/services/SayHello2";) 

import javax.xml.rpc.ParameterMode;

import org.apache.axis.Constants;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

public class TestClient 
{
        public static void main(String [] args) 
        {
                try 
                {
                        String endpoint =
"http://localhost/WSTest/services/SayHello2";;
                        Service  service = new Service();
                        Call call = (Call) service.createCall();

                        call.setTargetEndpointAddress( new
java.net.URL(endpoint) );
                        call.setOperationName("hello");
                        call.addParameter( "in", Constants.XSD_STRING,
ParameterMode.IN );
                        call.setReturnType( Constants.XSD_STRING );
                        String ret = (String) call.invoke( new Object[]
{ "bla" } );

                        System.out.println("return: " + ret);
                } catch (Exception e) 
                {
                        System.err.println(e.toString());
                }       
        }
}

Reply via email to