惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News: Ask HN
Hacker News: Ask HN
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
量子位
博客园_首页
Vercel News
Vercel News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Forbes - Security
Forbes - Security
IT之家
IT之家
N
News and Events Feed by Topic
S
Security Affairs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Webroot Blog
Webroot Blog
Recorded Future
Recorded Future
L
LangChain Blog
Y
Y Combinator Blog
AI
AI
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
L
Lohrmann on Cybersecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google Online Security Blog
Google Online Security Blog
V2EX - 技术
V2EX - 技术
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
PCI Perspectives
PCI Perspectives
I
Intezer
T
Tenable Blog
G
Google Developers Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Troy Hunt's Blog
L
LINUX DO - 最新话题
云风的 BLOG
云风的 BLOG
C
CXSECURITY Database RSS Feed - CXSecurity.com
有赞技术团队
有赞技术团队
O
OpenAI News
P
Proofpoint News Feed
TaoSecurity Blog
TaoSecurity Blog
C
Check Point Blog
Last Week in AI
Last Week in AI
S
Schneier on Security
Simon Willison's Weblog
Simon Willison's Weblog
Blog — PlanetScale
Blog — PlanetScale

博客园 - Kevin Li

使用WMI远程部署/更新BizTalk程序集 基于WS-AtomicTransaction标准的WCF远程分布式事务(补充) 基于WS-AtomicTransaction标准的WCF远程分布式事务(一) 在Jeffrey Zhao的基础上+反编译System.Web.Extensions.Design得到的完整Ajax代码 .net remoting的事务传播以及wcf分布式事务 在多线程环境下使用HttpWebRequest或者调用Web Service 一篇介绍.NET 2.0 范型挺全面的文章 C# 2.0中的范型和Nullable范型 Windows 2003 下分布式事务协调器(DTC)的配置 使用SQLSourceSafe控制数据库的版本 MySql 主键(自动增加)的数据类型所带来的错误 使用TraceListener 自动保存跟踪信息到文件中 接口属性集成与智能提示的奇怪问题 动态创建程序集中的类 动态创建程序集中的类 使用NUnit测试包含应用程序配置的dll文件 解决“COM+ 无法与 Microsoft 分布式事务协调程序交谈”的问题 [导入]一些很有用的Reflector 插件 Web安全性原则
基于WS-AtomicTransaction标准的WCF远程分布式事务(二)
Kevin Li · 2007-05-26 · via 博客园 - Kevin Li

上一篇文章“基于WS-AtomicTransaction标准的WCF远程分布式事务”写了如何配置MSDTC支持WS-AT协议和写了一段WCF代码使用WS-AT协议。但是WCF是如何支持WS-AT协议的呢?
通过用WCF本身的Log功能或者用smsniff监控一下网络消息,就可以知道MachineA和MachineB传递的消息和一般的WCF程序不一样,消息遵循了WS-AtomicTransaction工业标准。下面是监控到的一部分消息内容:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://tempuri.org/ICustomerService/GetCustomerName</a:Action>
<a:MessageID>urn:uuid:0cc037a3-7c3c-4b0e-bdf8-9856ea8b0061</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">http://li/CustomerService</a:To>
</s:Header>
<s:Body>
<GetCustomerName xmlns="http://tempuri.org/">
<customerID>1</customerID>
</GetCustomerName>
</s:Body>
</s:Envelope>

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://tempuri.org/IOrderService/UpdateOrderStatus</a:Action>
<a:MessageID>urn:uuid:bf31aa58-8421-41d8-94e3-377a1235c64c</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<CoordinationContext s:mustUnderstand="1" xmlns="http://schemas.xmlsoap.org/ws/2004/10/wscoor" xmlns:mstx="http://schemas.microsoft.com/ws/2006/02/transactions">
<wscoor:Identifier xmlns:wscoor="http://schemas.xmlsoap.org/ws/2004/10/wscoor">urn:uuid:89ebe490-88fe-45d8-a931-bc3f88612693</wscoor:Identifier>
<Expires>58880</Expires>
<CoordinationType>http://schemas.xmlsoap.org/ws/2004/10/wsat</CoordinationType>
<RegistrationService>
<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">https://liweiguang:1443/WsatService/Registration/Coordinator/</Address>
<ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<mstx:RegisterInfo>
<mstx:LocalTransactionId>89ebe490-88fe-45d8-a931-bc3f88612693</mstx:LocalTransactionId>
</mstx:RegisterInfo>
</ReferenceParameters>
</RegistrationService>
<mstx:IsolationLevel>0</mstx:IsolationLevel>
<mstx:LocalTransactionId>89ebe490-88fe-45d8-a931-bc3f88612693</mstx:LocalTransactionId>
<PropagationToken xmlns="http://schemas.microsoft.com/ws/2006/02/tx/oletx">AQAAAAMAAACQ5OuJ/ojYRakxvD+IYSaTAAAQAAAAAACUAAAAAP///4LS6HlX0uh5clisZ9oT8nlyWKxnYOb2A+wN+QMIXh8ApOX2A2I1YmExNmU2LTc1ODEtNDkyYi04YWE3LThkNjQwZWU1NTMwNQCp/EMKAAAAZM1kzSEAAABMSVdFSUdVQU5HAHcYAAAATABJAFcARQBJAEcAVQBBAE4ARwAAAHAuAQAAAAEAAAApAAAAdGlwOi8vbGl3ZWlndWFuZy5hc2lhcGFjaWZpYy5ocHFjb3JwLm5ldC8Agd0=</PropagationToken>
</CoordinationContext>
<a:To s:mustUnderstand="1">http://li/OrderService</a:To>
</s:Header>
<s:Body>
<UpdateOrderStatus xmlns="http://tempuri.org/">
<orderID>4400000000000001</orderID>
<orderStatus>1</orderStatus>
</UpdateOrderStatus>
</s:Body>
</s:Envelope>

 第一段消息是没有使用事务的方法调用的消息,第二段是使用WS-AT事务的方法的调用的消息。
从第二段消息可以看出,明显加入了WS-Coordination、WS-Transaction、WS-Addressing的内容。对比一下IBM WAS生成的WS-AT消息(使用 WS-AtomicTransaction 和 JTA 的分布式事务:http://www.ibm.com/developerworks/cn/webservices/ws-wsat/ ),除了协议中自定义部分“ReferenceProperties”,其他基本上是一致的。
也可以看出来,WCF很好的实现了WS-AT协议。下一步打算测试一下WCF WS-AT和java web service的互操作性(虽然Sun声明它的产品和微软的WCF具有很好的互操作性http://www.infoq.com/cn/news/2007/04/sunmsftwsat),呵呵

如果修改一下配置文件,使用OletxTransaction,而不是WS-AT的话,就得到不一样的消息:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://tempuri.org/ICustomerService/Update</a:Action>
<a:MessageID>urn:uuid:08dd935a-2e77-4bd7-bad1-73fc65555d9f</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<OleTxTransaction s:mustUnderstand="1" b:Expires="59904" xmlns="http://schemas.microsoft.com/ws/2006/02/tx/oletx" xmlns:b="http://schemas.xmlsoap.org/ws/2004/10/wscoor">
<PropagationToken>AQAAAAMAAADlvokJX0c9R6q9uvZOpBv+AAAQAAAAAACUAAAAAP///4LS6HlX0uh5clisZ9oT8nlyWKxn6OUJBBwOqwOgQCAALOUJBGI1YmExNmU2LTc1ODEtNDkyYi04YWE3LThkNjQwZWU1NTMwNQCp/EMKAAAAZM1kzSEAAABMSVdFSUdVQU5HAHcYAAAATABJAFcARQBJAEcAVQBBAE4ARwAAAHAuAQAAAAEAAAApAAAAdGlwOi8vbGl3ZWlndWFuZy5hc2lhcGFjaWZpYy5ocHFjb3JwLm5ldC8Agd0=</PropagationToken>
</OleTxTransaction>
<a:To s:mustUnderstand="1">http://li/CustomerService</a:To>
</s:Header>
<s:Body>
<Update xmlns="http://tempuri.org/">
<customerID>1</customerID>
</Update>
</s:Body>
</s:Envelope>