New issue 24 by bhavyakilari: XMLRPC Fault Code
http://code.google.com/p/android-xmlrpc/issues/detail?id=24
I am developing an android application that handles data from XMLRPC web
services.I have successfully used web services with level1 authentication
but when I am trying to connect to level2 web services, I encounter a fault
code. How do I look at this issue? What could be the possible reasons and
how do I go about it?
The XMLRPC web services I use in my application are implemented with two
levels of security. Level1 services do not need basic authentication for
retrieving data but level2 services do. I get a fault code for not being
able to implement basic authentication correctly when I try to connect to
level2 services.
For implementing basic authentication, I have an additional constructor in
XMLRPCClient.java class as follows:
public XMLRPCClient(URI uri, String username, String password) {
this(uri);
System.out.println("Extra");
((DefaultHttpClient) client).addRequestInterceptor(preemptiveAuth,
0);
((DefaultHttpClient)
client).getCredentialsProvider().setCredentials(
new AuthScope(uri.getHost(), uri.getPort(),AuthScope.ANY_REALM),
new UsernamePasswordCredentials(username, password));
}
and the following inner class:
HttpRequestInterceptor preemptiveAuth = new HttpRequestInterceptor() {
public void process(final HttpRequest request, final HttpContext
context) throws HttpException, IOException {
AuthState authState = (AuthState)
context.getAttribute(ClientContext.TARGET_AUTH_STATE);
CredentialsProvider credsProvider = (CredentialsProvider)
context.getAttribute(ClientContext.CREDS_PROVIDER);
HttpHost targetHost = (HttpHost)
context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
if (authState.getAuthScheme() == null) {
AuthScope authScope = new
AuthScope(targetHost.getHostName(), targetHost.getPort());
Credentials creds =
credsProvider.getCredentials(authScope);
if (creds != null) {
authState.setAuthScheme(new BasicScheme());
authState.setCredentials(creds);
}
}
}
};
I am still unable to manage to crack the level2 services. It gives a
security fault code. Do I need something more in the code?
Comment #6 on issue 24 by j...@sprig.gs: XMLRPC Fault Code
http://code.google.com/p/android-xmlrpc/issues/detail?id=24
Hi Bhavyakilari,
Sorry, this dropped completely off my radar, I'm following up with a few of
these issues now.
You said there are "level1" and "level2" security levels - do these both
use the same URL (is one http://xmlrpc.example.com and the other
https://xmlrpc.example.com, or is one http://xmlrpc.example.com and the
other http://username:pass...@xmlrpc.example.com, or, is it a combination
of both)?
Do you get an error from the Java side of things, or is there an HTTP
error, and if so, do you know what the HTTP error is (is it 404, 500, or
something else)?