SoapHeaderAttribute Required is obsolete. How to verify the header?

T

Tim Tyannikov

Now that the Required property of SoapHeaderAttribute is obsolete, how
can I verify that my custom SOAP header is sent to my Web Service? If
it possible, can someone please show me how to do it? My Web Service
is written in C#/VB.Net.

Thank you,
Tim T.
 
T

Trebek

Tim,

Although the property has been deprecated, you can check if the soap header
exists by simply verifying that it is not null. If it is null, just throw
an soap exception with the soap fault describing this situation to the user.

EX:

//maps caller's soap header to a local member
//where LogonToken is a class derived from soap header
private LogonToken token;
[WebMethod ]

[SoapHeader("token",Direction=SoapHeaderDirection.In)]

public string SomeMethod(string argument)

{

if (token == null)

//throw exception

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top