WSO2 ESB尝试为c0onnect创建代理服务以休息服务以提取数据

时间:2015-05-19 13:14:46

标签: wso2esb

我是wso2 esb服务器的新用户,我正在尝试创建代理服务以连接到休息服务。我在“部署服务"”中试图测试代理时遇到问题。 esb的页面。代理服务的源视图是:

> <?xml version="1.0" encoding="UTF-8"?>
>       <proxy xmlns="http://ws.apache.org/ns/synapse"
>        name="search"
>        transports="https,http,local"
>        statistics="disable"
>        trace="disable"
>        startOnLoad="true">
>      <target>
>       <outSequence>
>          <send/>
>       </outSequence>
>       <faultSequence>
>          <log level="full" category="DEBUG"/>
>       </faultSequence>
>       <endpoint>
>          <http method="get" uri-template="http://52.24.50.197:8080/search"/>
>          <property name="q" value="test"/>
>       </endpoint>    </target>    <description/> </proxy>

我点击&#34;尝试此服务&#34;链接,我在控制台中得到这个:

   [2015-05-19 09:06:43,573] DEBUG - SynapseMessageReceiver Synapse received a new message for message mediation...
[2015-05-19 09:06:43,574] DEBUG - SynapseMessageReceiver Received To: /services/mediate/mediate
[2015-05-19 09:06:43,575] DEBUG - SynapseMessageReceiver SOAPAction: null
[2015-05-19 09:06:43,575] DEBUG - SynapseMessageReceiver WSA-Action: null
[2015-05-19 09:06:43,575] DEBUG - Axis2SynapseEnvironment Injecting MessageContext
[2015-05-19 09:06:43,576] DEBUG - Axis2SynapseEnvironment Using Main Sequence for injected message
[2015-05-19 09:06:43,576] DEBUG - SequenceMediator Start : Sequence <main>
[2015-05-19 09:06:43,576] DEBUG - SequenceMediator Sequence <SequenceMediator> :: mediate()
[2015-05-19 09:06:43,577] DEBUG - SequenceMediator Mediation started from mediator position : 0
[2015-05-19 09:06:43,577] DEBUG - InMediator Start : In mediator
[2015-05-19 09:06:43,578] DEBUG - InMediator Current message is incoming - executing child mediators
[2015-05-19 09:06:43,578] DEBUG - InMediator Sequence <InMediator> :: mediate()
[2015-05-19 09:06:43,578] DEBUG - InMediator Mediation started from mediator position : 0
[2015-05-19 09:06:43,579] DEBUG - LogMediator Start : Log mediator
[2015-05-19 09:06:43,579]  INFO - LogMediator To: /services/mediate/mediate, MessageID: urn:uuid:e2c5b5f7-3c2c-4969-9c0b-6aa4d8282f2d, Direction: requ
st, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body></soapen
:Body></soapenv:Envelope>
[2015-05-19 09:06:43,580] DEBUG - LogMediator End : Log mediator
[2015-05-19 09:06:43,581] DEBUG - FilterMediator Start : Filter mediator
[2015-05-19 09:06:43,581] DEBUG - FilterMediator Source : get-property('To') against : http://localhost:9000.* does not match - skipping child mediato
s
[2015-05-19 09:06:43,582] DEBUG - FilterMediator End : Filter mediator
[2015-05-19 09:06:43,582] DEBUG - InMediator End : In mediator
[2015-05-19 09:06:43,582] DEBUG - OutMediator Start : Out mediator
[2015-05-19 09:06:43,583] DEBUG - OutMediator Current message is a request - skipping child mediators
[2015-05-19 09:06:43,583] DEBUG - OutMediator End : Out mediator
[2015-05-19 09:06:43,584] DEBUG - SequenceMediator End : Sequence <main>

有人可以向我解释为什么数据没有回来。我们已经打开了服务所在服务器的端口,即8080端口。

由于

2 个答案:

答案 0 :(得分:0)

您似乎指向ESB中的错误网址。日志显示收到的以下URI消息:/ services / mediate / mediate。由于您的代理名为“搜索”,因此应该是链接/服务/搜索。

另外,我看到你的http端点模板没有采用任何参数,这可能不是你想要的。

发送中介应该看起来像这样:

<inSequence>
   <!-- Assigns URI-Template var to some value. You could use an expression here too -->
   <property name="uri.var.search" value="test"/>
</inSequence>
<outSequence>
    <send/>
</outSequence>
<endpoint>
    <html uri-template="http://52.24.50.197:8080/search?q={uri.var.search}" method="GET"/>
</endpoint>

答案 1 :(得分:0)

而是在代理外部定义您的端点,因此在ESB主控制台中创建您的端点:

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
            <http uri-template="http://{uri.var.ip}:8080/{uri.var.servicepath} method="GET">
            </http>
</endpoint>

然后试试这个代理:

<?xml version="1.0" encoding="UTF-8"?>
       <proxy xmlns="http://ws.apache.org/ns/synapse" name="search"
        transports="https,http,local"
        statistics="disable"
        trace="disable"
        startOnLoad="true">
        <target>
        <inSequence>
            <property name="uri.var.ip" value="52.24.50.197"/>
            <property name="uri.var.servicepath" value="search"/>
            <send>
                <endpoint key="MyHTTPEndpoint"/>
            </send>
        </inSequence>
        <outSequence>
          <respond/>
        </outSequence>
        <faultSequence>
          <log level="full" category="DEBUG"/>
        </faultSequence>
        </target>    <description/> </proxy>

因此,您将把get请求发送到代理端点,将其转发给服务,并希望显示响应。