{"id":21970819,"url":"https://github.com/kingluo/lua-resty-ffi-soap","last_synced_at":"2026-05-06T10:36:00.251Z","repository":{"id":185026108,"uuid":"658033439","full_name":"kingluo/lua-resty-ffi-soap","owner":"kingluo","description":"The openresty SOAP to REST library based on zeep.","archived":false,"fork":false,"pushed_at":"2023-06-24T16:29:54.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T12:30:45.547Z","etag":null,"topics":["luajit","nginx","openresty","python3","restful","soap","soap-client","zeep"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kingluo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-24T15:00:28.000Z","updated_at":"2024-05-14T08:32:53.000Z","dependencies_parsed_at":"2023-07-31T12:49:48.597Z","dependency_job_id":null,"html_url":"https://github.com/kingluo/lua-resty-ffi-soap","commit_stats":null,"previous_names":["kingluo/lua-resty-ffi-soap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kingluo/lua-resty-ffi-soap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingluo%2Flua-resty-ffi-soap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingluo%2Flua-resty-ffi-soap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingluo%2Flua-resty-ffi-soap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingluo%2Flua-resty-ffi-soap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kingluo","download_url":"https://codeload.github.com/kingluo/lua-resty-ffi-soap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingluo%2Flua-resty-ffi-soap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32689263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["luajit","nginx","openresty","python3","restful","soap","soap-client","zeep"],"created_at":"2024-11-29T14:43:12.901Z","updated_at":"2026-05-06T10:36:00.223Z","avatar_url":"https://github.com/kingluo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lua-resty-ffi-soap\n\nThe openresty SOAP to REST library based on [zeep](https://docs.python-zeep.org/en/master/).\n\n\u003e Zeep inspects the WSDL document and generates the corresponding code to use the services and types in the document. This provides an easy to use programmatic interface to a SOAP server.\n\n![SOAP to REST Architecture](soap.jpg)\n\n**Callflow:**\n\n![SOAP to REST Call Flow](soap_callflow.svg)\n\nhttps://docs.python-zeep.org/en/master/client.html#the-serviceproxy-object\n\n\u003e The ServiceProxy object is a simple object which will check if an operation exists for attribute or item requested. If the operation exists then it will return an OperationProxy object (callable) which is responsible for calling the operation on the binding.\n\n**Highlights:**\n\n* no conversion template, no WSDL compile, zero code\n\n  Almost all gateway products that support SOAP-to-REST require you to write transformation templates for requests and responses,\ne.g. [tyk](https://tyk.io/docs/advanced-configuration/transform-traffic/soap-rest/), [Gloo Edge](https://docs.solo.io/gloo-edge/latest/guides/traffic_management/request_processing/transformations/xslt_transformation/). However, zeep can free you from such manual work. It provides a one-to-one mapping between JSON and SOAP for requests and responses.\n\n* fully asynchronous\n\n[lua-resty-ffi](https://github.com/kingluo/lua-resty-ffi) provides an efficient and generic API to do hybrid programming\nin openresty with mainstream languages (Go, Python, Java, Rust, Nodejs).\n\n**lua-resty-ffi-soap = lua-resty-ffi + zeep**\n\n## Synopsis\n\n**Client Config:**\n\n* wsdl_url: WSDL URL, could be any valid URL, https scheme or not\n\n```lua\nlocal client, err = soap.new({\n    wsdl_url = \"http://localhost:8080/ws?wsdl=foobar\",\n})\n```\n\n**Call Operation:**\n\n* operation: operation name\n* body: an JSON-serializable table\n\n```lua\nlocal ok, res, err = client:do({\n    operation = \"foobar\",\n    body = {\n        foo = \"bar\",\n        bar = 6,\n    }\n})\n```\n\n**Operation Result:**\n\nOne of below fields:\n\n* response: an JSON-serializable table, which represents the normal response\n* fault: an JSON-serializable table, which represents the fault\n\nResponse example:\n\n```xml\n\u003cSOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003cSOAP-ENV:Header\u003e\u003c/SOAP-ENV:Header\u003e\n  \u003cSOAP-ENV:Body\u003e\n    \u003cns2:getCountryResponse xmlns:ns2=\"http://spring.io/guides/gs-producing-web-service\"\u003e\n      \u003cns2:country\u003e\n        \u003cns2:name\u003eSpain\u003c/ns2:name\u003e\n        \u003cns2:population\u003e46704314\u003c/ns2:population\u003e\n        \u003cns2:capital\u003eMadrid\u003c/ns2:capital\u003e\n        \u003cns2:currency\u003eEUR\u003c/ns2:currency\u003e\n      \u003c/ns2:country\u003e\n    \u003c/ns2:getCountryResponse\u003e\n  \u003c/SOAP-ENV:Body\u003e\n\u003c/SOAP-ENV:Envelope\u003e\n```\n\noutput lua table:\n\n```lua\n{\n  response = {\n    capital = \"Madrid\",\n    currency = \"EUR\",\n    name = \"Spain\",\n    population = 46704314\n  },\n}\n```\n\nFault example:\n\n```xml\n\u003cSOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n  \u003cSOAP-ENV:Header\u003e\u003c/SOAP-ENV:Header\u003e\n  \u003cSOAP-ENV:Body\u003e\n    \u003cSOAP-ENV:Fault\u003e\n      \u003cfaultcode\u003eSOAP-ENV:Server\u003c/faultcode\u003e\n      \u003cfaultstring xml:lang=\"en\"\u003eYour name is required.\u003c/faultstring\u003e\n    \u003c/SOAP-ENV:Fault\u003e\n  \u003c/SOAP-ENV:Body\u003e\n\u003c/SOAP-ENV:Envelope\u003e\n```\n\noutput lua table:\n\n```lua\n{\n  fault = {\n    message = \"Your name is required.\",\n    code = \"SOAP-ENV:Server\",\n  },\n}\n```\n\n## Demo\n\n### Setup lua-resty-ffi-soap\n\n```bash\n# install lua-resty-ffi\n# https://github.com/kingluo/lua-resty-ffi#install-lua-resty-ffi-via-luarocks\n# set `OR_SRC` to your openresty source path\nluarocks config variables.OR_SRC /tmp/tmp.Z2UhJbO1Si/openresty-1.21.4.1\nluarocks install lua-resty-ffi\n\n# make lua-resty-ffi python loader library\napt install python3-dev python3-pip libffi-dev\ncd /opt\ngit clone https://github.com/kingluo/lua-resty-ffi\ncd /opt/lua-resty-ffi/examples/python\nmake\n\n# install deps\ncd /opt\ngit clone https://github.com/kingluo/lua-resty-ffi-soap\ncd /opt/lua-resty-ffi-soap\npip3 install -r requirements.txt\n\n# run nginx\ncd /opt/lua-resty-ffi-soap/demo\nPATH=/opt/resty_ffi/nginx/sbin/:$PATH \\\nLD_LIBRARY_PATH=/opt/lua-resty-ffi/examples/python:/usr/local/lib/lua/5.1 \\\nPYTHONPATH=/opt/lua-resty-ffi-soap \\\nnginx -p $PWD -c nginx.conf\n\n# run WebService demo\napt install openjdk-17-jdk\ngit clone https://github.com/spring-guides/gs-soap-service.git\ncd gs-soap-service/complete\n./mvnw spring-boot:run\n```\n\n### Create client\n\n```bash\ncurl http://localhost:20000/create_client -X POST -d '{\n    \"wsdl_url\": \"http://localhost:8080/ws/countries.wsdl\",\n}' -s | jq\n```\n\nouput:\n\n```json\n{\n  \"client\": 1\n}\n```\n\n### Call getCountry operation\n\n```bash\ncurl 'http://localhost:20000/operation?client=1\u0026operation=getCountry' -X POST \\\n-d '{\"name\": \"Spain\"}' -s | jq\n```\n\noutput:\n\n```json\n{\n  \"response\": {\n    \"currency\": \"EUR\",\n    \"population\": 46704314,\n    \"capital\": \"Madrid\",\n    \"name\": \"Spain\"\n  }\n}\n```\n\n### Close client\n\n```bash\ncurl http://localhost:20000/close_client?client=1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingluo%2Flua-resty-ffi-soap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingluo%2Flua-resty-ffi-soap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingluo%2Flua-resty-ffi-soap/lists"}