You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Daniel Lipofsky <Da...@bricsnet.com> on 2008/02/20 01:24:14 UTC

client code to access java_first_jaxws on tomcat

I am trying to learn CXF, I have installed the java_first_jaxws
sample on Tomcat 5.5 and can see the wsdl at
http://localhost:8080/helloworld/services/hello_world?wsdl

But what I don't understand is how I can run webservices
against that server.  Does anyone have client code that will
allow me to test?  I tried modifying Client.java like this:

    private static final QName SERVICE_NAME
        = new QName("http://server.hw.demo/", "HelloWorld");
    private static final QName PORT_NAME
        = new QName("http://server.hw.demo/", "HelloWorldPort");

    public static void main(String args[]) throws Exception {
        Service service = Service.create(SERVICE_NAME);
        String endpointAddress =
"http://localhost:8080/helloworld/services/hello_world?wsdl";
        service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
        HelloWorld hw = service.getPort(HelloWorld.class);
        System.out.println(hw.sayHi("World"));
    }

but all I got was

org.apache.cxf.binding.soap.SoapFault:
"http://schemas.xmlsoap.org/wsdl/",
the namespace on the "definitions" element, is not a valid SOAP version.

I tried a bunch of variations too with no success.
How does one make this work?  (I'd also appreciate
an example for wsdl_first_soap12 or any of the others)

Thanks,
Dan

Re: client code to access java_first_jaxws on tomcat

Posted by Willem Jiang <wi...@gmail.com>.
Hi Dan,

You set the wrong endpointAddress.

"http://localhost:8080/helloworld/services/hello_world?wsdl" is the 
service wsdl url. 

you need to set the endpointAddress to be 
"http://localhost:8080/helloworld/services/hello_world"

Willem 


Daniel Lipofsky wrote:
> I am trying to learn CXF, I have installed the java_first_jaxws
> sample on Tomcat 5.5 and can see the wsdl at
> http://localhost:8080/helloworld/services/hello_world?wsdl
>
> But what I don't understand is how I can run webservices
> against that server.  Does anyone have client code that will
> allow me to test?  I tried modifying Client.java like this:
>
>     private static final QName SERVICE_NAME
>         = new QName("http://server.hw.demo/", "HelloWorld");
>     private static final QName PORT_NAME
>         = new QName("http://server.hw.demo/", "HelloWorldPort");
>
>     public static void main(String args[]) throws Exception {
>         Service service = Service.create(SERVICE_NAME);
>         String endpointAddress =
> "http://localhost:8080/helloworld/services/hello_world?wsdl";
>         service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
> endpointAddress);
>         HelloWorld hw = service.getPort(HelloWorld.class);
>         System.out.println(hw.sayHi("World"));
>     }
>
> but all I got was
>
> org.apache.cxf.binding.soap.SoapFault:
> "http://schemas.xmlsoap.org/wsdl/",
> the namespace on the "definitions" element, is not a valid SOAP version.
>
> I tried a bunch of variations too with no success.
> How does one make this work?  (I'd also appreciate
> an example for wsdl_first_soap12 or any of the others)
>
> Thanks,
> Dan
>
>   


Re: client code to access java_first_jaxws on tomcat

Posted by Glen Mazza <gl...@verizon.net>.
Here's a WSDL-first example I created:
http://www.jroller.com/gmazza/date/20071019

For just a pure client, of an already existing web service:
http://www.jroller.com/gmazza/date/20070929

HTH,
Glen

Am Dienstag, den 19.02.2008, 16:24 -0800 schrieb Daniel Lipofsky:
> I am trying to learn CXF, I have installed the java_first_jaxws
> sample on Tomcat 5.5 and can see the wsdl at
> http://localhost:8080/helloworld/services/hello_world?wsdl
> 
> But what I don't understand is how I can run webservices
> against that server.  Does anyone have client code that will
> allow me to test?  I tried modifying Client.java like this:
> 
>     private static final QName SERVICE_NAME
>         = new QName("http://server.hw.demo/", "HelloWorld");
>     private static final QName PORT_NAME
>         = new QName("http://server.hw.demo/", "HelloWorldPort");
> 
>     public static void main(String args[]) throws Exception {
>         Service service = Service.create(SERVICE_NAME);
>         String endpointAddress =
> "http://localhost:8080/helloworld/services/hello_world?wsdl";
>         service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
> endpointAddress);
>         HelloWorld hw = service.getPort(HelloWorld.class);
>         System.out.println(hw.sayHi("World"));
>     }
> 
> but all I got was
> 
> org.apache.cxf.binding.soap.SoapFault:
> "http://schemas.xmlsoap.org/wsdl/",
> the namespace on the "definitions" element, is not a valid SOAP version.
> 
> I tried a bunch of variations too with no success.
> How does one make this work?  (I'd also appreciate
> an example for wsdl_first_soap12 or any of the others)
> 
> Thanks,
> Dan


RE: client code to access java_first_jaxws on tomcat

Posted by Daniel Lipofsky <Da...@bricsnet.com>.
Thanks for the speedy replies.
Willem's simple change got my client working, and
Glen's well documented and more complex examples
will probably save my sanity as I progress in this project.
- Dan

> -----Original Message-----
> From: Daniel Lipofsky [mailto:Daniel.Lipofsky@bricsnet.com] 
> Sent: Tuesday, February 19, 2008 5:24 PM
> To: cxf-user@incubator.apache.org
> Subject: client code to access java_first_jaxws on tomcat
> 
> I am trying to learn CXF, I have installed the java_first_jaxws
> sample on Tomcat 5.5 and can see the wsdl at
> http://localhost:8080/helloworld/services/hello_world?wsdl
> 
> But what I don't understand is how I can run webservices
> against that server.  Does anyone have client code that will
> allow me to test?  I tried modifying Client.java like this:
> 
>     private static final QName SERVICE_NAME
>         = new QName("http://server.hw.demo/", "HelloWorld");
>     private static final QName PORT_NAME
>         = new QName("http://server.hw.demo/", "HelloWorldPort");
> 
>     public static void main(String args[]) throws Exception {
>         Service service = Service.create(SERVICE_NAME);
>         String endpointAddress =
> "http://localhost:8080/helloworld/services/hello_world?wsdl";
>         service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
> endpointAddress);
>         HelloWorld hw = service.getPort(HelloWorld.class);
>         System.out.println(hw.sayHi("World"));
>     }
> 
> but all I got was
> 
> org.apache.cxf.binding.soap.SoapFault:
> "http://schemas.xmlsoap.org/wsdl/",
> the namespace on the "definitions" element, is not a valid 
> SOAP version.
> 
> I tried a bunch of variations too with no success.
> How does one make this work?  (I'd also appreciate
> an example for wsdl_first_soap12 or any of the others)
> 
> Thanks,
> Dan
>