Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How do I provide information to the Web Service when the
information is required as a SOAP Header?

Answer Posted / swapna

The key here is the Web Service proxy you created using
wsdl.exe or through Visual Studio .NET's Add Web Reference
menu option. If you happen to download a WSDL file for a
Web Service that requires a SOAP header, .NET will create a
SoapHeader class in the proxy source file. Using the
previous example:
public class Service1 :
System.Web.Services.Protocols.SoapHttpClientProtocol
{
public AuthToken AuthTokenValue;

[System.Xml.Serialization.XmlRootAttribute
(Namespace="http://tempuri.org/", IsNullable=false)]
public class AuthToken : SoapHeader {
public string Token; }}

In this case, when you create an instance of the proxy in
your main application file, you'll also create an instance
of the AuthToken class and assign the string:
Service1 objSvc = new Service1();
processingobjSvc.AuthTokenValue = new AuthToken();
objSvc.AuthTokenValue.Token = <ACTUAL token value>;
Web Servicestring strResult =
objSvc.MyBillableWebMethod();

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the result of “20” + 20;

961


Is web application testing different from desktop application testing? Explain how.

895


What is a Simple Element?

939


How can you add a method to a class already defined?

889


What is frame level testing and how do we test it?

2676


How to test iBackup and storage products?

1829


What is user application?

865


What is meant by mobile application?

896


Suppose there are two requests for 2 different pages of same site and from 2 different browsers, How Web server recognise the different request and send result to the exact sender browsers.

1816


what are propritory databases?

2049


What is DOM?

2091


Define http.

961


Can you get a virus from website?

854


Is it right way to earn revenue through google adsense? Is it Possible?

2140


what atttributes we use to create a webservice?

1919