Friday, 13 May, 2005

Axis webservices with Cookie authenticaton

Why on earth was is so hard to find out how to send a HTTP Basic Auth header, or a SSO cookie, with my Axis webservice request?

The answer, I guess, I wasn't looking in the correct place. I was looking at the Axis documentation when I should have looked at the the binding stub secret method _setProperty (with an underscore no less, so those searching for a setter bypass it completely!).


binding.setMaintainSession(true);
// generates the basic auth header
binding.setUsername("testuser");
binding.setPassword("password");
// Any kind of header! from org.apache.axis.transport.http.HTTPConstants
binding._setProperty(HTTPConstants.HEADER_COOKIE,
"MyIdentity=testuser; path=/; domain=.montage-dmc.com;");


I've mismashed these jumble of webservices clients around through multiple namespaces, using the fantastic ant regex replace until it made me dizzy - and I'll be damned if a little authentication will stop me now!

0 comments: