On 2010-11-6, at 下午9:05, Clemens Eisserer wrote:

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);

Hi,

Could you change above line code to
ShippingService shippingService =
    service.getPort(PORT_NAME, ShippingService.class);

to see if this helps, I don't think your previous code get the port you added with specified http address.

Freeman


      // shippingService.ship_items(null, null);
       shippingService.sayHi();
   }

}


--
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org

Reply via email to