Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebService RequestSoapContext property not found

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?

like image 447
masum7 Avatar asked May 19 '15 11:05

masum7


2 Answers

This question is rather old but after searching around, it appears the solution is to hand modify the generated proxy code to inherit from Microsoft.Web.Services3.WebServicesClientProtocol not System.Web.Services.Protocols.SoapHttpClientProtocol.

like image 84
speckledcarp Avatar answered Oct 16 '22 19:10

speckledcarp


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.

like image 26
Feng Avatar answered Oct 16 '22 20:10

Feng