简体   繁体   English

找不到WebService RequestSoapContext属性

[英]WebService RequestSoapContext property not found

I have a asp.net website in visual studio 2013. I added a webservice. 我在visual studio 2013中有一个asp.net网站。我添加了一个web服务。 I need to send authentication parameter (username and password) as SOAP header. 我需要将身份验证参数(用户名和密码)作为SOAP标头发送。 But it cannot find the property RequestSoapContext. 但它无法找到属性RequestSoapContext。

I added using Microsoft.Web.Services3; 我添加了使用Microsoft.Web.Services3; in my code. 在我的代码中。

CCWS.Service proxy = new CCWS.Service();
UsernameToken userToken = new UsernameToken("", "", PasswordOption.SendPlainText);
proxy.RequestSoapContext.Security.Tokens.Add(token);

Some forum says to change reference type in reference.cs file. 一些论坛说要在reference.cs文件中更改引用类型。 But I cannot find any such file in my solution. 但我在我的解决方案中找不到任何此类文件。 Can anyone please help? 有人可以帮忙吗?

这个问题相当陈旧但是在搜索之后,似乎解决方案是手动修改生成的代理代码以继承自Microsoft.Web.Services3.WebServicesClientProtocol而不是System.Web.Services.Protocols.SoapHttpClientProtocol

Generate Code Using WseWsdl3.exe Locate the WseWsdl3.exe downloaded as part of wse 3.0 and execute the following command: C:\\samples\\wse>WseWsdl3.exe C:\\samples\\wse\\us.wsdl /out:c:\\samples\\wse\\myProxyClass.cs /protocol:SOAP /type:webClient 使用WseWsdl3.exe生成代码找到作为wse 3.0的一部分下载的WseWsdl3.exe并执行以下命令:C:\\ samples \\ wse> WseWsdl3.exe C:\\ samples \\ wse \\ us.wsdl / out:c:\\ samples \\ wse \\ myProxyClass.cs / protocol:SOAP / type:webClient

I guess this may help you. 我想这可能对你有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM