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 |
How can you add a method to a class already defined?
what is the difference between weblogic and websphere,jboss,tomcat?
How does dynamic discovery work?
Give me an example of how you have planned projects from start to finish. What is your development lifecycle?
Design a web crawler? How will you avoid from getting into infinite loops?
What is the difference between local link popularity and global link popularity
Some sites work with "http://allinterview.com" but for some sites we need to specify "www" - like "http://www.allinterview.com". Why?
have you already used mvc before? What you like/dislike about it?
Describe the steps to develope and host the webservice for an application?
What is frame level testing and how do we test it?
Can you give an example of when it would be appropriate to use a web service as opposed to non-serviced .NET component?
Loop through the color array and print each value to the console. Assume you do not know the amount of colors in the color array.