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



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

Answer / 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

More Web Related AllOther Interview Questions

Define https.

0 Answers  


what is web methods?

0 Answers  


Tableau Training for Beginners

1 Answers   SAP Labs,


WHAT ARE THE ADVANTAGES OF DEDICTED HOSTING OVER SHARED HOSTING?

0 Answers  


Explain the functioning of dynamic pages in a website?

0 Answers   NIIT,






What is an example of a web based application?

0 Answers  


Which method is used to post a Web page to another Web page?

0 Answers   MindCracker,


Give me an example of how you have planned projects from start to finish. What is your development lifecycle?

0 Answers  


What software do you use to build websites? Give me an example of a project that you built using JavaScript. What kind of functionality did you create?

0 Answers  


On a scale of 1 to 10 rate your proficiency in CSS, JavaScript, PhotoShop, Illustrator, Flash, ActionScript, HTML, DHTML.

0 Answers  


1.What is Ipconfig? What purpose u can use it? 2.How can u know what ports are busy in ur machine? 3.How can u know particular port is free/ not in ur machine? 4.How many drivers in JDBC? Which Driver u r using? Why?

0 Answers  


What are the various ways of accessing a web service?

2 Answers  


Categories