Configuring PROXY settings in WSO2 ESB 4.8.1

做~自己de王妃 提交于 2019-11-29 12:52:30
Jean-Michel

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>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!