在 WSO2 ESB 4.8.1 中配置代理设置 [英] Configuring PROXY settings in WSO2 ESB 4.8.1

查看:57
本文介绍了在 WSO2 ESB 4.8.1 中配置代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 wso2 的新手.. 我在使用 wso2esb 代理服务调用外部 SOAP 服务时遇到问题.. 我在公司代理中使用 WSO2 ESB.. 我可以直接使用肥皂客户端..

是否需要在 WSO2 ESB 中设置任何代理配置?

我在使用 wso2proxy 服务连接肥皂服务时遇到以下异常

2014-03-18 14:40:52,193 [-] [PassThroughHTTPSender] WARN ConnectCallback 连接被拒绝或失败:www.w3schools.com/68.232.44.251:802014-03-18 14:40:52,198 [-] [PassThroughMessageProcessor-3] WARN EndpointContext Endpoint:AnonymousEndpoint 将被标记为 SUSPENDED,因为它失败了2014-03-18 14:40:52,199 [-] [PassThroughMessageProcessor-3] WARN EndpointContext 挂起端点:AnonymousEndpoint - 当前挂起持续时间是:30000ms - 下次重试:201 年 2 月 18 日星期二 14:41:24 IST2014-03-18 14:41:51,185 [-] [HTTP-Listener I/O dispatcher-2] 读取请求后警告 SourceHandler 连接超时:http-incoming-22014-03-18 14:51:49,691 [-] [PassThroughHTTPSender] 警告 ConnectCallback 连接被拒绝或失败:www.w3schools.com/68.232.44.251:802014-03-18 14:51:49,693 [-] [PassThroughMessageProcessor-5] WARN EndpointContext Endpoint:AnonymousEndpoint 将被标记为 SUSPENDED,因为它失败了2014-03-18 14:51:49,694 [-] [PassThroughMessageProcessor-5] WARN EndpointContext 挂起端点:AnonymousEndpoint - 上次挂起持续时间为:30000 毫秒,当前挂起持续时间为:30000 毫秒 - 下次重试时间:2014 年 3 月 1 日星期二:2018 年 3 月 1 日19 IST 2014

任何人都可以帮我解决这个问题.有关更多信息,请查看此内容.(.

在/repository/conf/axis2/axis2.xml中,编辑http传输的transportSender配置,指定代理服务器如下:

<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>

在向此代理服务器发送消息的代理服务的 Synapse 配置中,在发送中介之前设置以下两个属性:

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

测试 tempconvert 服务的示例代理:

<目标><按顺序><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"/><发送><端点><地址uri="http://www.w3schools.com/webservices/tempconvert.asmx" format="soap11"/></端点></发送></inSequence><outSequence><property name="messageType" value="text/xml" scope="axis2"/><发送/></outSequence></目标><描述/></代理>

在 WSO2 ESB 控制台中,单击尝试此服务"并输入此请求:

<摄氏度>20</摄氏度></CelsiusToFahrenheit>

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


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

解决方案

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>

这篇关于在 WSO2 ESB 4.8.1 中配置代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆