Hi.

I am trying to authenticate to HTTP server using basic authentication
with xmlrpc3.0. When I use this code:

XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://127.0.0.1:8080/resource";));
config.setBasicUserName("admin");
config.setBasicPassword("admin1");

I got an exception with this stacktrace:
Exception in thread "main" java.lang.IllegalArgumentException: Illegal
character(s) in message header value: Basic YWRtaW46YWRtaW4x

        at 
sun.net.www.protocol.http.HttpURLConnection.checkMessageHeader(HttpURLConnection.java:301)
        at 
sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(HttpURLConnection.java:1936)
        at 
org.apache.xmlrpc.client.XmlRpcSunHttpTransport.setRequestHeader(XmlRpcSunHttpTransport.java:30)
        at 
org.apache.xmlrpc.client.XmlRpcHttpTransport.setCredentials(XmlRpcHttpTransport.java:37)
        at 
org.apache.xmlrpc.client.XmlRpcHttpTransport.initConnection(XmlRpcHttpTransport.java:68)
        at 
org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:188)
        at 
org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
        at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
        at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:157)
        at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:146)
        at rpccall.Main.main(Main.java:48)

This seems to me as if xmlrpc formed a header with illegal character
which then gets rejected.
I also tried to put username and password into URL, like
config.setServerURL(new URL("http://admin:[EMAIL PROTECTED]:8080/resource"));
but this sent request with no authentication information at all.
Therefore I want to ask if I am doing something wrong or what is the
recomended way to authenticate.

Thank in advance,
Marek Ludha

Reply via email to