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
What are the different configurations which have to be considered while testing a website?
What's the difference between *.vsdisco and *.disco file?
What all information does a URL contain?
Have you used sass? What’s good about it?
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
Explain how a web application works?
What are the interfaces of SAX?
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?
How to create virtual directory in IIS?
How can you test the security of a Web site,both manually and by using a tool?
If My Application is down what are the resonations?
What do you understand by web application?
when my application is overloaded?
Design a web crawler? How will you avoid from getting into infinite loops?
What can you do to improve page performance?