Reputation: 453
I've been following this tutorial on how to create web services in Java. The code that I've followed are as follows:
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.Endpoint;
@WebService
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class TestService {
@WebMethod
public String sayHello(String msg){
return "Hello "+msg;
}
public static void main(String[] args){
Endpoint.publish("http://localhost:8888/testWS", new TestService());
}
}
The said tutorial instructed that I should just run the main method and I should be able to invoke it in the SoapUI. But each time I try to invoke the URL, I always get an error as mentioned in title. Am I missing something?
Upvotes: 0
Views: 1425
Reputation: 3538
Your code looks OK, but it depends on how you're invoking the service. If you're using soapUI, create a new SOAP project and specify http://localhost:8888/testWS?wsdl
as the initial WSDL:
Then, you can invoke the service by supplying a value in the request payload:
Upvotes: 1