Looks like you have to enable redirects on  httpclient (i guess its
disabled by default)

On 10/24/07, George.Francis <[EMAIL PROTECTED]> wrote:
>
> Hello,
> When I call my Acegi secured webservice I get an HTTP 302 response whose
> 'Location' is the login page of my application.  I have the client code
> below.  I get a logging message when I run this that says:
>
> Oct 24, 2007 12:37:52 PM org.apache.commons.httpclient.HttpMethodDirector
> isRedirectNeeded
> INFO: Redirect requested but followRedirects is disabled
>
> Can someone tell me what I'm doing wrong?  My client code is here:
>
> package com.mycompany.wstest;
>
> import java.lang.reflect.Method;
> import java.lang.reflect.Proxy;
>
> import org.codehaus.xfire.MessageContext;
> import org.codehaus.xfire.XFire;
> import org.codehaus.xfire.XFireFactory;
> import org.codehaus.xfire.client.Client;
> import org.codehaus.xfire.client.XFireProxy;
> import org.codehaus.xfire.client.XFireProxyFactory;
> import org.codehaus.xfire.exchange.OutMessage;
> import org.codehaus.xfire.handler.AbstractHandler;
> import org.codehaus.xfire.service.Service;
> import org.codehaus.xfire.service.binding.ObjectServiceFactory;
> import org.codehaus.xfire.transport.http.SoapHttpTransport;
> import org.jdom.Element;
> import org.jdom.Namespace;
>
> import com.radintl.webservices.ISMService;
>
> public class WSClient
> {
>         public static class ClientAuthHandler extends AbstractHandler
>         {
>                 private String username = "admin";
>
>                 private String password = "admin";
>
>                 public ClientAuthHandler()
>                 {
>
>                 }
>
>                 public void invoke(MessageContext context) throws Exception
>                 {
>                         final Namespace ns = Namespace.getNamespace("caisi",
> "http://ws.program.integrator.caisi.org";);
>
>                         OutMessage outMessage = context.getOutMessage();
>                         outMessage.setHeader(new Element( "Header",ns) );
>                         Element outMessageHeader = outMessage.getHeader();
>
>                         outMessageHeader.addNamespaceDeclaration(ns);
>
>                         Element auth = new Element("AuthenticationToken", ns);
>                         Element username_el = new Element("Username", ns);
>                         username_el.addContent(username);
>                         Element password_el = new Element("Password", ns);
>                         password_el.addContent(password);
>                         auth.addContent(username_el);
>                         auth.addContent(password_el);
>                         outMessageHeader.addContent(auth);
>                 }
>         }
>
>         public static void main(String[] args) throws Throwable
>         {
>                 XFire xfire = XFireFactory.newInstance().getXFire();
>                 XFireProxyFactory factory = new XFireProxyFactory(xfire);
>
>                 Service serviceModel = new
> ObjectServiceFactory().create(ISMService.class);
>                 ISMService service = (ISMService) factory.create(serviceModel,
> "http://rad223:8080/services/ISMService";);
>                 XFireProxy proxy =  
> (XFireProxy)Proxy.getInvocationHandler(service);
>                 Client client = proxy.getClient();
>                 client.addOutHandler(new WSClient.ClientAuthHandler());
>                 client.setTransport(new SoapHttpTransport());
>
>                 Method method = ISMService.class.getDeclaredMethods()[0];
>                 Object response = proxy.invoke(proxy, method, new 
> Object[]{-1L});
>                 System.out.println( response );
>         }
> }
>
>
> --
> View this message in context: 
> http://www.nabble.com/HTTP302%2C-followRedirects-from-Acegi-secured-webservice-tf4684809.html#a13387400
> Sent from the XFire - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


-- 
-----
When one of our products stops working, we'll blame another vendor
within 24 hours.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to