guipengfei opened a new issue, #11287:
URL: https://github.com/apache/apisix/issues/11287

   ### Description
   
   **A simple SOAP proxy, Here is my route configuration is working properly**
   
   `{
     "uri": "/platform/wsdl/test",
     "name": "platform-wsdl-test",
     "methods": [
       "POST"
     ],
     "plugins": {
       "body-transformer": {
         "request": {
           "template": "<soapenv:Envelope 
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"; 
xmlns:ns=\"http://www.omg.org/IDL-WSDL/1.0/\";><soapenv:Header/><soapenv:Body><ns:test><username>{{username}}</username><age>{{age}}</age></ns:test></soapenv:Body></soapenv:Envelope>"
         },
         "response": {
           "input_format": "xml",
           "template": "{% if Envelope.Body.Fault == nil then 
%}{\"code\":\"SUCCESS\",\"message\":null,\"data\":{*_escape_json(Envelope.Body.testResponse._return)*}}{%
 else 
%}{\"code\":\"{{_ctx.var.status}}\",\"message\":\"{{Envelope.Body.Fault.faultstring}}\",\"faultDetail\":{*_escape_json(Envelope.Body.Fault)*}}{%
 end %}"
         }
       },
       "proxy-rewrite": {
         "headers": {
           "set": {
             "Accept-Encoding": "identity",
             "Content-Type": "text/xml;charset=utf-8",
             "SOAPAction": "TestServiceManager#test"
           }
         },
         "regex_uri": [
           "/platform/wsdl/test",
           "/TestServiceManager/SN"
         ]
       },
       "response-rewrite": {
         "headers": {
           "set": {
             "Content-Type": "application/json"
           }
         }
       }
     },
     "upstream_id": "514896707306128334",
     "status": 1
   }`
   
   
   **1. The request template is too fixed and needs to specify each parameter, 
the original request body is a json,  How to convert json to xml in one go ?** 
   Similar to the response body, I can use the `_escape_json()` method to 
convert xml to json. `_escape_xml()` method does not do this, how to achieve 
this ?
   
   **2. Can I get the request header parameters in the request.template and 
response.template ?**
   This way, I can get the SOAPAction parameter of the header dynamically, and 
the method name in the template is not fixed
   
   ### Environment
   
   - APISIX version (3.2.0):
   - Operating system (3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 
2020 x86_64 x86_64 x86_64 GNU/Linux):
   - OpenResty / Nginx version (openresty/1.21.4.1):
   - etcd version, if relevant (3.5.0):
   - APISIX Dashboard version, if relevant: 3.0.0


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

Reply via email to