Standing on the shoulders of giants. RSS 2.0
# Tuesday, October 16, 2007

Part 2: Adding Soap headers to the client

Adding headers to the client is even easer than adding them to the server, which I showed in part 1: Adding Soap headers to a webservice. As you can see the headers are also added to the WSDL and the wsdl.exe tool or the VS webreference wizard will add them to the proxy.

<wsdl:binding name="Service1Soap" type="tns:Service1Soap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
    <wsdl:operation name="HelloWorld">
      <soap:operation soapAction="http://tempuri.org/HelloWorld" style="document" /> 
      <wsdl:input>
          <soap:body use="literal" /> 
          <soap:header message="tns:HelloWorlduserNamePasswordHeader" 
part="userNamePasswordHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding>

If that doesn't work or the headers are not in the wsdl, you can add the property manually and associate the header with the method using the soapheader attribute. This works exactly the same as for the server.

WebClient.zip (8.59 KB)

Update 23 Oct. 2007: Replaced the zip with a version which compiles.

Tuesday, October 16, 2007 9:04:56 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Services
Comments are closed.
About
© Copyright 2009
Paul van Brenk
Sign In
newtelligence dasBlog 2.3.8275.16006
All Content © 2009, Paul van Brenk
DasBlog theme 'Business' created by Christoph De Baene (delarou)