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

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

0 Answers  


DHTML: Difference between FontSize and Font Size?

0 Answers  


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

0 Answers  


What is WSDL?

2 Answers  


what is the Need for CSS ?

0 Answers   Lambent,






what is stub in weblogic? dont give me a defination , iwant full ans with example? also tell what is replica-aware stubs.. ok bye send ans as soon as possible

0 Answers   Wipro,


How to post anchor tag value through form.

1 Answers  


What's the difference between a *.WSDL file and a *.DISCO file?

0 Answers  


What is meant by mobile application?

0 Answers  


Difference between ASP and DHTML?

1 Answers  


Enlist some web testing tools.

0 Answers  


What are the common problems faced in web testing?

0 Answers  


Categories