views:

335

answers:

3

I have an echo web service running on lets say http://localhost:8080/axis2/services/Service1. This service just echos back a string that is sent to it through the function echo(). Using the wsdl of the above mentioned service (Service.wsdl), I have generated (in eclipse) the ServiceStub.java and the ServiceCallbackHandler.java. With these two files, how can I write a client which will invoke echo(String some_word) and receive the response back? Thanks.

A: 

Check Eclipse WTP Tutorials - Creating Bottom Up Web Service via Apache Axis2, starting from step 27.

Pascal Thivent
+1  A: 

If you simply want to test/exercise your web service, I recommend SOAPUI - http://www.soapui.org/

Point it at your WSDL and it will allow you to call your Web Service methods.

Mark MacIver
A: 

Something like this:
(see also: Axis2 Web Service (Tomcat v6)

package com.gg.ws;

import java.rmi.RemoteException;

import com.gg.ws.ServiceStub.Echo;
import com.gg.ws.ServiceStub.EchoResponse;


public class WebServiceTest {

    public void callEcho() throws RemoteException {

     ServiceStub stub = new ServiceStub();

     Echo request = new Echo();
     request.setValue("Whatever");
     EchoResponse response = stub.echo(request);
     System.out.println(" echo call   response: " + response.get_return());
    }
}
Bob Yoplait