masum7
masum7

Reputation: 832

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?

Upvotes: 7

Views: 6803

Answers (2)

speckledcarp
speckledcarp

Reputation: 6375

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.

Upvotes: 9

Feng
Feng

Reputation: 83

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.

Upvotes: 1

Related Questions