2013-11-15 24 views
0

我有一個Rails應用程序暴露就像一個休息JSON接口:http://foo.com/agency/:name.json 我已經寫了WSO2 ESB API配置訪問API如何配置WSO2 API訪問軌REST JSON網絡服務

<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 

似乎端點url翻譯不起作用。

如何糾正我的API配置,使其工作? Thx

回答

0

嘗試將scope =「axis2」更改爲scope =「transport」並從地址端點刪除format =「pox」。