apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
14.42k stars 2.5k forks source link

help request: Body-transformer plugin template configuration issue #11556

Open Loyal1996 opened 1 month ago

Loyal1996 commented 1 month ago

Description

I encountered a problem when configuring the body-transformer template, and I really can't solve it.

content

MyCat{name='org', age=1, catBir=Sat Sep 07 00:00:00 CST 2024} template rsp_template=$(cat <' expected near 'return' while sending to client, client: 192.168.4.107, server: _, request: "POST /webService/CatService HTTP/1.1", upstream: "http://192.168.58.221:8026/webService/CatService", host: "192.168.66.54:9080" How do I get this return field? "return":"{{Envelope.Body.messageResponse.return}}" ### Environment - APISIX version (run `apisix version`): - Operating system (run `uname -a`): - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): - APISIX Dashboard version, if relevant: - Plugin runner version, for issues related to plugin runners: - LuaRocks version, for installation issues (run `luarocks --version`):
shreemaan-abhishek commented 3 weeks ago

maybe the error is due to return field not being present in the xml response?

Loyal1996 commented 3 weeks ago

maybe the error is due to return field not being present in the xml response?

the xml response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:findNameByageResponse xmlns:ns2="http://server.webservice.topwalk.com">
         <return>hello</return>
         <return>world</return>
      </ns2:findNameByageResponse>
   </soap:Body>
</soap:Envelope>

or

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:messageResponse xmlns:ns2="http://server.webservice.com">
         <return>MyCat{name='org', age=1, catBir=Sat Sep 07 00:00:00 CST 2024}</return>
      </ns2:messageResponse>
   </soap:Body>
</soap:Envelope>