You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Davis, Michelle" <Mi...@iona.com> on 2007/08/09 21:42:23 UTC
Error with service.create
Hello. I am trying to use the service create method and am getting the
following compile error:
compile:
[javac] Compiling 1 source file to
C:\IONA\Fuse20\cxf20\samples\hello_world\
build\classes
[javac]
C:\IONA\Fuse20\cxf20\samples\hello_world\src\demo\hw\client\Client.j
ava:58: incompatible types
[javac] found : javax.xml.ws.Service
[javac] required: org.apache.hello_world_soap_http.SOAPService
[javac] SOAPService ss = Service.create(SERVICE_NAME);
I am not sure what is wrong. Here is the snippet of code:
public final class Client {
private static final QName SERVICE_NAME
= new QName("http://apache.org/hello_world_soap_http",
"SOAPService");
private Client() {
}
public static void main(String args[]) throws Exception {
// System.out.println("Enter a service to use");
SOAPService ss = Service.create(SERVICE_NAME);
.............
It is with FUSE 2.0. I am rebuilding the hello world demo client
without the WSDL. Any ideas?
THANK YOU.
************************************
Michelle L. Davis
Re: Error with service.create
Posted by Daniel Kulp <dk...@apache.org>.
Actually, Dan is wrong here. SOAPService would be an artifact
generated from the WSDL. The original Client.java probably had a "new
SOAPService(...)" call in it. If you aren't starting from WSDL and
doing completely code first stuff, the process is a bit different.
Check out the new "code first" demo in 2.0.1. You can grab just the
demo from:
http://svn.apache.org/repos/asf/incubator/cxf/trunk/distribution/src/main/release/samples/hello_world_code_first/
String endpointAddress = "http://localhost:9000/helloWorld";
Service service = Service.create(SERVICE_NAME);
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
HelloWorld hw = service.getPort(PORT_NAME, HelloWorld.class);
if you want to use the server wsdl:
String endpointAddress = "http://localhost:9000/helloWorld";
Service service = Service.create(new URL(endpointAddress + "?wsdl"),
SERVICE_NAME);
HelloWorld hw = service.getPort(PORT_NAME, HelloWorld.class);
Dan
On Thursday 09 August 2007 20:56, Dan Diephouse wrote:
> Hi Michelle,
>
> You need to cast to SOAPService I believe:
>
> SOAPService ss = (SOAPService) Service.create(SERVICE_NAME);
>
> CXF doesn't generate a Client.java, so its either FUSE or your code
> that needs fixin' :-)
>
> Cheers,
> - Dan
>
> On 8/9/07, Davis, Michelle <Mi...@iona.com> wrote:
> > Hello. I am trying to use the service create method and am getting
> > the following compile error:
> >
> >
> >
> > compile:
> >
> > [javac] Compiling 1 source file to
> > C:\IONA\Fuse20\cxf20\samples\hello_world\
> >
> > build\classes
> >
> > [javac]
> > C:\IONA\Fuse20\cxf20\samples\hello_world\src\demo\hw\client\Client.j
> >
> > ava:58: incompatible types
> >
> > [javac] found : javax.xml.ws.Service
> >
> > [javac] required: org.apache.hello_world_soap_http.SOAPService
> >
> > [javac] SOAPService ss =
> > Service.create(SERVICE_NAME);
> >
> >
> >
> > I am not sure what is wrong. Here is the snippet of code:
> >
> >
> >
> > public final class Client {
> >
> >
> >
> > private static final QName SERVICE_NAME
> >
> > = new QName("http://apache.org/hello_world_soap_http",
> > "SOAPService");
> >
> > private Client() {
> >
> > }
> >
> > public static void main(String args[]) throws Exception {
> >
> > // System.out.println("Enter a service to use");
> >
> > SOAPService ss = Service.create(SERVICE_NAME);
> >
> > .............
> >
> >
> >
> > It is with FUSE 2.0. I am rebuilding the hello world demo client
> > without the WSDL. Any ideas?
> >
> >
> >
> > THANK YOU.
> >
> > ************************************
> >
> > Michelle L. Davis
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
Re: Error with service.create
Posted by Dan Diephouse <da...@envoisolutions.com>.
Hi Michelle,
You need to cast to SOAPService I believe:
SOAPService ss = (SOAPService) Service.create(SERVICE_NAME);
CXF doesn't generate a Client.java, so its either FUSE or your code that
needs fixin' :-)
Cheers,
- Dan
On 8/9/07, Davis, Michelle <Mi...@iona.com> wrote:
>
> Hello. I am trying to use the service create method and am getting the
> following compile error:
>
>
>
> compile:
>
> [javac] Compiling 1 source file to
> C:\IONA\Fuse20\cxf20\samples\hello_world\
>
> build\classes
>
> [javac]
> C:\IONA\Fuse20\cxf20\samples\hello_world\src\demo\hw\client\Client.j
>
> ava:58: incompatible types
>
> [javac] found : javax.xml.ws.Service
>
> [javac] required: org.apache.hello_world_soap_http.SOAPService
>
> [javac] SOAPService ss = Service.create(SERVICE_NAME);
>
>
>
> I am not sure what is wrong. Here is the snippet of code:
>
>
>
> public final class Client {
>
>
>
> private static final QName SERVICE_NAME
>
> = new QName("http://apache.org/hello_world_soap_http",
> "SOAPService");
>
> private Client() {
>
> }
>
> public static void main(String args[]) throws Exception {
>
> // System.out.println("Enter a service to use");
>
> SOAPService ss = Service.create(SERVICE_NAME);
>
> .............
>
>
>
> It is with FUSE 2.0. I am rebuilding the hello world demo client
> without the WSDL. Any ideas?
>
>
>
> THANK YOU.
>
> ************************************
>
> Michelle L. Davis
>
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog