sanjivkamate opened a new issue, #9911: URL: https://github.com/apache/apisix/issues/9911
### Current Behavior Hi, I am currently integrating SOAP webservice using body-transformer plugin in APASIX 3.4 but getting an encoded response in error.log **Route definition** curl http://127.0.0.1:9180/apisix/admin/routes/test_ws -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "methods": ["POST"], "uri": "/calculator.asmx", "plugins": { "proxy-rewrite": { "host": "dneonline.com", "use_real_request_uri_unsafe": false, "headers": { "set": { "Accept-Encoding": "gzip, deflate, br", "Content-Type": "text/xml", "SOAPAction":"http://tempuri.org/Add" } } }, "response-rewrite": { "body_base64": false, "headers": { "set": { "Content-Type": "application/json" } } }, "body-transformer": { "request": { "template": "<?xml version=\"1.0\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\"><soapenv:Header/><soapenv:Body><tem:Add><tem:intA>{{_escape_xml(add1)}}</tem:intA><tem:intB>{{_escape_xml(add2)}}</tem:intB></tem:Add></soapenv:Body></soapenv:Envelope>" }, "response": { "template": "{% if Envelope.Body.Fault == nil then %}{\"currency\":\"{{Envelope.Body.AddResponse.AddResult}}\"}{% else %}{\"message\":{*_escape_json(Envelope.Body.Fault.faultstring[1])*},\"code\":\"{{Envelope.Body.Fault.faultcode}}\"{% if Envelope.Body.Fault.faultactor ~= nil then %}, \"actor\":\"{{Envelope.Body.Fault.faultactor}}\"{% end %}}{% end %}" } } }, "upstream": { "type": "roundrobin", "nodes": { "www.dneonline.com:80": 1 } } }' Please note the SOAP web service is hosted over the internet and working fine.  ### Expected Behavior Success response in the form of JSON ### Error Logs 2023/07/26 10:11:31 [error] 1334951#1334951: *523074 [lua] body-transformer.lua:153: transform(): response template rendering: [string "context=... or {}..."]:5: attempt to index global 'Envelope' (a nil value) while sending to client, client: 49.36.105.172, server: _, request: "POST /calculator.asmx HTTP/1.1", upstream: "http://50.62.168.5:80/calculator.asmx", host: "103.13.113.61:9080" 2023/07/26 10:11:31 [error] 1334951#1334951: *523074 [lua] body-transformer.lua:214: phase_func(): failed to transform response body: ????????t5л???C(???9???/??*????????????]?ﹷ?gT??1?/66V?2?:????`0Ǚ???`0 s?3"?Q8,???=??B?Z ݁?q???0??ִ b/?ӿ??d?z?e?Z ??̓?d?9Nj??^????g?????`~Z?f .<?=s????9(?0?L ?L6?G:0PF3 while sending to client, client: 49.36.105.172, server: _, request: "POST /calculator.asmx HTTP/1.1", upstream: "http://50.62.168.5:80/calculator.asmx", host: "103.13.113.61:9080" ### Steps to Reproduce 1. Run APISIX using RPM on Linux server 2. Create route via CMD ### Environment - APISIX version - 3.4.1 - Operating system - Linux finexta.in 5.4.17-2136.312.3.4.el8uek.x86_64 #2 SMP Wed Oct 19 17:42:16 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux - OpenResty / Nginx version - openresty/1.21.4.1 - etcd version, if relevant - "etcd_version":"3.5.0","version":"3.4.1","id":"b9812f90-578b-46eb-b6a1-99ea13bcbc6b","hostname":"finexta.in","boot_time":1690378304} - APISIX Dashboard version, if relevant: - Plugin runner version, for issues related to plugin runners: - LuaRocks version, for installation issues - luarocks: command not found (Not sure if this is relevant) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
