Hi,
I am trying to get started with web services using the tutorial at:
https://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html
However when running the client, I get the following exception:
> WARNING: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not send Message.
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:48)
> ...............
> Caused by: java.net.MalformedURLException: Invalid address. Endpoint address
> cannot be null.
> at
> org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:808)
Any idea what the reson for this fault could be?
Code is attached below.
Thank you in advance, Clemens
The interface:
@WebService
public interface ShippingService {
@WebMethod(operationName="sayHi")
public void sayHi();
}
The implementation:
@WebService(serviceName = "ShippingService",
portName="ShippingPT",
targetNamespace="http://somenamespace.at//dto/shipping")
public class ShippingServiceImpl implements ShippingService {
public void sayHi() {
System.out.println("Hallo!");
}
}
The console-client:
public class WSClient {
private static final QName SERVICE_NAME
= new QName("http://somenamespace.at//dto/shipping", "ShippingService");
private static final QName PORT_NAME
= new QName("http://somenamespace.at//dto/shipping", "ShippingPT");
public static void main(String args[]) throws Exception {
Service service = Service.create(SERVICE_NAME);
// Endpoint Address
String endpointAddress = "http://localhost:9000/ShippingService";
// Add a port to the Service
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
ShippingService shippingService =
service.getPort(ShippingService.class);
// shippingService.ship_items(null, null);
shippingService.sayHi();
}
}