Configuring PROXY settings in WSO2 ESB 4.8.1

2019-01-27 03:34发布

I am new to wso2.. I am facing an issue while calling an EXTERNAl SOAP Service using wso2esb proxy service.. I am using WSO2 ESB inside a corporate proxy.. I can able to call this external soap service directly using an soap client..

Is there any proxy configuration that I need to set in WSO2 ESB ?

I am getting the following exception while connecting a soap service using wso2proxy service

2014-03-18 14:40:52,193 [-] [PassThroughHTTPSender] WARN ConnectCallback Connection refused or failed for : www.w3schools.com/68.232.44.251:80 2014-03-18 14:40:52,198 [-] [PassThroughMessageProcessor-3] WARN EndpointContext Endpoint : AnonymousEndpoint will be marked SUSPENDED as it failed 2014-03-18 14:40:52,199 [-] [PassThroughMessageProcessor-3] WARN EndpointContext Suspending endpoint : AnonymousEndpoint - current suspend duration is : 30000ms - Next retry after : Tue Mar 18 14:41:22 IST 2014 2014-03-18 14:41:51,185 [-] [HTTP-Listener I/O dispatcher-2] WARN SourceHandler Connection time out after request is read: http-incoming-2 2014-03-18 14:51:49,691 [-] [PassThroughHTTPSender] WARN ConnectCallback Connection refused or failed for : www.w3schools.com/68.232.44.251:80 2014-03-18 14:51:49,693 [-] [PassThroughMessageProcessor-5] WARN EndpointContext Endpoint : AnonymousEndpoint will be marked SUSPENDED as it failed 2014-03-18 14:51:49,694 [-] [PassThroughMessageProcessor-5] WARN EndpointContext Suspending endpoint : AnonymousEndpoint - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Tue Mar 18 14:52:19 IST 2014

Can anyone help me on this please.. For more information please have a look into this. (How to send a soap request(xml) to soap service using wso2 proxy service)

Added the Error Screeshot,Please have a look into this

While clicking **test** in design view,getting the below exception


Fixed the issue and Below are the final configurations


My axis2.xml configuration as Jean Told ( I'm currently testing with NIO, therefore I've removed standard repository/conf/axis2/axis2.xml and renamed repository/conf/axis2/axis2_nhttp.xml to repository/conf/axis2/axis2.xml in my WSO2 ESB v4.8.1 then you edit this new axis2 conf file and search for transportSender name="http" and inside the node transportSender)

<transportSender name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSender"> <parameter name="non-blocking" locked="false">true</parameter> <parameter name="http.proxyHost" locked="false">proxy.abc.com</parameter> <parameter name="http.proxyPort" locked="false">8080</parameter> </transportSender>

Then My proxy service configuration

********Changed my proxy service Configuration like below answer *****

`<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="CelsiusToFahrenheitService"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="messageType" value="text/xml" scope="axis2"/>
         <property name="Proxy-Authorization"
                   expression="fn:concat('Basic', base64Encode('INDIA\username:pwd'))"
                   scope="transport"/>
         <property name="POST_TO_URI" value="true" scope="axis2"/>
         <property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
         <header name="Action"
                 value="http://www.w3schools.com/webservices/CelsiusToFahrenheit"/>
         <send>
            <endpoint>
               <address uri="http://www.w3schools.com/webservices/tempconvert.asmx"
                        format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <property name="messageType" value="text/xml" scope="axis2"/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>`

Then i restarted the ESB ,then went to try this service in wso2 console as well as using Rest Client(Mozilla Firefox Addon),got the resposne successfully

Thanks alot Jean-Michel for helping this task

1条回答
我想做一个坏孩纸
2楼-- · 2019-01-27 04:14

You will find the way to configure WSO2 here.

In /repository/conf/axis2/axis2.xml, edit the transportSender configuration of the http transport to specify the proxy server as follows:

<transportSender name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSender">
    <parameter name="non-blocking" locked="false">true</parameter>
    <parameter name="http.proxyHost" locked="false">proxyhost.yourdomain</parameter>
    <parameter name="http.proxyPort" locked="false">proxyport</parameter>
</transportSender>

In the Synapse configuration of the proxy service that sends messages to this proxy server, set the following two properties before the send mediator:

<syn:property name="Proxy-Authorization" expression="fn:concat('Basic', base64Encode('userName:password'))" scope="transport"/>
<syn:property name="POST_TO_URI" value="true" scope="axis2"/>

Sample proxy to test tempconvert service :

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="CelsiusToFahrenheitService" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
    <target>
        <inSequence>
            <property name="messageType" value="text/xml" scope="axis2"/>
            <property name="Proxy-Authorization" expression="fn:concat('Basic', base64Encode('DOMAIN\user:pass'))" scope="transport"/>
            <property name="POST_TO_URI" value="true" scope="axis2"/>
            <property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
            <header name="Action" value="http://www.w3schools.com/webservices/CelsiusToFahrenheit"/>
            <send>
                <endpoint>
                    <address uri="http://www.w3schools.com/webservices/tempconvert.asmx" format="soap11"/>
                </endpoint>
            </send>
        </inSequence>
        <outSequence>
            <property name="messageType" value="text/xml" scope="axis2"/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>

In WSO2 ESB console, click on "Try this service" and enter this request :

<CelsiusToFahrenheit xmlns="http://www.w3schools.com/webservices/">
  <Celsius>20</Celsius>
</CelsiusToFahrenheit>
查看更多
登录 后发表回答