views:

1178

answers:

3

I have a web service that I am calling and their published WSDL doesn't actually define much of the service, 3/4 of it you have to manually build afterwards.

The problem I have is that they need a SoapHeader with some specific information in it, but I don't have any way of doing it. The only real things I have for the service is a proxy method that was created (MyMethod) that I can pass my message to. How can I set/send a soap header with it as well?

All of the services I've had, I have been able to use the automatically bound items from Visual Studio.

A: 

You might want to see this for something similar; it appears to be doable, but a lot of work... or you could build the entire request manually (even worse...).

Marc Gravell
+1  A: 

I was able to get this done by modifying the auto-generated proxy code manually and simply injecting a class that inherited "SoapHeader" and added the attribute to the method!

I cannot re-generate or re-fresh the proxy, but it got the job done, and only took 15 minutes.

Mitchel Sellers
A: 

Mitchel, I want to do exactly the same thing (add a soap header to a web service that needs it but doesn't mention it anywhere in the wsdl). Would it be possible for you to indicate what you did to the wsdl to "inject" the class please. I have tried making changes to the wsdl I have but I get reflection errors. An example would be a fantastic help for me. Thanks

Jacq - I can try to whip up a generic example for you.If you can drop me an e-mail [email protected] and let me know what your soap header needs to look like!
Mitchel Sellers