« Return to Thread: cxf in an OSGi environment

cxf in an OSGi environment

by David Savage :: Rate this Message:

Reply to Author | View in Thread

Hi there,

I'm trying to get cxf to work in an OSGi environment and have been
banging my head against the desk a bit, suspect it might be due to
leaping in at the deep end but any help would be appreciated.

Ok here's what I've got working:

   JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
   svrFactory.setServiceClass(HelloWorld.class);
   svrFactory.setServiceBean(HelloWorldImpl());
   svrFactory.setAddress("http://localhost:9000/hello" );
   svrFactory.create();

This launches an internal jetty server and when I test this using a web
browser I can at least see that the server is running as I get a soap
response:

<soap:Envelope>
   <soap:Body>
     <soap:Fault>
       <faultcode>soap:Server</faultcode>
       <faultstring>No such operation: </faultstring>
     </soap:Fault>
   </soap:Body>
</soap:Envelope>

However I've not been able to get a client working in OSGi. Initially
this was due to code in the
org.apache.cxf.frontend.ClientProxyFactoryBean which assumed the
classloader to generate the proxy would be the loader of the client
interface. I've worked around that in a local patch here by setting
Thread.contextClassLoader.

Here's what I have on the client side:

   JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
   factory.setServiceClass(reference.getInterface());
   factory.setAddress("http://localhost:9000/hello");
   // set context classloader
   ...
   HelloWorld proxy = factory.create();
   proxy.sayHello("World");


However the client still fails due to a null BindingDetails object which
is loaded when my test method is invoked:

  javax.xml.ws.WebServiceException: Could not find wsdl:binding
operation info for web method sayHello.
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:150)
        at $Proxy35.sayHello(Unknown Source)

Is there a stage I'm missing here?

I'm also trying to get cxf to work with an https connection (both client
and server). On the server side I've figured out that the process has
something to do with doing something like:

server = svrFactory.create();
                       
JettyHTTPDestination dest = (JettyHTTPDestination) server.getDestination();
JettyHTTPServerEngine engine = (JettyHTTPServerEngine) dest.getEngine();
                       
if ( secure ) {
   TLSServerParameters params = new TLSServerParameters();
   // set params
   engine.setTlsServerParameters(params);
}

But again I'm not having much luck. Is there any example code I can
follow or that someone can post to show how this should work?

Thanks in advance for any help.

Regards,

Dave

_______________________________________________________________________
Paremus Limited. Registered in England
 No. 4181472
 Registered Office: 22-24 Broad Street, Wokingham, Berks RG40 1BA
 Postal Address: 107-111 Fleet Street, London, EC4A 2AB
The information transmitted is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender and delete the material from any computer.
_______________________________________________________________________

 « Return to Thread: cxf in an OSGi environment