0

For a project I'm talking to a SOAP service. This service is using authorization HTTP headers: one static, one dynamic token.

The project is written in C#. I used the XML Schema Definition Tool (XSD.exe) to generate classes from the XSD's. I'm looking for a good way to add the autorization HTTP request headers to the endpoint url (System.ServiceModel.EndpointAddress). I want to keep using the already generated Schema.cs with XSD.exe.

I searched the internet, but I cannot find a solution fast. Does anyone know how to do this?

Thanks a lot.

Jordy

Jordy
  • 661
  • 7
  • 26

1 Answers1

1

You can interecept the operationcontext by writing extention and populate header at runtime using below interfaces

IClientMessageInspector IDispatchMessageInspector

Amit
  • 882
  • 6
  • 13
  • Is it only possible to add message headers? I want to add a HTTP header. – Jordy Dec 05 '14 at 12:09
  • Yes. But service request header. – Amit Dec 05 '14 at 12:11
  • Do have an example/link or something like that? – Jordy Dec 05 '14 at 12:12
  • You need SOAP header not HTTP header. Above mentioned method of implementing interface will work. Check http://stackoverflow.com/questions/964433/how-to-add-a-custom-header-to-every-wcf-call/1408177#1408177 – Amit Dec 05 '14 at 12:26