I'm simply attempting to use a soap header for authentication purposes.
After adding a service reference to a client console application, the header shows as the first parameter in list instead of as a member on the client object.
Anyone have any idea what I'm doing wrong?
WebService:
public class Service1 : System.Web.Services.WebService
{
public CustomSoapHeader MyHeader;
[WebMethod]
[SoapHeader("MyHeader")]
public string HelloWorld()
{
return "Hello World";
}
public class CustomSoapHeader : SoapHeader
{
public string SomeProperty { get; set; }
}
}
Client:
class Program
{
static void Main(string[] args)
{
Service1SoapClient client = new Service1SoapClient();
client.HelloWorld(new CustomSoapHeader());
}
}