我想要一個post API(wso2 APIm v1.9),要求是將動態應用程序/ xml有效載荷傳遞給後端服務url。json請求的payloadfactory配置
我從API控制檯和api突觸配置,然後使用PayloadFactory中介傳遞json有效載荷,我已創建動態有效載荷,這將傳遞到服務端點。
PayloadFactory配置附有和標籤:
<payloadFactory media-type="xml">
<format>
<input>
<Param>$1</Param>
</input>
</format>
<args>
<arg evaluator="json" expression="$."/> //passing like this since the json payload is massive.
</args>
</payloadFactory>
在測試API,讓下面的錯誤 API控制檯響應:
<am:fault xmlns:am="http://wso2.org/apimanager">
<am:code>404</am:code>
<am:type>Status report</am:type>
<am:message>Runtime Error</am:message>
<am:description>Production key offered to the API with no production endpoint</am:description>
</am:fault>
能否請您檢查,並提出什麼是我的配置問題。
API配置:
<resource methods="POST"
uri-template="/sample/{id}/sub"
faultSequence="fault">
<inSequence>
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
<then>
<property name="api.ut.backendRequestTime"
expression="get-property('SYSTEM_TIME')"/>
<property name="Authorization"
expression="fn:concat('Basic ', 'dXNlcjp1c2Vy')"
scope="transport"/>
<property name="messageType" value="application/xml" scope="axis2"/>
<payloadFactory media-type="xml">
<format>
<input>
<newParam>$1</newParam>
</input>
</format>
<args>
<arg evaluator="json" expression="$."/>
</args>
</payloadFactory>
<property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
<send>
<endpoint name="admin--Test_APIproductionEndpoint_0">
<http uri-template="http://xxxx:8181/ValidateWAR/getValidate/validate"/>
<property name="Content-Type" value="application/xml" scope="transport"/>
</endpoint>
</send>
</then>
<else>
<sequence key="_sandbox_key_error_"/>
</else>
</filter>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
感謝您對這個快速反應。
問候, 作爲