2017-05-21 48 views
0

我試圖將RESTful轉換爲RESTful映射。我的終點是http://samples.openweathermap.org/data/2.5/weather?q=London,ukWSO2 ESB - 如何使用資源的屬性作爲URL參數在序列中

而且我把它映射到 http://localhost:8080/get_weather/uk/London

這是資源的我的源代碼視圖,

<api name="API_1" context="get_weather" hostname="http://localhost" port="8080"> 
    <resource method="GET" uri-template="/{p1}/{p2}/"> 
     <inSequence> 
      <log level="custom"> 
       <property name="param1" expression="get-property('uri.var.p1')" /> 
       <property name="param2" expression="get-property('uri.var.p2')" /> 
      </log> 
      <send> 
       <endpoint key="http://samples.openweathermap.org/data/2.5/weather?q{param2},{param1}" /> 
      </send> 
     </inSequence> 
    </resource> 
</api> 

最後我將使用curl發出請求

curl -i -H "Accept: application/json" -X GET http://localhost:8080/get_weather/uk/London 

如何使用endpoint中的日誌參數?

回答

0

嘗試用這樣的事情:

<send> 
    <endpoint> 
    <http method="GET" uri-template="http://samples.openweathermap.org/data/2.5/weather?q={uri.var.p2},{uri.var.p1}"/> 
    </endpoint> 
</send>