簡體   English   中英

WSO2 API Manager 1.9.1-路由

[英]WSO2 API Manager 1.9.1 - Routing

WSO2 API Manger中有什么方法可以從請求xml / json(有效負載)中讀取參數值,並基於該值將請求路由到其他后端端點?

您可以嘗試使用中介程序擴展。

API管理器具有針對其接收的API調用請求的默認中介流。 您可以擴展此默認中介流以路由請求。

  1. 首先編寫一個順序文件以更改流程。 采樣順序如下。
 <sequence xmlns="http://ws.apache.org/ns/synapse" name="YahooWeather2"> <property name="YQL" type="Expression" expression="concat('?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22',syn:get-property('uri.var.zipcode'),',',syn:get-property('uri.var.country'),'%22)format=json')"/> <property name="REST_URL_POSTFIX" type="Expression" expression="get-property('YQL')" scope="Axis2"/> </sequence> 
  1. 要將序列文件上傳到APIM,請以admin身份登錄,轉到main-> Resources-> Browse
  2. 轉到/ _system / governance / apimgt / customsequences / in。 從樹上看
  3. 單擊添加資源,上傳您創建的序列文件。
  4. 登錄到API Publisher,選擇api,然后單擊“ 編輯”,然后轉到“ 管理”選項卡。
  5. 單擊Check復選框, 以選擇要在消息流中執行的自定義序列,然后在In Flow下拉列表中選擇您的序列( 例如 YahooWeather2 )並執行Save&Publish
  6. 登錄到API存儲並訂閱api並生成訪問令牌。

您可以從API存儲區中的API控制台檢查可用性。 有關更多詳細信息,請參閱https://docs.wso2.com/display/AM191/Change+the+Default+Mediation+Flow+of+API+Requests

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM