This link adding a soap header worked for me. I am calling the SOAP 1.1 service, which I have not written or controlled. I am using VS 2012 and added the service as a web link in my project. Hope this helps
I followed steps 1-5 from the post of J. Dagen at the bottom of the stream.
Here is a sample code (this will be in a separate .cs file):
namespace SAME_NAMESPACE_AS_PROXY_CLASS {
And then in the generated proxy class, in the method that calls the service, in step 4 of J Dudgeon add this attribute: [SoapHeader("credHeader", Direction = SoapHeaderDirection.In)]
finally, here's the call to the generated proxy method with the header:
using (MyService client = new MyService()) { client.credHeader = new Creds(); client.credHeader.Username = "username"; client.credHeader.Password = "pwd"; rResponse = client.MyProxyMethodHere(); }
PBMe_HikeIt
source share