Search code examples
wso2wso2-api-managerwso2-identity-serverwso2-enterprise-integrator

WSO2 Identity Server 5.11 : Unable to publish HTTP events through proxy with the HTTPOutputEventAdapter


I am trying to add an event publisher to send SMS OTP as described in the documentation below :

https://is.docs.wso2.com/en/5.11.0/develop/enable-verification-for-updated-mobile-number/#step-01-add-an-event-publisher-to-send-sms

The api Im trying to call through this event publisher is behind a proxy, so I have added the properties http.proxy.host , http.proxy.port to its configuration as follows :

<?xml version="1.0" encoding="UTF-8"?>
<eventPublisher name="HTTPOutputEventAdapter" processing="enable"
statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
<from streamName="id_gov_sms_notify_stream" version="1.0.0"/>
<mapping customMapping="disabled" type="json"/>
<to eventAdapterType="http">
    <property name="http.client.method">httpGet</property>
    <property name="http.url">https://api_sms/resources</property>
    <!---------------------- PROXY --------------------------->
    <property name="http.proxy.host">xx.xx.xx.xx</property>
    <property name="http.proxy.port">8080</property>
    <!---------------------- PROXY --------------------------->
</to>

It seems that the proxy configuration is ignored, since I receive a timeout error when the event publisher is triggered :

ERROR {org.wso2.carbon.event.output.adapter.core.OutputEventAdapter} - Event dropped at Output Adapter 'HTTPOutputEventAdapter' for tenant id '-1234', Connection timed out (Connection timed out) java.net.ConnectException: Connection timed out (Connection timed out)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:288)
        at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:193)
        at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:153)
        at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:172)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
        at org.wso2.carbon.event.output.adapter.http.HTTPEventAdapter$HTTPSender.run(HTTPEventAdapter.java:316)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Am I using the correct proxy configuration ? otherwise , how can I add proxy configuration to an http out event publisher ?

Thanks in advance.


Solution

  • You should be facing the issue reported in https://github.com/wso2/product-is/issues/9598. As per my analysis, the issue exists in 5.11.0.

    You will have to use 6.0 or apply the fix as a patch by building the source code. Here is a guide for building your own patches; How do you create your own patches for WSO2 Identity Server?.

    PS: If you are a subscription customer of WSO2, you might contact WSO2 for a fix for 5.11.0 via product updates.