0
votes

I'm trying to deal with the following situation using WSO2 ESB 4.8.1.

ActiveMQ queue <--- proxy ----> WSDL endpoint(Bizagi)

For external situations (per example, external network failure), the remote endpoint turns out of service and is declared as null by the ESB. The proxy when listen messages from the queue try to use the send mediator to the endpoint, and the following stacktrace are showing.

2017-01-23 11:17:15,135 [-] [http-nio-9443-exec-14]  **WARN HTTPEndpointFactory Could not read the WSDL endpoint http://IP-Host-Hidden/Procesos/webservices/WorkflowEngineSOA.asmx?wsdl
java.net.NoRouteToHostException: No route to host**
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
    at sun.net.www.http.HttpClient.New(HttpClient.java:308)
    at sun.net.www.http.HttpClient.New(HttpClient.java:326)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:997)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:933)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:851)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1301)
    at org.apache.synapse.config.SynapseConfigUtils.getOMElementFromURL(SynapseConfigUtils.java:312)
    at org.apache.synapse.config.xml.endpoints.WSDLEndpointFactory.createEndpoint(WSDLEndpointFactory.java:132)
    at org.apache.synapse.config.xml.endpoints.EndpointFactory.createEndpointWithName(EndpointFactory.java:143)
    at org.apache.synapse.config.xml.endpoints.EndpointFactory.getEndpointFromElement(EndpointFactory.java:80)
    at org.wso2.carbon.endpoint.ui.endpoints.wsdl.WsdlEndpoint.build(WsdlEndpoint.java:404)
2017-01-23 11:17:16,138 [-] [demo_in_jms-Worker-2] ERROR JMSMessageReceiver Unknown error processing message java.lang.NullPointerException
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.isTransportSwitching(Axis2SynapseEnvironment.java:571)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:335)
    at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)
    at org.apache.synapse.endpoints.WSDLEndpoint.send(WSDLEndpoint.java:69)
    at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:54)
    at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.axis2.transport.base.AbstractTransportListener.handleIncomingMessage(AbstractTransportListener.java:328)
    at org.apache.axis2.transport.jms.JMSMessageReceiver.processThoughEngine(JMSMessageReceiver.java:200)
    at org.apache.axis2.transport.jms.JMSMessageReceiver.onMessage(JMSMessageReceiver.java:122)
    at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.handleMessage(ServiceTaskManager.java:556)
    at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.run(ServiceTaskManager.java:449)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Checking on Github the WSDLEndpointFactory class, is not throwing a checkeable exception on the mediation layer, only a warning based on a Java networking library but this is provoking NPE on the JMSMessageReceiver, and need to handle for forcing a error and the proxy takes the "fault sequence" path.

I appreciate so much what kind of solution would apply on the sequence to achieve this situation.

1

1 Answers

0
votes

As you pointed out, without throwing an exception from WSDLEndpointFactory class[1] it isn't possible to direct the message to fault sequence by changing the configurations.

If you don't have any special case to use WSDL endpoints, you can use address endpoint instead of WSDL endpoint in your proxy service configuration to overcome this issue.

[1]. https://github.com/wso2/wso2-synapse/blob/master/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointFactory.java#L156