Tech Off Thread

2 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Sending Custom Soap Headers Using Office XP Web Services Toolkit

Back to Forum: Tech Off
  • User profile image
    bjmarte

    I have some web services written in VB.NET that I need to call from an excel spreadsheet.  The web services require a couple of custom soap headers to be passed in for security.  Is there a way to do this using the Office XP Web Services Toolkit?  I can't find any decent documentation on this topic anywhere.

    Thanks,
    BJ

  • User profile image
    bjmarte

    Not that I think anyone necessarily cares (since nobody replied).  But someday some poor sap is going to be looking for the same information I was and is going to find this post and be annoyed because the answer was never posted. 

    Since I found the answer I will post it for you, the poor sap.

    There are two options as far as I can tell.  The best solution will probably depend on which version of the soap toolkit you are using.

    If you are using soap toolkit version 3.0 (possibly 2.0, I'm not sure) you can define an object that implements the IHeaderHandler interface and hook that up to the soap client to handle adding the headers for you.  Well not really for you, you have to write the code in the header handler object to do it for you.  Here's the only article I could find that talks about it, I was able to build my own implementation from it: http://www.stillhq.com/aus-dotnet/archives/msg03253.html.

    As I said, that works if you are using soap toolkit 3.0, but as it turns out my users only have 1.0.  Soap toolkit 1.0 doesn't have IHeaderHandler and <roll eyes>of course it is too much of a hasle to install it on peoples machines</roll eyes>.  So my option was to basically create the soap envelope myself.  This article talks about how to do what is needed: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxpwst/html/odc_wsrtct.asp.  The pertinant part is 3/4ths of the way down in the section that starts To send a complex SOAP data type using the "low level" SOAP API.  This talks about building the soap request envelope manually.  Although it doesn't talk about soap headers specifically just know that there are methods like startHeader and endHeader just like the startBody and endBody functions used in the example.

    If you, poor sap, have problems or additional questions feel free to email me at the address I have listed here at channel 9: bjmarte.1319978@bloglines.com.

    Brett

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.