Reputation: 45081
So, I've created a client stub application with Apache CXF from a WSDL. The process was relatively straight-forward. I did it within SoapUI interface. I supplied the WSDL location, told CXF to generate the client stub and hit okay.
Then, I imported the project into Eclipse, added the Apache CXF libraries, configured some security options, certs and whatnot.
I wrote a main with a few test calls to my webservice, and... it worked.
Now my problem is that I don't know WHY it worked. To be more specific, when I hit run in Eclipse, the debug output clearly shows that there are CXF classes being invoked.
INFO: Loaded configuration file cxf.xml.
and
org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
In my main()
I'm invoking the
MyServices ss = new MyServices(wsdlURL, SERVICE_NAME);
port = ss.getWSHttpBindingMyService();
But the MyServices
class extends javax.xml.ws.Service
and there's nothing that hints to CXF.
wsdl2java also generated a MyService
interface and a MyServiceImpl
class that sits in the same package. It looks like a good candidate. In my main()
I can write stuff like port.someMethod(someRequest)
. If I ctrl-click on someMethod
and follow the implementation, it actually brings me to MyServiceImpl
class but there's only dummy code there!
public Boolean someMethod(SomeRequest request) {
LOG.info("Executing operation");
System.out.println(request);
try {
Boolean _return = null;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
So there must be some configuration somewhere that is telling the runtime which implementation to use. But I cannot figure out where or which one it is.
Thanks
Upvotes: 0
Views: 1416
Reputation: 395
Whether you use cxf or wsdl2java to generate the client code . The client code will be generated as per the J2EE specification.
The code generated is just the declaration of service , the implementation of service will be on server.
The client code make uses of the webservice wsdl location to find the service and the operation exposed by it.
Check in your MyServices , You will see your service URL. Ex
wsdlLocation = `"http://127.0.0.1/bookstore/services/search?wsdl"`
Thanks
Upvotes: 0