简体   繁体   English

Azure Function v1 作为 SOAP 端点

[英]Azure Function v1 as SOAP endpoint

I have an azure function app (v1, with no possibility for upgrading, unfortunately) with an endpoint receiving JSON via POST requests, doing some computation and returning JSON in the response. I have an azure function app (v1, with no possibility for upgrading, unfortunately) with an endpoint receiving JSON via POST requests, doing some computation and returning JSON in the response. This endpoint needs to be made SOAP-compatible, meaning that it should receive SOAP requests and return SOAP responses and also be able to provide a WSDL file.此端点需要与 SOAP 兼容,这意味着它应该接收 SOAP 请求并返回 SOAP 响应,并且还能够提供 WSDL 文件。

Using the SOAP mapper in API Management is not an option, due to its limitations.由于其限制,在 API 管理中使用 SOAP 映射器不是一个选项。

The methods I have tried are:我尝试过的方法是:

  1. Create a WCF service and try to delegate the HTTP request to it from the Azure function endpoint.创建一个 WCF 服务并尝试将 HTTP 请求从 Azure ZC1C425268E68385D114 端点委托给它。 This didn't seem to work because the corresponding handler in WCF can only receive a request via its own HTTP endpoint (which does not seem to be exposable via the azure function endpoint), but cannot be called from within the code. This didn't seem to work because the corresponding handler in WCF can only receive a request via its own HTTP endpoint (which does not seem to be exposable via the azure function endpoint), but cannot be called from within the code.

  2. Use an ASP.net web application with SoapCore as a starting point and try to migrate it to an azure function.使用以SoapCore为起点的 ASP.net web 应用程序,并尝试将其迁移到 azure ZC1C4145268E17A47. This doesn't seem possible because of a completely different structure.由于结构完全不同,这似乎是不可能的。 SoapCore is attached to the ASP.net app instance as a middleware, whereas azure function does not provide the means to use middleware. SoapCore 作为中间件附加到 ASP.net 应用程序实例,而 azure function 不提供使用中间件的方法。

  3. Parse the SOAP request manually, convert it to JSON, do the computation, convert the result back to a SOAP message and return it.手动解析 SOAP 请求,将其转换为 JSON,进行计算,将结果转换回 SOAP 消息并返回。 The seems very hacky and also the WSDL must be created and served manually.看起来很老套,而且 WSDL 必须手动创建和提供。 Despite these drawbacks, I'm leaning towards this solution because of the unfeasibility of the first two.尽管有这些缺点,我还是倾向于这个解决方案,因为前两个是不可行的。

Is there any other possible solution that I have might missed?还有其他我可能错过的解决方案吗?

If you are using Azure API Management, then below option works;如果您使用 Azure API 管理,则以下选项有效;

You can write transformation policies at the service or endpoint level - JSON to SOAP refer: https://docs.microsoft.com/en-us/azure/api-management/api-management-transformation-policies#convert-json-to-soap-using-a-liquid-template您可以在服务或终结点级别编写转换策略 - JSON 到 SOAP 参考: https://docs.microsoft.com/en-us/azure/apicies-convert-管理-soap-using-a-liquid-template

Also refer this link Expose REST API as SOAP via Azure API Management would help. Also refer this link Expose REST API as SOAP via Azure API Management would help.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM