HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
            httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Basic;
            httpTransport.MaxReceivedMessageSize = 65536 * 256;
            TextMessageEncodingBindingElement textMessageEncoding = new TextMessageEncodingBindingElement();
            textMessageEncoding.MessageVersion = MessageVersion.Soap11;


            SynchronizedCollection<BindingElement> coll = new SynchronizedCollection<BindingElement>();
            coll.Add(textMessageEncoding);
            coll.Add(httpTransport);

            System.ServiceModel.Channels.CustomBinding myBinding = new System.ServiceModel.Channels.CustomBinding(coll);
            myBinding.SendTimeout = new TimeSpan(0, 0, 5, 0);
            EndpointAddress address = new EndpointAddress("http://*****/****.wsdl");

            WebService.Client client = new WebService.Client(myBinding, address);          
            client.ClientCredentials.UserName.UserName = "user123456";
            client.ClientCredentials.UserName.Password = "******";

            //PN获取请求参数
            var Model = new Model();

            Task<WebService.Response> responseTask = client.GetInfoAsync(Model);
            WebService.Response response = responseTask.Result;

 

相关文章:

  • 2022-12-23
  • 2021-12-18
  • 2021-12-26
  • 2021-04-01
  • 2021-10-16
  • 2021-11-07
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2021-08-08
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案