I have problem,I want set soap extension attribute in web method:
Soap extension in web service:
AttributeUsage(AttributeTargets.Method)]
public class EncryptMessageAttribute : SoapExtensionAttribute
{
private string strKey="null";
public void setKey(string s)
{
strKey=s;
}
}
Soap extension class:
public class EncryptMessage : SoapExtension
{
....
}
Soap extension on web method:
[WebMethod]
[EncryptMessageAttribute(setKey("test"))]
public string test2()
{
return "ok";
}
or :
[WebMethod]
[EncryptMessage(setKey("test"))]
public string test2()
{
return "ok";
}
I try used method
setKey from class
EncryptMessageAttribute , but it finished with this compile error:
Error1The name 'setKey' does not exist in the current context
Can somebody help me??
or if I try :
public class Service1 : System.Web.Services.WebService
{
public string k;
[WebMethod]
[EncryptMessage(setKey(k))]
public string test2()
{
return "ok";
}
}
It finish with this error:
Error1The name 'setKey' does not exist in the current context
Error2An object reference is required for the non-static field, method, or property