svcutil 卡在 usernameToken 策略上 [英] svcutil getting stuck on usernameToken Policy

查看:30
本文介绍了svcutil 卡在 usernameToken 策略上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用 C# 构建 WCF 客户端以使用 eMedNy 的 SOAP Web 服务.WSDL 位于:https://service100.emedny.org:9047/MHService?wsdl

I'm attempting to build a WCF client in C# to consume eMedNy's SOAP web services. The WSDL is here: https://service100.emedny.org:9047/MHService?wsdl

当我尝试运行 svcutil 时出现此错误:

When I try running svcutil I get this error:

警告:未导入以下策略断言:
XPath://wsdl:definitions[@targetNamespace=http://org/emedny/mhs/]/wsdl:binding[@name='MHS']
断言:
<代码>.. </dpe:summary>
<代码><sp:SupportingTokens xmlns:sp='http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702'>.. </sp:SupportingTokens>

Warning: The following Policy Assertions were not Imported:
XPath://wsdl:definitions[@targetNamespace=http://org/emedny/mhs/]/wsdl:binding[@name='MHS']
Assertions:
<dpe:summary xmlns:dpe='http://www.datapower.com/extensions'> .. </dpe:summary>
<sp:SupportingTokens xmlns:sp='http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702'> .. </sp:SupportingTokens>

据我所知,这与 WCF 缺乏对带有摘要密码的 usernameToken 的支持有关.

From what I've read, this has something to do with WCF's lack of support for usernameToken with digested password.

我怎样才能克服这个问题并设置代理和 app.config?

How can I proceed to overcome this and set-up the proxy and app.config?

推荐答案

在磁盘上本地保存 WSDL 和任何引用的 WSDL/模式.(您可以通过import"和include"元素找到引用的文件.)将它们保存到磁盘后,解析引用:例如,如果 import 标签是 http://www.server.com/1.WSDL 并将其保存在磁盘上到 1.wsdl 然后将导入标记更改为指向本地磁盘.然后从 WSDL 中删除所有策略标记(实际上只有一个 - 根策略标记及其所有子项).现在您应该能够从本地磁盘上的根 WSDL 添加服务引用.

Save the WSDL and any referenced WSDL/schema locally on disk. (You can find referenced files by following the "import" and "include" elements.) After you save them on disk, resolve the references: for example, if import tag was to http://www.server.com/1.WSDL and you saved it on disk to 1.wsdl then change the import tag to point to local disk. Then delete all the policy tags from the WSDL (actually just one - the root policy tag and all its children). Now you should be able to add service reference from the root WSDL on local disk.

根据您的评论,现在的问题不是生成代理而是配置安全性.根据您的链接,这是一个相当复杂的安全配置.尝试查看 此链接 作为基本绑定.然后 include this 使二进制标记显示为序列化(可能需要更改 InclusionMode 和 ReferenceStyle).可能需要进行大量调整才能获得所需的确切格式.在任何阶段,使用 Fiddler 或 WCF 日志来查看您的请求如何与所需的 SOAP 格式保持一致.

based on your comment the issue now is not generating the proxy but configuring security. Based on your link this is a fairly complicated security configuration to set up. Try look at this link as a base binding. Then include this to make the binary token appear serialized (might need to alter InclusionMode and ReferenceStyle). It might take quite a few adjustments to get the exact format you need. At any stage use Fiddler or WCF logs to see how your request is aligned with the desired SOAP format.

这篇关于svcutil 卡在 usernameToken 策略上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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