Adding Soap Header


Well-known member
Mar 5, 2008
Programming Experience
I received a WSDL from a company so I can access their service. In testing with them they supplied me with a request which has <soap:Header><con:Context> (see below), which I copied and pasted in to soapUI for testing. Most of the elements must be populated or the request fails. After testing they supplied me with a WSDL which only has the body and does not have the header. I tried adding it to the WSDL, but either I did it wrong (first time working on a WSDL like that) because anything above the <soap:Body> does not show up as an object in VS 2010 when the WSDL is loaded as a service reference. I was able to add it to part of payLoad, but the request still failed, as I thought it would.

I contacted the developer and they said they would not change the WSDl and couldn't understand why I didn't just add the header to the envelope (Java programmers). I had them remote in to show them the way VS works with this and they had never seen that before. They suggested I figure out how to make a soap request over https. I would need to do this with a cert. I have the app.cofig set for the endpoint with a cert.

Is there a way for me to add the header to the soap envelope before it leaves my app or will I need to figure out how to do it by building my own soap envelope and not user the native Service Reference objects in VS.

Any help is appreciated.


Request for testing
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:sear="" xmlns:soap="" xmlns:con="" xmlns:head="">
Top Bottom