.NET 调用CXF Webwervice 验证问题

不断学习的ITer 2014-07-04 01:47:57
.NET 调用 需要用户名和密码 的CXF Webwervice 。
我代码是这样的:
            
FRS.CxfServiceClient server = new FRS.CxfServiceClient();
server.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
server.ClientCredentials.UserName.UserName = "frs";
server.ClientCredentials.UserName.Password = "frs";

Object objectresult= server.wsdl(10, "2014-06-01 00:00:00");


但是运行到最后一行的时候还是提示:
An error was discovered processing the <wsse:Security> header

求解,找了好久网上没找到资料
...全文
200 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 1 楼 save4me 的回复:
参考: How can I pass a username/password in the header to a SOAP WCF Service 在你的config文件里面安全节点改成下面的,这样WebService就会知道是通过用户名密码连接的

<basicHttpBinding>
  <binding name=”usernameHttps”>
    <security mode=”TransportWithMessageCredential”>
      <message clientCredentialType=”UserName”/>
    </security>
  </binding>
</basicHttpBinding>
配上这这个内容后,会报错:提供的 URI 方案“http”无效,应为“https。 cxf提供的url是http开头的。
  • 打赏
  • 举报
回复
配上这这个内容后,会报错:提供的 URI 方案“http”无效,应为“https。 cxf提供的url是http开头的。
save4me 2014-07-04
  • 打赏
  • 举报
回复
参考: How can I pass a username/password in the header to a SOAP WCF Service 在你的config文件里面安全节点改成下面的,这样WebService就会知道是通过用户名密码连接的

<basicHttpBinding>
  <binding name=”usernameHttps”>
    <security mode=”TransportWithMessageCredential”>
      <message clientCredentialType=”UserName”/>
    </security>
  </binding>
</basicHttpBinding>

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧