简体   繁体   English

如何为使用 fastapi python 编写的 rest 服务生成 WADL?

[英]How to generate WADL for rest service written with fastapi python?

The developer who will interact with my web service will require a wsdl.与我的 web 服务交互的开发人员将需要 wsdl。 As I understand it, wsdl is for the soap service, and wadl for my rest service.据我了解,wsdl 用于 soap 服务,而 wadl 用于我的 rest 服务。 The web service has already been written. web 服务已经写好了。 How can I get/generate this file?如何获取/生成此文件?

So, you've just bumped the REST vs SOAP conundrum.因此,您刚刚遇到了RESTSOAP的难题。 =) =)

There is no practical way to generate a WSDL description for a REST service.没有实用的方法可以为 REST 服务生成 WSDL 描述。

But again, there is not really a good reason to do that, since they're consumed differently.但同样,没有一个很好的理由这样做,因为它们的消费方式不同。

Your options are:您的选择是:

  • explain to the developer who will use your web service that this is a REST service (and not SOAP)向将使用您的 web 服务的开发人员解释这是 REST 服务(而不是 SOAP)
  • write a SOAP version of your service编写您的服务的 SOAP 版本

In either case, you want to document and possibly give examples on how to consume the service.无论哪种情况,您都希望记录并可能提供有关如何使用服务的示例。 FastAPI already helps to do that with the /docs page, but you may need to better document how it's supposed to be used. FastAPI 已经通过/docs页面帮助做到这一点,但您可能需要更好地记录它应该如何使用。

Good luck!祝你好运!

Read more阅读更多

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

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