Hi William,
Yeah its out of date. You want to access the headers like this instead:
Element inHeader = context.getInMessage().getHeader();
Element inHeader = context.getOutMessage().getHeader();
I will try and update the example soon (or you can edit it, its a wiki
afterall! :-) just click edit on the bottom right).
- Dan
William White wrote:
I'm trying to follow the Authentication example for "SOAP Header
Authentication with Handlers". However, I cannot find the method
getRequestHeader() in the MessageContext object that is in the
org.codehaus.xfire package.
In the example code pasted below (which I copied from
http://xfire.codehaus.org/Authentication) it shows that this should
work, but I cannot find that method anywhere in the distribution.
I've seen some other examples using
"context.getInMessage().getHeader()" but I'm not sure if I should be
using this.
I tried manually searching for the answer in the archives but didn't
see anything about it. (I wish there was a search feature on those
mailing list archives :) )
Anyway, is the code sample from the Authentication tutorial below out
of date or am I doing something wrong?
--------
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.handler.AbstractHandler;
import org.codehaus.yom.Element;
public class AuthenticationHandler extends AbstractHandler
{
private final static String TOKEN_NS = "urn:yourapp:authentication";
public void invoke(MessageContext context)
throws XFireFault
{
if (context.getRequestHeader() == null)
{
throw new XFireFault("Request must include company
authentication token.",
XFireFault.SENDER);
}
Element token =
context.getRequestHeader().getFirstChildElement("AuthenticationToken",
TOKEN_NS);
....(truncated).....
}
-------
Thanks
Bill
[EMAIL PROTECTED]
--
Dan Diephouse
(616) 971-2053
Envoi Solutions LLC
http://netzooid.com