Could not find WebService property RequestSoapContext

I have an asp.net site in visual studio 2013. I added a webservice. I need to send an authentication parameter (username and password) as a SOAP header. But it cannot find the RequestSoapContext property.

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 about changing the reference type in the reference.cs file. But I cannot find such a file in my solution. Can anyone please help?

+3


source to share


2 answers


This question is quite old, but after searching for it, it seems like the solution is to manually modify the generated proxy to inherit from Microsoft.Web.Services3.WebServicesClientProtocol

not System.Web.Services.Protocols.SoapHttpClientProtocol

.



+2


source


Generating Code Using WseWsdl3.exe Find the WseWsdl3.exe downloaded as part of wse 3.0 and run the following command: C: \ samples \ wse> WseWsdl3.exe C: \ samples \ wse \ us.wsdl / out: c: \ samples \ wse \ myProxyClass.cs / protocol: SOAP / type: webClient



I think this might help you.

0


source







All Articles