Home > Mobile >  wso2am 4.0.0 automatically soap to rest conversion problem
wso2am 4.0.0 automatically soap to rest conversion problem

Time:04-09

I have a SOAP service. With WSO2 API Manager, I made a REST API automatically from it. All functions work except one; when I use the below command, my soap service does not get the number 2 and gets 0.

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

It is what wso2am 4.0.0 made automatically:

<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"/>

My service works when I send this one. The server gets number 2 and responds with user 2 data.

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>'

CodePudding user response:

In payloadFactory, I modified

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

to

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

and it works.

  • Related