如何配置WSO2 API以访问rails REST json Web服务

时间:2013-11-15 00:11:04

标签: json api rest wso2 wso2esb

我有一个rails应用程序暴露了一个休息的json界面,如:http://foo.com/agency/:name.json 我写了一个wso2 esb api配置来访问api

   <api name="agency" context="/agency">
      <resource methods="GET" uri-template="/view/{name}">
         <inSequence>
            <property name="REST_URL_POSTFIX"
                      expression="fn:concat('/',get-property('uri.var.name'), '.json')"
                      scope="axis2"/>
            <send>
               <endpoint>
                  <address uri="http://foo.com/agency/" format="pox"/>
               </endpoint>
            </send>
         </inSequence>
         <outSequence>
            <send/>
         </outSequence>
      </resource>
   </api>

当我使用curl测试wso2 esb api时,我得到了

\dev\curl-w32>curl http://192.168.181.132:8280/agency/view/blah-blah
curl: (52) Empty reply from server

ESB日志写

[2013-11-14 16:17:49,047]  INFO - LogMediator To: /agency/view/blah-blah, MessageID: urn:uuid:d0a4c4ec-7600-430d-bb52-e580b
6ec2516, Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR
_CODE = 101500, ERROR_MESSAGE = Error in Sender, Envelope: <?xml version='1.0' e
ncoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap
-envelope"><soapenv:Body/></soapenv:Envelope>
[2013-11-14 16:18:49,063]  WARN - SourceHandler Connection time out after reques
t is read: http-incoming-48

似乎端点网址翻译不起作用。

如何更正我的API配置以使其正常工作?谢谢

1 个答案:

答案 0 :(得分:0)

尝试将scope =“axis2”更改为scope =“transport”并从地址端点中删除format =“pox”。