简体   繁体   English

提供HTTP接口

[英]providing HTTP interface

I am working on a task which basically is "Providing HTTP interface and move out of TCP". 我正在执行的任务基本上是“提供HTTP接口并退出TCP”。 Thats what I know so far. 那就是我到目前为止所知道的。

What I am looking for is: 我正在寻找的是:

1] "Providing HTTP interface" What does this translate to exactly. 1]“提供HTTP接口”这到底是什么意思。 I mean after achieving what steps I can conclude that this task to be done ? 我的意思是说,在完成了哪些步骤之后,我可以断定要完成此任务?

2] What more information/questions I need to understand/ask for getting this done. 2]要完成此任务,我还需要了解/询问哪些其他信息/问题。

What I am trying to do is understand the problem space better and also look for any solutions[patterns] widely used to fix this in the "right" way. 我正在尝试做的是更好地理解问题空间,并寻找广泛用于以“正确”方式解决此问题的解决方案[模式]。

Any suggestions/pointers would be great. 任何建议/指针都很好。

Thankx. 谢谢。

Obviously you're being asked to migrate a service currently offered through a proprietary application protocol served over TCP/IP. 显然,系统要求您迁移当前通过通过TCP / IP提供的专有应用程序协议提供的服务。

As a member pointed already, you will never "move out of TCP" since the HTTP version is highly probable to use TCP/IP anyway. 正如成员已经指出的那样,因为HTTP版本极有可能使用TCP / IP,所以您永远不会“移出TCP”。 But we all understand what your boss/client is trying to say. 但是我们都知道您的老板/客户想说些什么。 What is requested is probably a web service as we know it today. 所请求的可能是我们今天所知道的Web服务。 And yes, using HTTP as a basis is the right way to do it. 是的,使用HTTP作为基础是正确的方法。

Knowing that, you are now faced with two alternatives: 知道了这一点,您现在面临两种选择:

1) Present a function-oriented service 1)提供功能导向的服务

Here you list the commands that the service can handle and you implement them following a classical function(argument) => result style. 在这里,您列出了服务可以处理的命令,并按照经典的function(argument) => result样式实现它们。

For this approach I recommend using the JSON-RPC model 对于这种方法,我建议使用JSON-RPC模型

2) Present a data-oriented service 2)提供面向数据的服务

Here you list the information that is moving in and out of your service and implement the operations occurring on these pieces of information, following the REST cycle data OPERATION response 在此,您可以按照REST周期data OPERATION response ,列出正在移入和移出服务的信息,并实施对这些信息data OPERATION response

For this approach I recommend using the REST style 对于这种方法,我建议使用REST样式

How to choose ? 如何选择?

In a nutshell: 简而言之:

  • If you have to serve few clients AND the set of commands is small and simple, go with RPC. 如果您必须为几个客户端提供服务,并且命令集又小又简单,请使用RPC。
  • If you must serve many clients OR the problem domain is complex, go with REST. 如果必须为许多客户提供服务,或者问题域很复杂,请使用REST。

Whatever approach you go for, always prefer JSON over XML unless XML is mandated. 不管采用哪种方法,除非强制要求使用XML,否则始终首选JSON而不是XML。

Is your current process doing raw TCP sockets connections? 您当前的进程是否在进行原始TCP套接字连接?

It almost sounds like they want an HTTP web service instead of raw TCP. 听起来好像他们需要HTTP Web服务而不是原始TCP。

But I think much more information is needed. 但是我认为需要更多信息。

粗略的猜测是某人想要Web前端到现在可能在命令行级别完成的工作...您应该真正询问更多细节,或发布给出的细节。

Providing HTTP interface and move out of TCP 提供HTTP接口并移出TCP

HTTP operates at the application layer of the OSI model , whereas TCP operates at the transport layer. HTTP在OSI模型的应用程序层运行,而TCP在传输层运行。 This basically means that HTTP operates on top of TCP. 这基本上意味着HTTP在TCP之上运行。

What does this translate to exactly 这到底是什么意思

The HTTP 1.1 specification is defined in RFC 2616 . HTTP 1.1规范在RFC 2616中定义。 To be truly HTTP 1.1 compliant, you must implement the protocol as defined in this RFC. 为了真正符合HTTP 1.1,您必须实现此RFC中定义的协议。

What more information/questions I need to understand/ask for getting this done 我需要了解/询问哪些其他信息/问题才能完成此任务

I would also ask what sorts of clients will be connecting to this server (browser, custom client, other services). 我还要问什么样的客户端将连接到该服务器(浏览器,自定义客户端,其他服务)。 Get a specification sheet with as many details as possible and get the client to commit to what functionality they need: there's nothing worse than having to rewrite stuff on a whim because a CEO saw a new acronym in his mailbox this morning. 获取具有尽可能多细节的规格表,并使客户致力于他们所需的功能:没有什么比不得不一时兴起重写东西更糟糕的了,因为首席执行官今天早上在他的邮箱中看到了一个新的缩写词。

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

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