简体   繁体   English

HTTP标头或SOAP标头中的WCF Soap操作?

[英]WCF Soap Actions in HTTP header or SOAP header?

I'm a little confused about how SOAPAction is implemented in WCF (and other web service frameworks for that matter). 我对如何在WCF(以及其他Web服务框架)中实现SOAPAction感到困惑。

In a test client, I have a Client Message Inspector configured to grab both the SOAP message and any HTTP headers that are being sent with the request. 在测试客户端中,我有一个Client Message Inspector,它配置为同时获取SOAP消息和随请求一起发送的任何HTTP头。 At least here in the client message inspector, the action shows up as an element in the SOAP Header: 至少在客户端消息检查器中,该操作显示为SOAP标头中的元素:

<s:Header>
    <Action ... >http://myurl.com/2009/11/MyService/MyMethod</Action>

However, if I view the request in Fiddler, the Action element is missing and instead there is now an additional entry in the HTTP Headers: 但是,如果我在Fiddler中查看请求,则缺少Action元素,而现在HTTP Headers中还有一个附加条目:

SOAPAction: "http://myurl.com/2009/11/MyService/MyMethod"

Can anyone explain what the heck is going on?? 谁能解释一下到底发生了什么?

Thanks! 谢谢!

This is a problem with WCF not following the standards. 这是WCF不遵守标准的问题。

SOAP 1.1 uses the SOAPAction header to decide what method to call, but this was a bit messy as the method name was embedded elsewhere in the message. SOAP 1.1使用SOAPAction标头来决定调用哪种方法,但由于方法名称嵌入在消息的其他位置,因此这有点混乱。 SOAP 1.2 resolved this and added the action to content-type header, and deprecated the SOAPAction header (though its now an optional for those clients that still want to send it). SOAP 1.2解决了这个问题,并将操作添加到content-type标头,并弃用了SOAPAction标头(尽管现在它仍然是那些仍想发送它的客户端的可选项)。

See an o'reilly blog page for some details. 有关详细信息,请参阅o'reilly博客页面。

您可能会看到SOAP 1.1和SOAP 1.2之间的区别。

Seems to me as if those two are equivalent, no? 在我看来好像这两个是等价的,不是吗? I guess Fiddler just interprets that SOAP header "", calling it "SOAPAction". 我猜Fiddler只是解释SOAP标头“”,称之为“SOAPAction”。 The value appears to be the same, no? 价值看起来是一样的,不是吗?

What you get from the Client Message Inspector is the raw XML data (the raw format of the SOAP message) as it travels across the copper wire (or fibre). 从客户端消息检查器获得的是原始XML数据(SOAP消息的原始格式),它穿过铜线(或光纤)。 What Fiddler gives you is a higher-level HTTP-oriented interpretation of that same XML message, I would say. 我想说,Fiddler给你的是对同一XML消息的更高级别的面向HTTP的解释。

Judging from other blog posts and articles I've found on Fiddler and SOAP (eg this blog post - check out the "Sample Capture" section towards the end), it almost seems to me as if Fiddler will strip out the SOAP headers and interpret / show them in a custom format, leaving just the SOAP body to be shown as body of the message being displayed. 从我在Fiddler和SOAP上找到的其他博客文章和文章来看(例如这篇博客文章 - 最后查看“Sample Capture”部分),在我看来,似乎Fiddler将删除SOAP标题并解释/以自定义格式显示它们,只留下SOAP正文显示为正在显示的消息正文。

Is there an actual technical problem? 有实际的技术问题吗? Or just a question of how to interpret the two formats? 或者只是如何解释这两种格式的问题?

Putting SOAP action in an HTTP header is part of SOA specification, and WCF just implements SOAP specification in this case. 将SOAP操作放在HTTP头中是SOA规范的一部分,在这种情况下,WCF只是实现了SOAP规范。

Read here: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528 在这里阅读: http//www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528

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

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