provokoe
provokoe

Reputation: 178

Creating client for web service

I have deployed a simple hello service in jboss server. I can view the wsdl file. Can someone help me with the client side. I mean how to access this service? Is there any way to access from web browser? Method deployed is

@WebMethod
public String greet( @WebParam(name = "name")
String name )
    {
   return "Hello" + name;
    }

Upvotes: 0

Views: 2651

Answers (1)

Anuj Balan
Anuj Balan

Reputation: 7729

Try to know what is the wsdl url to access the service which you have just exposed. It might most probably be something like "http://localhost: < port-number >/ems-ejb/?wsdl"

If you type the same in the browser, you should be able to see the wsdl file (page with full of xml tags).

Once done, follow the steps provided here

Example on how to call the method once client stub is generated

String endpoint = "your wsdl url";
GreetImplServiceLocator objGreetImplServiceLocator = new GreetImplServiceLocator();
java.net.URL url = new java.net.URL(endpoint);
GreetIntf objGreetIntf = objGreetImplServiceLocator.getFaultImplPort(url);
 String greetings=objFaultIntf.greet("stackoverflow");

Upvotes: 2

Related Questions