zoukankan      html  css  js  c++  java
  • [CSharp]使用MSSOAPLib30调用WS的身份验证问题

    在使用C#开发的动态生成Soap调用的程序中遇到了一个问题:
    我的程序只能调用那些允许匿名访问的WS,不能访问那些集成Windows身份验证的WS。

    我使用MSSOAPLib30来调用Soap,而且它支持填加身份验证的方法,可我还是没搞懂应该怎么用?试了n个方法了。

     1 using MSSOAPLib30 ;
     2 
     3 
     4 HttpConnector30Class    connector    =    new HttpConnector30Class() ;
     5 
     6 
     7 connector.set_Property("AuthUser", soapInfo.AuthUser);
     8 connector.set_Property("AuthPassword", soapInfo.AuthPassword);
     9 connector.set_Property("ConnectTimeout",soapInfo.ConnectTimeOut);
    10 connector.set_Property("WinHTTPAuthScheme"0x01 | 0x02 | 0x08 | 0x10);
    11 connector.set_Property("EndPointURL",soapInfo.WSDL.ToLower().Replace("?wsdl",""));
    12 connector.set_Property("Timeout",soapInfo.RequestTimeOut);
    13 
    14 connector.Connect();
    15 connector.ConnectWSDL( soapPort );
    16 connector.BeginMessageWSDL( operation );
    17 
    18 
    第10行中的定义我换了n种方法,可还是不行!

    SDK中的例子是
    1 Dim Connector As ISoapConnector
    2 Set Connector = New HttpConnector30
    3 Connector.Property("EndPointURL"= "some URL"
    4 Connector.Property("SoapAction"= "a SOAP Action"

    WinHTTPAuthScheme属性的说明
    Enables you to choose acceptable an authentication mechanism. It applies only to clients running on Windows XP, Windows 2000 or Windows NT 4.0. These are the accetable values. You can combine these values (bitwise OR). 
    0x1 - basic authentication
    0x2 - ntlm auth
    0x8 - digest auth
    0x10 - negotiate auth
    The default value for this property is 0x12 (ntlm and negotiate).

    我应该怎样配置这个属性呢?
  • 相关阅读:
    winform访问https webservice
    rabbitMQ访问失败
    Redis断线测试
    微信消息推送
    线程控制
    Oracle.ManagedDataAccess.dll折腾了我两天
    IPC网络摄像机rtsp视频流web上H5播放方法
    微软补丁下载网站(备忘)
    ABP vnext 种子文件更新
    ABP vnext 使用Swagger账号登录时Chrome浏览器提示【The cookie 'XSRF-TOKEN' has set 'SameSite=None' and must also set 'Secure'.】错误,不能跳转登录
  • 原文地址:https://www.cnblogs.com/xuzhong/p/360724.html
Copyright © 2011-2022 走看看