axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Wunderlich <martin...@gmx.net>
Subject Re[2]: Problem using deployed Axis web services
Date Wed, 05 Apr 2006 19:57:09 GMT
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());
                }       
        }
}


Mime
View raw message