WSO2 ESB - REST API - 响应不来 [英] WSO2 ESB - REST API - Response Does Not Come
问题描述
我在 wso2 esb 中使用
公开了一个 REST 服务.但回应并没有到来.REST 服务是用 Apache Wink 编写的.
I have exposed a REST service using <api>
in wso2 esb. But the response does not come. REST service is written in Apache Wink.
API
<api name="API_2" context="/hello" hostname="localhost" port="8080">
<resource url-mapping="/name" methods="GET">
<inSequence>
<log level="full"/>
<property name="messageType" value="text/plain" scope="transport" type="STRING"/>
<send>
<endpoint>
<address uri="http://localhost:8080/HelloService/rest/test/hello"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<send/>
</outSequence>
</resource>
</api>
esb 日志
[2013-12-11 12:28:24,643] INFO - API Initializing API: API_2
[2013-12-11 12:28:35,467] INFO - LogMediator To: /hello/name, MessageID: urn:uuid:52d2ddf1-301e-42e0-ac9d-ac4a57ac8c72, Direction: request
推荐答案
我觉得你的端点地址有误,看起来你重复了两次.因为您在代理名称中有 hello 也将附加到 URL.
I think your endpoint address is wrong , look like you have repeat hello twice. since you have hello in proxy name also which will append to URL.
尝试
您也可以通过在单独的浏览器中调用uri + url-mapping"来验证您的后端工作
Also You can verify your backend works by calling "uri + url-mapping" in separate browser
我在下面展示了适用于我的示例 API,您应该如下调用您的 API,并且日志将打印如下.
I have shown sample API works for me below, you should have called your API as below and log will print as below.
调用网址:http://localhost:8280/TestAPI/customerservice/customers/123
信息 - LogMediator 到:/TestAPI/customerservice/customers/123
INFO - LogMediator To: /TestAPI/customerservice/customers/123
<api xmlns="http://ws.apache.org/ns/synapse" name="TestAPI" context="/TestAPI">
<resource methods="GET" url-mapping="/customerservice/customers/123">
<inSequence>
<log/>
<send>
<endpoint>
<address uri="http://localhost:9764/jaxrs_basic/services/customers"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log/>
<send/>
</outSequence>
</resource>
</api>
这篇关于WSO2 ESB - REST API - 响应不来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!