Web Services wso2am 4.0.0自动soap到rest的转换问题

plupiseo  于 2022-11-15  发布在  其他
关注(0)|答案(1)|浏览(119)

我有一个SOAP服务,用WSO 2API管理器自动生成了一个RESTAPI,除了一个函数外,其他函数都正常;当我使用下面的命令时,我的soap服务没有得到数字2,而是得到了0。

curl -X GET 'http://localhost:8280/rest/2/getUser?arg0=2' \
  -H 'accept: application/json' \
  -H 'Internal-Key: S.TH.'

它是wso 2am 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>'
0qx6xfy6

0qx6xfy61#

在payloadFactory中,我修改了

<web:arg0>$1</web:arg0>

<arg0 xmlns="">$1</arg0>

而且很管用。

相关问题