B
Ben
I appologize for the crosspost to microsoft.public.webservices, I didn't
intend to post there at all.
I'm new to Soap and I'm trying to write a SoapExtension that will perform
authentication.
I have the code below and I can't seem to access the information in the
header. I've tried putting the header attribute on the soap extension,
looking at the message.Headers (its there I can see it in the debugger),
taking the message.Stream and loading it into an xml DOM, nothing is
working... In the web method I can successfully access the GUID. Which I
can't seem to access in the extension?
Please any advice on how I can access the GUID in the header from my code?
****Extenstion****
public class SecurityHeader : SoapHeader
{
public System.Guid UserGuid;
}
public class SecurityExtension : SoapExtension
{
public override void ProcessMessage(SoapMessage message)
{
switch (message.Stage)
{
// stage doesn't seem to affect the availablility of header
reachability
}
}
}
[AttributeUsage(AttributeTargets.Method)]
public class SecurityExtensionAttribute : SoapExtensionAttribute
{
public override Type ExtensionType
{
get
{
return typeof(SecurityExtension);
}
}
}
****Extenstion****
****Web Method****
[WebMethod(Description="Hello World")]
[SoapHeader("_SecurityHeader")]
[SecurityExtensionAttribute]
public string HelloWorld()
{
HttpContext.Current.Trace.Warn("WebMethod",
_Security.UserGuid.ToString());
return "Hello World";
}
****Web Method****
intend to post there at all.
I'm new to Soap and I'm trying to write a SoapExtension that will perform
authentication.
I have the code below and I can't seem to access the information in the
header. I've tried putting the header attribute on the soap extension,
looking at the message.Headers (its there I can see it in the debugger),
taking the message.Stream and loading it into an xml DOM, nothing is
working... In the web method I can successfully access the GUID. Which I
can't seem to access in the extension?
Please any advice on how I can access the GUID in the header from my code?
****Extenstion****
public class SecurityHeader : SoapHeader
{
public System.Guid UserGuid;
}
public class SecurityExtension : SoapExtension
{
public override void ProcessMessage(SoapMessage message)
{
switch (message.Stage)
{
// stage doesn't seem to affect the availablility of header
reachability
}
}
}
[AttributeUsage(AttributeTargets.Method)]
public class SecurityExtensionAttribute : SoapExtensionAttribute
{
public override Type ExtensionType
{
get
{
return typeof(SecurityExtension);
}
}
}
****Extenstion****
****Web Method****
[WebMethod(Description="Hello World")]
[SoapHeader("_SecurityHeader")]
[SecurityExtensionAttribute]
public string HelloWorld()
{
HttpContext.Current.Trace.Warn("WebMethod",
_Security.UserGuid.ToString());
return "Hello World";
}
****Web Method****