【问题标题】:How can we receive the url into wso2 esb proxy service我们如何将 url 接收到 wso2 esb 代理服务中
【发布时间】:2013-08-08 20:18:02
【问题描述】:

我的目标是我必须在代理服务中从客户端接收像 www.google.com 这样的 URL,并将响应发送回客户端。

我该如何解决这个问题。我正在发送我的代理服务。

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
      name="Geturl"
      transports="https http"
      startOnLoad="true"
      trace="enable"
      statistics="enable">
  <description/>
  <target>
     <inSequence onError="fault">
        <property name="RESPONSE" value="true" scope="default" type="STRING"/>
        <property name="REQUEST_HOST_HEADER" value="www.google.com" scope="axis2"/>
        <property name="querystrings"
                  expression="get-property('axis2', 'REST_URL_POSTFIX')"/>
        <property name="REST_URL_POSTFIX"
                  expression="get-property('REQUEST_HOST_HEADER')"
                  scope="axis2"
                  type="STRING"/>
        <property name="HTTP_METHOD" value="GET" scope="axis2" type="STRING"/>
        <header name="To"
                expression="get-property('www.google.com')"/>
<property name="message" value="Response message"/>
<property name="Sender Address" expression="get-property('www.google.com')"/>
        <log level="full"/>
        <log level="full">
           <property name="REQUEST_HOST_HEADER" value="www.wso2.org"/>
        </log>
        <send/>
     </inSequence>
     <outSequence onError="fault">
        <log level="full"/>
        <log level="full">
           <property name="REQUEST_HOST_HEADER" value="www.google.com"/>
        </log>
        <log level="full">
           <property name="success" value="success"/>
        </log>
        <send/>
     </outSequence>
  </target>
</proxy>

谢谢

【问题讨论】:

  • 您是否尝试使用 WSO2 ESB 作为代理来路由来自客户端的 Web 流量?

标签: wso2 wso2esb wso2carbon wso2dss wso2stratos


【解决方案1】:

在代理服务的 outSequence 中,当您调用 &lt;send/&gt; 时,响应将被发送回客户端。试用示例代理服务 [1],并使用 Try-It 或 SOAP UI 调用。您将看到响应传给客户端。

[1]http://docs.wso2.org/wiki/display/ESB460/Sample+150%3A+Introduction+to+Proxy+Services

【讨论】:

  • 谢谢 Lakmali,它正在工作,但如果我的 url 包含一些数据,如 www.w3schools.com,我如何将这些数据接收到我的服务中并向其他客户端发送响应。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多