I am not well versed with Java. Here is the webservice, I am trying to implement - a basic example and I am facing compilation error. I am not sure what am I missing here.
Here is the code.
package com.joshis1.jaxws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style = Style.DOCUMENT)
public interface IwebServiceInterface {
@WebMethod String sayHello(String name);
}
Next, implementing the interface
package com.joshis1.jaxws;
import javax.jws.WebService;
@WebService(endpointInterface = "com.joshis1.jaxws")
public class webServiceImpl implements IwebServiceInterface {
@Override
public String sayHello(String name)
{
return "Hello Shreyas " + name;
}
}
Next, the main class to publish the endpoint
package com.joshis1.publisher;
import javax.xml.ws.Endpoint;
import com.joshis1.jaxws.*;
public class WebServicePublisher {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8888/webservice/helloworld", new webServiceImpl());
}
}
Next, very basic question - Do I need to install a web server here?
You are pointing your endpointInterface
to your package:
@WebService(endpointInterface = "com.joshis1.jaxws")
It needs to reference your interface:
@WebService(endpointInterface = "com.joshis1.jaxws.IwebServiceInterface")
It is very important to look on what the error is saying
class:com.joshis1.jaxws could not be found