Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Having trouble with implementing a SOAP header

Reply
Thread Tools

Having trouble with implementing a SOAP header

 
 
Friso Wiskerke
Guest
Posts: n/a
 
      01-24-2006
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



 
Reply With Quote
 
 
 
 
Javier G. Lozano
Guest
Posts: n/a
 
      01-24-2006
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?

 
Reply With Quote
 
 
 
 
Friso Wiskerke
Guest
Posts: n/a
 
      01-25-2006
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


"Javier G. Lozano" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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?
>



 
Reply With Quote
 
CG
Guest
Posts: n/a
 
      01-25-2006
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">
<wsdlart name="parameters" element="tns:ApplicationBlockDataSet" />
</wsdl:message>
- <wsdl:message name="ApplicationBlockDataSetSoapOut">
<wsdlart name="parameters" element="tns:ApplicationBlockDataSetResponse"
/>
</wsdl:message>
- <wsdl:message name="ApplicationBlockDataSetmySoapHeader">
<wsdlart name="mySoapHeader" element="tns:mySoapHeader" />
</wsdl:message>
- <wsdl:message name="ReturnCustomerOrdersSoapIn">
<wsdlart name="parameters" element="tns:ReturnCustomerOrders" />
</wsdl:message>
- <wsdl:message name="ReturnCustomerOrdersSoapOut">
<wsdlart name="parameters" element="tns:ReturnCustomerOrdersResponse" />
</wsdl:message>
- <wsdlortType name="Service1Soap">
- <wsdlperation name="ApplicationBlockDataSet">
<wsdl:input message="tns:ApplicationBlockDataSetSoapIn" />
<wsdlutput message="tns:ApplicationBlockDataSetSoapOut" />
</wsdlperation>
- <wsdlperation name="ReturnCustomerOrders">
<wsdl:input message="tns:ReturnCustomerOrdersSoapIn" />
<wsdlutput message="tns:ReturnCustomerOrdersSoapOut" />
</wsdlperation>
</wsdlortType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
- <wsdlperation name="ApplicationBlockDataSet">
<soapperation soapAction="http://tempuri.org/ApplicationBlockDataSet"
style="document" />
- <wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:ApplicationBlockDataSetmySoapHeader"
part="mySoapHeader" use="literal" />
</wsdl:input>
- <wsdlutput>
<soap:body use="literal" />
</wsdlutput>
</wsdlperation>
- <wsdlperation name="ReturnCustomerOrders">
<soapperation soapAction="http://tempuri.org/ReturnCustomerOrders"
style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdlutput>
<soap:body use="literal" />
</wsdlutput>
</wsdlperation>
</wsdl:binding>
- <wsdl:service name="Service1">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
- <wsdlort name="Service1Soap" binding="tns:Service1Soap">
<soap:address
location="http://cgupta/dataapplicationblocktest/service1.asmx" />
</wsdlort>
</wsdl:service>
</wsdl:definitions>





"Friso Wiskerke" wrote:

> 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
>
>
> "Javier G. Lozano" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
> > 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?
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
Implementing ruby webservice after having used wsdl2ruby Vipin Vm Ruby 3 07-22-2008 08:27 AM
How to add SOAP header to a SOAP message? Peter van der veen ASP .Net Web Services 6 11-14-2006 06:44 PM
datagrid having row header and column header krishna.dwivedi@gmail.com ASP .Net Datagrid Control 0 07-13-2006 08:20 AM
I'm having a problem creating SOAP header in a .NET Yelena ASP .Net Web Services 1 01-11-2006 06:54 PM



Advertisments