You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Clemens Eisserer <li...@gmail.com> on 2010/11/06 14:05:04 UTC

Troubles getting started

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

}

Re: Troubles getting started

Posted by Freeman Fang <fr...@gmail.com>.
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


Re: Troubles getting started

Posted by Clemens Eisserer <li...@gmail.com>.
Hi,

> May be it is to do with a double forward slash ?
> "http://somenamespace.at//dto/shipping"<http://somenamespace.at//dto/shipping>
Sorry, that was just a typo when i adopted the code for the list.

I wasn't able to get anything working, so I started with the
tutorial-code (
https://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html ) from
scratch, and still get the same exception.

The files are located in a public SVN place at:
https://www.assembla.com/code/AIC1/subversion/nodes/AIC1/src/aic1/playground

I would be really thankful if somebody could have a quick look. I've
spent all the day trying to get the sample running.
There are just the four files from the tutorial: Server, Client,
Interface, Implementation

Thank you in advance, Clemens

PS: This is the Exception thrown from the Client:

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)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:472)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:302)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:123)
        at $Proxy45.sayHiToUser(Unknown Source)
        at aic1.playground.WSClient.main(WSClient.java:32)
Caused by: java.net.MalformedURLException: Invalid address. Endpoint
address cannot be null.
        at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:808)
        at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:793)
        at org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPConduit.java:720)
        at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:491)
        at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
        ... 8 more
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could
not send Message.
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:143)
        at $Proxy45.sayHiToUser(Unknown Source)
        at aic1.playground.WSClient.main(WSClient.java:32)
Caused by: java.net.MalformedURLException: Invalid address. Endpoint
address cannot be null.
        at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:808)
        at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:793)
        at org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPConduit.java:720)
        at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:491)
        at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:472)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:302)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:123)
        ... 2 more
Java Result: 1

Re: Troubles getting started

Posted by Sergey Beryozkin <sb...@gmail.com>.
May be it is to do with a double forward slash ?

"http://somenamespace.at//dto/shipping"<http://somenamespace.at//dto/shipping>

cheers, Sergey

On Sat, Nov 6, 2010 at 1:05 PM, Clemens Eisserer <li...@gmail.com>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);
>       // shippingService.ship_items(null, null);
>        shippingService.sayHi();
>    }
>
> }
>