2017-05-21 6 views
0

RESTfulなマッピングをRESTfulにしようとしています。私のエンドポイントはhttp://samples.openweathermap.org/data/2.5/weather?q=London,ukWSO2 ESB - リソースのプロパティをIn SequenceのURLパラメータとして使用する方法

であると私は

<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に使用しますが、これは、リソースの私のソースビューで http://localhost:8080/get_weather/uk/London

にマッピングよ

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> 
関連する問題