2017-05-21 2 views
0

RESTful 매핑에 RESTful을 시도하고 있습니다. WSO2 ESB - 리소스의 속성을 시퀀스에서 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://samples.openweathermap.org/data/2.5/weather?q=London,uk

내가이 자원의 내 소스이다 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>