I am following the Java EE 6 tutorial and trying to set-up a basic client for a web service. I am generating the required code using Eclipse.
Method:
- Create a new Java project
- Start the [Web Service Client] wizard
- Provide the [Service Definition] and select [Develop Client]
This generates the code, but I get the following errors (repeated multiple times):
endpoint.Hello cannot be resolved to a type HelloProxy.java /com.examples.helloclientapp/src/endpoint line
Hello cannot be resolved to a type HelloProxy.java /com.examples.helloclientapp/src/endpoint
This is the code for the webservice I am using (which works and I can access the wsdl):
package endpoint;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class Hello {
private String message = new String("Hello, ");
public void Hello() {
}
@WebMethod
public String sayHello(String name) {
return message + name + ".";
}
}
The generated code that is giving me a problem is the HelloProxy. It seems to be missing the Hello class (this did not get generated):
package endpoint;
public class HelloProxy implements endpoint.Hello {
private String _endpoint = null;
// This was not generated
private endpoint.Hello hello = null;
public HelloProxy() {
_initHelloProxy();
}
public HelloProxy(String endpoint) {
_endpoint = endpoint;
_initHelloProxy();
}
private void _initHelloProxy() {
try {
hello = (new endpoint.HelloServiceLocator()).getHelloPort();
if (hello != null) {
if (_endpoint != null)
((javax.xml.rpc.Stub)hello)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
else
_endpoint = (String)((javax.xml.rpc.Stub)hello)._getProperty("javax.xml.rpc.service.endpoint.address");
}
}
catch (javax.xml.rpc.ServiceException serviceException) {}
}
public String getEndpoint() {
return _endpoint;
}
public void setEndpoint(String endpoint) {
_endpoint = endpoint;
if (hello != null)
((javax.xml.rpc.Stub)hello)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
}
public endpoint.Hello getHello() {
if (hello == null)
_initHelloProxy();
return hello;
}
}
The other files that were generated are (If needed I can give the contents):
- Hello_PortType.java
- HelloPortBindingStub.java
- HelloService.java
- HelloServiceLocator.java
Is there something wrong with the webservice that is causing the Hello class to not be generated?