Hi!
Try to utililize local transport instead of HTTP on CXF 2.0.13. Read the
simple guide at http://cxf.apache.org/docs/local-transport.html, googled,
debugged CXF back and forth but failed anyway:
INFO: Interceptor has thrown exception, unwinding now
java.lang.IllegalStateException: Local destination does not have a
MessageObserver on address local://fooService
at
org.apache.cxf.transport.local.LocalConduit.dispatchViaPipe(LocalConduit.java:109)
at
org.apache.cxf.transport.local.LocalConduit.prepare(LocalConduit.java:59)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:231)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
Tried a couple of different approached and ran into different problems but
the above one was what I got first. The problem is that
LocalDestination.incomingObserver stays null. The wrapped conduit gets
ClientImpl as observer set. There's a client that's actually instantiated
via @WebService and .wsdl (but not used) but the endpoint and in-JVM client
is done in code like this:
String localPath = "local:/" + path; // path="/fooService"
ServerFactoryBean sf = new ServerFactoryBean();
sf.setAddress(localPath);
sf.setServiceBean(implementor);
sf.setTransportId(LocalTransportFactory.TRANSPORT_ID); // reset to
soap by CXF
// sf.setInInterceptors(new ArrayList<Interceptor>(2) {
// {
// add(new GlobalInitInInterceptor(ds));
// add(new CleanupInInterceptor(Phase.POST_INVOKE));
// }
// });
sf.create();
Alternatively:
// EndpointImpl e = new EndpointImpl(implementor);
// e.setAddress(localPath);
// // e.setBindingUri("http://cxf.apache.org/transports/local");
// e.getInInterceptors().add(new GlobalInitInInterceptor(ds));
// e.getInInterceptors().add(new
CleanupInInterceptor(Phase.POST_INVOKE));
// e.getOutFaultInterceptors().add(new
CleanupOutFaultInterceptor(Phase.MARSHAL));
// e.publish();
The client:
ClientProxyFactoryBean cf = new ClientProxyFactoryBean();
cf.setAddress("local://fooService");
cf.setServiceClass(IFooService.class); // Optionally specify the
service interface
... = cf.create();
Pretty simple, quite exactly like the example.
I dropped all these initial registerConduitInitiator()s and
registerDestinationsFactory()s these seem to attempt to transfer all traffic
in-JVM (?). However the service needs to continue to serve remote clients
via HTTP (-> Endpoint.publish(path, instance)).
Can't imaging to be the first one struggling this problem. What am I
supposed to do LocalDestination gets a message observer?
Thanks a lot!