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

what is web accessibility?

1 Answers  


what is a web sevice?

1 Answers  


Have you used sass? What’s good about it?

1 Answers  


How to test whether the navigation i.e. from one page to another is working r not using QTP for web based application

1 Answers  


What are namespaces? Why are they important?

1 Answers  


Explain Working of Proxy Server, Cookies, types of cookies?

2 Answers  


I want to crate my personal website. I am having my website on webs.com which provide some space but it templete based. I want to gain free web space and plz tell me how to custmize it....plz suggest me... Thanks...

1 Answers  


If i have a form, and 1 part of the form needs to use validator framework and the other part need not use, how will i ensure that?

1 Answers   CSC,


What is the difference between local link popularity and global link popularity

1 Answers  


How to redirect to another page?

1 Answers  


What is the difference between Web 2.0 and Web 3.0?

1 Answers  


What is a Complex Element?

1 Answers  


Categories