You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ws.apache.org by "Michael P. Soulier" <mi...@mitel.com> on 2005/09/08 03:50:58 UTC

http auth

Hello,

I'm having a problem getting http auth working. 

When I call my service without auth, it works fine. 

[msoulier@tigger xmlrpc]$ ./run
Output from hello() : Hello, World!

But when I move it to a location on the server that requires auth, and
provide it in the client with setBasicAuthentication(), I get this.

java.io.IOException: Unexpected Response from Server:  Found
        at
org.apache.xmlrpc.XmlRpcClientLite$HttpClient.sendRequest(Unknown
Source)
        at org.apache.xmlrpc.XmlRpcClientLite$LiteWorker.execute(Unknown
Source)
        at org.apache.xmlrpc.XmlRpcClient.execute(Unknown Source)
        at EsDbClient.hello(EsDbClient.java:23)
        at EsDbClient.main(EsDbClient.java:35)
Output from hello() : Call to hello method failed

My code, with the password obfuscated...

    public String hello()
    {
        String retVal = "Call to hello method failed";
        try
        {
            XmlRpcClientLite xmlrpc = new XmlRpcClientLite(URL_AUTH);
            String methodName = "hello";
            Vector params = new Vector(0);

            xmlrpc.setBasicAuthentication("admin", "********");

            retVal = (String) xmlrpc.execute( methodName, params );      
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return retVal;
    }

Help appreciated. 

Thanks,
Mike

-- 
Michael P. Soulier <mi...@mitel.com>, 613-592-2122 x2522
Linux applications development
"...the word HACK is used as a verb to indicate a massive amount of
nerd-like effort." -Harley Hahn, A Student's Guide to Unix

Re: http auth

Posted by Akihito Nakamura <na...@aist.go.jp>.
> I'm having a problem getting http auth working. 
> 
> When I call my service without auth, it works fine. 
> 
> [msoulier@tigger xmlrpc]$ ./run
> Output from hello() : Hello, World!
> 
> But when I move it to a location on the server that requires auth, and
> provide it in the client with setBasicAuthentication(), I get this.


If you are using WebServer contained in the Apache XML-RPC 2.0,
it fails in parsing the auth information.

See the following report that I was sent in this list.

This bug has not fixed in the CVS, WebServ.java, revision 1.28.
It's easy to correct the source code and rebuild the JAR!

----
Akihito NAKAMURA
  National Institute of 
    Advanced Industrial Science and Technology (AIST)
  Information Technology Research Institute



>*Subject: [BUG REPORT] WebServer.java (basic authentication faling in 2.0)
>*From: Akihito Nakamura <na...@aist.go.jp>
>*Date: Fri, 08 Jul 2005 11:40:04 +0900
>
> I found a bug in WebServer.java.
> 
> A private field "base64Codec" of the nested class "Connection"
> is not initialized before used in the method "parseAuth()".
> 
> Thus, a NullPointerException is always thrown inside the "try"
> block in the above method.  But the Exception is ignored.
> At last, the arguments "user" and "password" of 
> AuthenticatedXmlRpcHandler#execute() are always null.
> 
> The correction is obvious:
> insert the following snippet befor the above try block.
> 
>     if (base64Codec == null) {
>         base64Codec = new Base64();
>     }
> 
> 
> This problem is also reported by "Terrance Davis" 
> <td...@hydroblaster.com>, on 3 Jun 2005.
> 
> 
> ----
> Akihito NAKAMURA
>   National Institute of 
>     Advanced Industrial Science and Technology (AIST)
>   Information Technology Research Institute
> 
>