SOAP标头与HTTP标头 [英] SOAP headers versus HTTP headers

查看:227
本文介绍了SOAP标头与HTTP标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个使用Web服务的程序,为此我需要将一些数据包装为消息的标题。

I am working on a program using web services and for that I need to wrap some data as headers for the message.

我想问一下它是否相同将此数据作为SOAP标头或HTTP标头放置?

I want to ask if it is equivalent to place this data as SOAP headers or as HTTP headers?

推荐答案

SOAP标头包含与SOAP消息相关的特定于应用程序的信息。它们通常包含路由信息,
身份验证信息,事务语义等。这些特定于SOAP消息,并且独立于SOAP使用
的传输(在本文的范围内:HTTP)。

The SOAP headers contain application specific information related to the SOAP message. They typically contain routing information, authentication information, transaction semantics etc. These are specific to the SOAP message and are independent of the transport that SOAP uses (in the scope of this post: HTTP).

HTTP标头定义HTTP事务的操作参数,例如传输内容的内容类型,内容长度,客户端或代理的缓存指令等。
这些特定于HTTP并且独立于什么实际上是通过HTTP传输的(在这种情况下是SOAP XML)。

HTTP headers define the operating parameters of the HTTP transaction, like the content type of what's getting transmitted, the content length of it, cache directives for clients or proxies etc. These are specific to HTTP and are independent on what actually gets transmitted with HTTP (in this case the SOAP XML).

当然,您可以使用HTTP头或SOAP头来提供有关SOAP的应用程序特定信息信息。
SOAPAction HTTP标头是一个进展SOAP 1.1的这个方向。虽然服务器有效地路由消息是有用的,而不需要查看
SOAP XML(如果消息被加密并且只有最终接收者知道如何解密它,有时是不可能的),这通常会导致混淆,后来删除
SOAP 1.2(在其位置是 action 参数rfc3902.txtrel =noreferrer> application / soap + xml media type ,这也是HTTP标题中的一个值......哦。 ..:D)。

You could, of course, use both HTTP headers or SOAP headers to provide application specific information about the SOAP message. The SOAPAction HTTP header was a move in this direction for SOAP 1.1. Although it was useful for servers to efficiently route the messages without the need to look inside the SOAP XML (sometimes impossible if the message is encrypted and only the final receiver knows how to decrypt it) it mostly caused confusion and was later removed in SOAP 1.2 (and in its place is an optional action parameter on the application/soap+xml media type, which again is a value in the HTTP headers... oh well... :D).

总之, SOAP标头和HTTP标头不一样。虽然在某种程度上您可能会将SOAP标头替换为用户定义的自定义HTTP标头,但大多数情况下这是一个坏主意。

As a conclusion, SOAP headers and HTTP headers are not the same. Although to some extent you might substitute SOAP headers with user defined custom HTTP headers, it is most of the times a bad idea.

如果数据是针对Web服务的话它应该放在SOAP标头内。 HTTP标头通常停在Web服务器上,而整个SOAP消息将向下游传递给需要数据的最终接收者(甚至可能通过他们可能也需要它的更多中间人)。

If the data is for the web service then it should be placed inside the SOAP headers. HTTP headers usually stop at the web server while the SOAP message in it's entirety will be passed downstream to the ultimate receiver who needs the data (maybe even passing through more intermediaries who they might also need it).

这篇关于SOAP标头与HTTP标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆