I have a asp.net website in visual studio 2013. I added a webservice. I need to send authentication parameter (username and password) as SOAP header. But it cannot find the property RequestSoapContext.
I added using 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. 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
I guess this may help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.