我有一個 SOAP 服務。使用 WSO2 API Manager,我自動創建了一個 REST API。除一個外,所有功能都有效;當我使用下面的命令時,我的肥皂服務沒有得到數字 2 而是得到 0。
curl -X GET 'http://localhost:8280/rest/2/getUser?arg0=2' \
-H 'accept: application/json' \
-H 'Internal-Key: S.TH.'
這是 wso2am 4.0.0 自動生成的:
<header description="SOAPAction" name="SOAPAction" scope="transport" value=""/>
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
<property expression="$url:arg0" name="req.var.arg0"/>
<payloadFactory description="transform" media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://user.ws.xxx.com/">
<soapenv:Header/>
<soapenv:Body>
<web:getUser xmlns:web="http://user.ws.xxx.com/">
<web:arg0>$1</web:arg0>
</web:getUser>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('req.var.arg0')"/>
</args>
</payloadFactory>
<property description="messageProperty" name="messageType" scope="axis2" type="STRING" value="application/soap xml"/>
當我發送此服務時,我的服務有效。服務器獲取數字 2 并以用戶 2 資料回應。
curl -X POST "http://localhost:9090/user-service" \
-H 'Content-Type: application/soap xml;charset=UTF-8' \
-d '
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:user="http://user.ws.xxx.com/">
<soap:Header/>
<soap:Body>
<user:getUser>
<arg0>2</arg0>
</user:getUser>
</soap:Body>
</soap:Envelope>'
uj5u.com熱心網友回復:
在payloadFactory中,我修改了
<web:arg0>$1</web:arg0>
到
<arg0 xmlns="">$1</arg0>
它有效。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/460110.html
