I have added a service reference in my project.
I need to pass in the security header as per below
<soapenv:Header>
<oas:Security>
<oas:UsernameToken>
<oas:Username>username</oas:Username>
<oas:Password>!password</oas:Password>
</oas:UsernameToken>
</oas:Security>
How do i set this. If you look at how I set the request, is it possible to do the same somehow with the headers.
The security xsds are embedded in the WSDL.
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
and
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd.
The request to the service operation is populated as per below:
MyWebService.PortTypeClient client = new MyWebService.PortTypeClient();
MyWebService.SecurityHeaderType secHeader = new MyWebService.SecurityHeaderType();
RetrieveOperationRequest detailsRequest = new RetrieveOperationRequest ();
detailsRequest.inputParam1 = "1234";
var result = client.RetrieveOperation(secHeader, detailsRequest);
How do i generate the Header part???
You can see i pass security header as this is required by the web service.
Thanks.