Adding SOAP headers to ASMX service requests

13,658

you can use SoapHeader / SoapUnknownHeader to extend the generated proxy for this:

EDIT - as per comments:

To include a custom namespace see the sample code here.

Share:
13,658
Vex
Author by

Vex

Updated on June 05, 2022

Comments

  • Vex
    Vex almost 2 years

    We were given a set of ASMX services to consume. We have no say in how these services are implemented. We have generated a number of proxies with wsdl.exe tool but for some reason unknown to me, these generated proxies don't have any means for including custom SOAP headers.

    Basically, I need a way to add custom header data to various service calls.

    I am aware of existence of SoapExtension class but unfortunately we're not allowed to use that due to supposed performance issues.

    Are there any alternative ways of customizing/adding header data in SOAP requests?