【问题标题】:Configuring PROXY settings in WSO2 ESB 4.8.1在 WSO2 ESB 4.8.1 中配置代理设置
【发布时间】:2014-04-23 21:06:18
【问题描述】:

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

我需要在 WSO2 ESB 中设置任何代理配置吗?

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

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

任何人都可以帮我解决这个问题。有关更多信息,请查看此内容。 (How to send a soap request(xml) to soap service using wso2 proxy service)

添加了错误截图,请查看


修复了问题,下面是最终配置


我的axis2.xml配置为Jean Told(我目前正在使用NIO进行测试,因此我删除了标准repository/conf/axis2/axis2.xml并将repository/conf/axis2/axis2_nhttp.xml重命名为repository/conf /axis2/axis2.xml 在我的 WSO2 ESB v4.8.1 中,然后编辑这个新的axis2 conf文件并搜索transportSender name="http"并在节点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>

然后是我的代理服务配置

********更改了我的代理服务配置,如下答案*****

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

然后我重新启动了 ESB,然后在 wso2 控制台中转到 try this service 并使用 Rest Client(Mozilla Firefox Addon),成功获得了响应

非常感谢 Jean-Michel 帮助完成这项任务

【问题讨论】:

    标签: proxy wso2 wso2esb


    【解决方案1】:

    你会找到配置WSO2here的方法。

    在/repository/conf/axis2/axis2.xml中,编辑http传输的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">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 服务的示例代理:

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

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

    <CelsiusToFahrenheit xmlns="http://www.w3schools.com/webservices/">
      <Celsius>20</Celsius>
    </CelsiusToFahrenheit>
    

    【讨论】:

    • 感谢您的回复.. 实际上我想使用 wso2 代理服务调用此服务 (w3schools.com/webservices/…).. 当我在设计视图中测试地址端点时.. 我得到 地址无效,无法建立连接...如何解决..
    • 我在公司内部使用 wso2,我有一个像 proxy.xxx.com 这样的代理,我有 usernamepassword 那里,,,所以我需要按照你所说的设置,对吗?所以这里&lt;parameter name="http.proxyHost" locked="false"&gt;localhost&lt;/parameter&gt; 我需要提供 proxy.xxx.com 而不是 localhost,这里 &lt;syn:property name="Proxy-Authorization" expression="fn:concat('Basic', base64Encode('userName:password'))" scope="transport"/&gt; 我需要提供代理用户名和密码,对吗??
    • 在我的问题中添加了代理服务...如何按照您所说的进行编辑??
    • 第一部分(带有proxyHost和proxyPort)必须在repository/conf/axis2/axis2.xml中配置(默认http发送者是PassThroughHttpSender:配置这个发送者)。另一种方法是将 proxyHost 和 proxyPort 配置为 java 启动参数:-Dhttp.proxyHost=host -Dhttp.proxyPort=8080。第二部分发生在您的调解中
    • 我已经配置了你的建议并在我编辑的代理服务上方看到(这是否正确),当我在设计视图中测试相同的地址端点 (w3schools.com/webservices/…) 时.. 我仍然得到地址无效,无法建立连接
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-21
    相关资源
    最近更新 更多