Mikhael9 / android-xmlrpc

Automatically exported from code.google.com/p/android-xmlrpc
0 stars 0 forks source link

XMLRPC Fault Code #24

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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? 

Original issue reported on code.google.com by bhavyaki...@gmail.com on 16 Oct 2010 at 6:11

GoogleCodeExporter commented 8 years ago
Can you give any examples of the code that isn't working? Also, what do you 
mean by level1 and level2?

Original comment by jon@sprig.gs on 19 Oct 2010 at 9:02

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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?

Original comment by bhavyaki...@gmail.com on 20 Oct 2010 at 4:06

GoogleCodeExporter commented 8 years ago
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:password@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)?

Original comment by jon@sprig.gs on 19 Nov 2010 at 4:19

GoogleCodeExporter commented 8 years ago
Hello 

I am using XMLRPC for android to fetch data from magento server.
It works fine for retrieving customer , product list.
But I am facing problem while fetching products information as well as address 
information.
I am using customer_address.info and catalog_product.info respectively.

The code which I have tried is as follow.

[code]
//For address of customer
Object[] addressInfo=(Object[]) 
client.call("call",session,"customer_address.info","customerid");

//For product Info
Object[] productsGroupList = (Object[]) 
client.call("call",session,"catalog_product.info",product_id);

[/code]

Thanks and waiting for your reply

Amit Thakkar

Original comment by amit@india.biztechconsultancy.com on 22 Feb 2013 at 8:37