我可以将 WCF wsHttpContextBinding 与 WSIT (Metro) 客户端一起使用吗?
我正在开发 WCF - WSIT (Metro) 集成项目,我希望允许 Java 客户端连接到持久服务。
持久的服务 http://msdn.microsoft.com/en- us/library/bb410767(v=vs.90).aspx
持久服务需要 wsHttpContextBinding,这似乎工作正常。唯一的问题是 WSIT 客户端生成的代理似乎无法将instanceId 分配给soap 信封。是否有我不知道的配置设置,或者可能有一种拦截传出消息并附加 instanceId 的方法?
以下 SOAP 示例由 .NET 客户端生成。信封 WSIT 发送与此发送之间的唯一区别是 WSIT 发送中缺少 Context 节点:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:r="http://schemas.xmlsoap.org/ws/2005/02/rm" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
...
<Context xmlns="http://schemas.microsoft.com/ws/2006/05/context">
<Property name="instanceId">{I want to set this Id}</Property>
</Context>
...
</s:Header>
<s:Body>
<IncreaseCounter xmlns="http://tempuri.org/"/>
</s:Body>
</s:Envelope>
我希望这是有意义的。问题不是ws2007HttpBinding或wsHttpBinding相关或WCF实例管理相关之类;每次/呼叫、会话、单个。我需要 WSIT 方面的帮助,仅涉及 Java 部分。
I am working on a WCF - WSIT (Metro) integration project and I would like to allow Java clients to connect to Durable Services.
Durable Services
http://msdn.microsoft.com/en-us/library/bb410767(v=vs.90).aspx
Durable services require wsHttpContextBinding, which seems to be working fine. The only issues is that the WSIT client generated proxy doesn’t seem to be able to assign a instanceId to the soap envelope. Is there a config setting I am not aware of or maybe a way to intercept the outgoing messages and append the instanceId?
The following SOAP example is generated by a .NET client. The only difference between the envelop WSIT send and this one is that the Context node is missing from the WSIT one:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:r="http://schemas.xmlsoap.org/ws/2005/02/rm" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
...
<Context xmlns="http://schemas.microsoft.com/ws/2006/05/context">
<Property name="instanceId">{I want to set this Id}</Property>
</Context>
...
</s:Header>
<s:Body>
<IncreaseCounter xmlns="http://tempuri.org/"/>
</s:Body>
</s:Envelope>
I hope it makes sense. The question is not ws2007HttpBinding or wsHttpBinding related or WCF instance management related like; per/call, session, single. I need help with the WSIT, Java bit only.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的一位从事该项目 Java 端工作的同事帮助弄清楚了语法。我分享该解决方案是因为它可能对其他人有用。这篇文章的意义在于 WSIT 文档都没有忽略提及持久 WCF 服务可以与 Java 客户端一起使用。如果您需要编写可以参与长时间运行的工作流的 java 客户端或托管 Windows 工作流 (WF) 的客户端,那么持久的 WCF 至关重要。
以下 Java 代码返回相关标头:
然后您可以像这样设置 Context:
A colleague of mine who is working on the Java end of the project helped to figure out the syntax. I share the solution because it could be useful for others. The significance of this post is that neither the WSIT documentation neglects to mention that durable WCF services can be used with Java clients. Durable WCF is essential if you need to write a java client which can participate in long running workflows or a client of a hosted Windows Workflow (WF).
The following Java code returns the relevant header:
Then you can set the Context like this:
您可能必须指定 wcf 服务的实例管理,有 3 个选项:
看起来您需要每个会话。
http://www.dotnetfunda.com/articles/article912-3-ways-to-do-wcf-instance-management-per-call-per-session-and-single-.aspx
You may have to specify the instance management of the wcf service, there are 3 options:
Looks like you need the per session.
http://www.dotnetfunda.com/articles/article912-3-ways-to-do-wcf-instance-management-per-call-per-session-and-single-.aspx