向外界公开WebService API以实现通用访问

发布于 2024-11-09 02:14:54 字数 373 浏览 0 评论 0原文

我想为我的基于网络的服务实现一个 API。 我一直在寻找方法来做到这一点,但所有的选择似乎都有点让人不知所措。

  • ASP.NET WebService .asmx(看起来不错)
  • XML-RPC.NET(我认为这个看起来不错,但不确定是否已更新,或者需要更新)
  • WCF WebService WSDL(看起来确实很重,可能不是 对于外部用户来说编写起来非常简单 如果他们不使用.NET,则反对)
  • 还有什么我不知道的吗?

我设想该服务的工作方式是调用 api 的用户需要登录,并且登录函数返回某种令牌,需要将其包含在每个后续请求中。

我希望任何语言都能轻松使用该服务。

您的想法和建议将不胜感激。

I would like to implement an API for my web based service.
I've been looking around at ways to do this, but all the choices seems slightly overwhelming.

  • ASP.NET WebService .asmx (Seems okay)
  • XML-RPC.NET (I think this one seems good, but not sure if its updated, or needs updating)
  • WCF WebService WSDL (Seems really heavy and might not be
    so simple for external users to write
    against if they're not using .NET)
  • Something else I am not aware of?

The way I envisage the service to work is that the user calling the api will need to login, and the login function returns some sort of token which needs to be included with each subsequent request.

I would like the service to be easily consumed by any language.

Your thoughts and suggestions would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怂人 2024-11-16 02:14:54

这实际上取决于你的需要,但我会把它扔掉......
考虑使用 REST 风格的 API
http://en.wikipedia.org/wiki/Representational_State_Transfer

优点是简单,通常是整体后端调用可以用简单的 URL 来描述。然而,您不想对“REST 方式”迂腐。 (例如,严格的 REST 表示“GETS 是幂等的”)。它还强加了严格的资源层次结构。只要您灵活,它仍然是一个很好的设计,因为您不需要繁重的支持工具来使用它。

It really depends on what you're needs are but I'll throw this out...
Consider doing a REST-style API
http://en.wikipedia.org/wiki/Representational_State_Transfer

The advantage is simplicity, usually the whole backend call can be described in a simple URL. However you don't want to be pedantic about the "REST way". (ex. strict REST says "GETS are idempotent). It also imposes a strict hierarchy of resources. As long as you're flexible it's still a nice design because you don't need heavy support tools to work with it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文