Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / January 2006

Tip: Looking for answers? Try searching our database.

Having trouble with implementing a SOAP header

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Friso Wiskerke - 24 Jan 2006 15:17 GMT
Hi all,

I'm trying to use a webservice which is provided to me by a third party.
There are a number of webmethods that I can call but for each method I have
to supply a SOAP header which contains an identification-token. I've managed
to generate a proxy class using the wsdl.exe tool but the wsdl doesn't have
the SOAP header definition in it (quite frustrating).

I'm trying to enhance the generated class so that I can issue the header to
the webservice but I'm not having much luck.It should look like this
according to the documentation:
 <soap:Header>
   <AuthToken>ABCDEFGHIJKLMNOP</AuthToken>
 </soap:Header>

Does anybody know how I can achieve this in my VB app (C# code samples are
also welcome)?

TIA,
Friso Wiskerke
Javier G. Lozano - 24 Jan 2006 19:03 GMT
SoapHeaders are generated as properties of your Proxy object you
created using WSDL.  For your AuthToken header, it should be a property
such as

Proxy p = new Proxy();
p.AuthToken = "ABCEFGHIJKLMNOP";

Is this not the fact?
Friso Wiskerke - 25 Jan 2006 07:49 GMT
Javier,

I think this would be the case if the soap:Header definition is in the
WSDL... and for some reason it isn't. That's why I'm looking for a way to
add the header myself.

In the example you stated I assume the AuthToken is a string variable and
not a class that inherits from System.Web.Services.Protocols.SoapHeader. I
don't think that this property would result in a soap header when the
message is wrapped into a soap envelope by the proxy object.

Thanks,
Friso Wiskerke

> SoapHeaders are generated as properties of your Proxy object you
> created using WSDL.  For your AuthToken header, it should be a property
[quoted text clipped - 4 lines]
>
> Is this not the fact?
CG - 25 Jan 2006 18:16 GMT
You might want to get wsdl file again.

If header is defined you should get that in WSDL file.

here is an example

 <?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://tempuri.org/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/">
 <s:import namespace="http://www.w3.org/2001/XMLSchema" />
- <s:element name="ApplicationBlockDataSet">
- <s:complexType>
- <s:sequence>
 <s:element minOccurs="0" maxOccurs="1" name="custid" type="s:string" />
 </s:sequence>
 </s:complexType>
 </s:element>
- <s:element name="ApplicationBlockDataSetResponse">
- <s:complexType>
- <s:sequence>
- <s:element minOccurs="0" maxOccurs="1" name="ApplicationBlockDataSetResult">
- <s:complexType>
- <s:sequence>
 <s:element ref="s:schema" />
 <s:any />
 </s:sequence>
 </s:complexType>
 </s:element>
 </s:sequence>
 </s:complexType>
 </s:element>
 <s:element name="mySoapHeader" type="tns:mySoapHeader" />
- <s:complexType name="mySoapHeader">
- <s:sequence>
 <s:element minOccurs="0" maxOccurs="1" name="user" type="s:string" />
 <s:element minOccurs="0" maxOccurs="1" name="pwd" type="s:string" />
 </s:sequence>
 </s:complexType>
- <s:element name="ReturnCustomerOrders">
 <s:complexType />
 </s:element>
- <s:element name="ReturnCustomerOrdersResponse">
- <s:complexType>
- <s:sequence>
 <s:element minOccurs="0" maxOccurs="1" name="ReturnCustomerOrdersResult"
type="s:string" />
 </s:sequence>
 </s:complexType>
 </s:element>
 </s:schema>
 </wsdl:types>
- <wsdl:message name="ApplicationBlockDataSetSoapIn">
 <wsdl:part name="parameters" element="tns:ApplicationBlockDataSet" />
 </wsdl:message>
- <wsdl:message name="ApplicationBlockDataSetSoapOut">
 <wsdl:part name="parameters" element="tns:ApplicationBlockDataSetResponse"
/>
 </wsdl:message>
- <wsdl:message name="ApplicationBlockDataSetmySoapHeader">
 <wsdl:part name="mySoapHeader" element="tns:mySoapHeader" />
 </wsdl:message>
- <wsdl:message name="ReturnCustomerOrdersSoapIn">
 <wsdl:part name="parameters" element="tns:ReturnCustomerOrders" />
 </wsdl:message>
- <wsdl:message name="ReturnCustomerOrdersSoapOut">
 <wsdl:part name="parameters" element="tns:ReturnCustomerOrdersResponse" />
 </wsdl:message>
- <wsdl:portType name="Service1Soap">
- <wsdl:operation name="ApplicationBlockDataSet">
 <wsdl:input message="tns:ApplicationBlockDataSetSoapIn" />
 <wsdl:output message="tns:ApplicationBlockDataSetSoapOut" />
 </wsdl:operation>
- <wsdl:operation name="ReturnCustomerOrders">
 <wsdl:input message="tns:ReturnCustomerOrdersSoapIn" />
 <wsdl:output message="tns:ReturnCustomerOrdersSoapOut" />
 </wsdl:operation>
 </wsdl:portType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
 <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
- <wsdl:operation name="ApplicationBlockDataSet">
 <soap:operation soapAction="http://tempuri.org/ApplicationBlockDataSet"
style="document" />
- <wsdl:input>
 <soap:body use="literal" />
 <soap:header message="tns:ApplicationBlockDataSetmySoapHeader"
part="mySoapHeader" use="literal" />
 </wsdl:input>
- <wsdl:output>
 <soap:body use="literal" />
 </wsdl:output>
 </wsdl:operation>
- <wsdl:operation name="ReturnCustomerOrders">
 <soap:operation soapAction="http://tempuri.org/ReturnCustomerOrders"
style="document" />
- <wsdl:input>
 <soap:body use="literal" />
 </wsdl:input>
- <wsdl:output>
 <soap:body use="literal" />
 </wsdl:output>
 </wsdl:operation>
 </wsdl:binding>
- <wsdl:service name="Service1">
 <documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
- <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
 <soap:address
location="http://cgupta/dataapplicationblocktest/service1.asmx" />
 </wsdl:port>
 </wsdl:service>
 </wsdl:definitions>

> Javier,
>
[quoted text clipped - 18 lines]
> >
> > Is this not the fact?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.