01: public void executeCall() throws Exception {
02: DeliveryChannel deliveryChannel =
componentContext.getDeliveryChannel();
03: DocumentFragment epr = createEndpointReference();
04: ServiceEndpoint endpoint =
componentContext.resolveEndpointReference(epr);
05: MessageExchangeFactory exchangeFactory =
deliveryChannel.createExchangeFactory(endpoint);
06: InOut exchange = exchangeFactory.createInOutExchange();
07: exchange.setService(SERVICE_NAME);
08: exchange.setInterfaceName(INTERFACE_NAME);
09: exchange.setOperation(OPERATION_NAME);
10: NormalizedMessage message = exchange.createMessage();
11: Source messageContent = new StreamSource(new
ByteArrayInputStream(SAMPLE_REQUEST.getBytes()));
12: message.setContent(messageContent);
13: exchange.setInMessage(message);
14: deliveryChannel.sendSync(exchange);
15: }
The createEndpointReference method at line 03, returns document fragment
created form the XML:
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>
http://127.0.0.1:8887/soap/LibraryProvider
</wsa:Address>
<wsa:Metadata
xmlns:wsaw="http://www.w3.org/2005/03/addressing/wsdl">
<wsaw:ServiceName
xmlns:ns="http://services.sopware.org/demos/LibraryProvider/1.0"
EndpointName="Library_WS-I">ns:LibraryProvider</wsaw:ServiceName>
</wsa:Metadata>
</wsa:EndpointReference>
So http binding component suppose to resolve this EPR, and it actually do.
We are using ServiceMix 3's binding component packed as osgi bundle
"servicemix-http-3.2.1-installer.zip"
So we actually receiving eligible ServiceEndpoint instance at line 04,
the endpoint object has
serviceName property equals to "{urn:servicemix:http}HttpComponent" and
enpointName property equals
"http://127.0.0.1:8887/soap/LibraryProvider". Again, this it the same as
in corresponding SMX3 use case.
But when we try to execute sync call at line 14 receiving exception
stack trace:
org.apache.servicemix.nmr.api.ServiceMixException: Could not dispatch
exchange. No flow can handle it.
at
org.apache.servicemix.nmr.core.FlowRegistryImpl.dispatch(FlowRegistryImpl.java:58)
at
org.apache.servicemix.nmr.core.ChannelImpl.dispatch(ChannelImpl.java:226)
at
org.apache.servicemix.nmr.core.ChannelImpl.sendSync(ChannelImpl.java:129)
at
org.apache.servicemix.nmr.core.ChannelImpl.sendSync(ChannelImpl.java:114)
at
org.apache.servicemix.jbi.runtime.impl.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:186)
at test.SimpleCallExecutor.executeCall(SimpleCallExecutor.java:65)
All this very strange as long as we do this sync request according jbi
specification and passing the same data that we did in our current
solution based on SMX3.
According to jbi spec and smx3 debug experience message exchange should
pe passed first to http-binding component that should
execute http request. But in current situation ServiceMix 4 failing to
pass message request to http-binding. Actually exception
throws exactly at this point when NMR trying to find out target jbi
component and can't find it.