Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8213919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:17:04+00:00 2026-06-07T11:17:04+00:00

I have a java webservice, with some method. The webservice methods are in this

  • 0

I have a java webservice, with some method.

The webservice methods are in this form:

    @Webservice(paramNames = {"email", "password", "stayLogged", "idClient"},
public Response startSession(String email, String password, Boolean stayLogged, String idClient) throws Exception {
    boolean rC = stayLogged != null && stayLogged.booleanValue();
    UserService us = new UserService();
    User u = us.getUsersernamePassword(email, password);
    if (u == null || u.getActive() != null && !u.getActive().booleanValue()) {
        return ErrorResponse.getAccessDenied(id, logger);
    }
    InfoSession is = null;
    String newKey = null;
    while (newKey == null) {
        newKey = UserService.md5(Math.random() + " " + new Date().getTime());
        if (SessionManager.get(newKey) != null) {
            newKey = null;
        } else {
            is = new InfoSession(u, rC, newKey);
            if (idClient != null && idClient.toUpperCase().equals("ANDROID")) {
                is.setClient("ANDROID");
            }
            SessionManager.add(newKey, is);
        }
    }
    logger.log(Level.INFO, "New session started: " + newKey + " - User: " + u.getEmail());
    return new Response(new InfoSessionJson(newKey, is), null, id);
}

The webservice can receive json-rpc calls,
and the client-side code that can invoke the methods of the webservice, in iOS has this form:

-(void)asynchronousRPCWithMethod:(NSString *)method andParams:(NSArray *)params{

    NSLog(@"REMOTE PROCEDURE CALL ON %@", method);
    self.rpcMethod = method;

    NSMutableString *requestString = [[NSMutableString alloc] init];

    //setting method
    [requestString appendFormat:@"{\"method\":\"%@\"", method];

    //setting params
    [requestString appendString:@", \"params\":["];

    int max = [params count];
    int c = 0;

    for (NSString *str in params){
        c++; 
        [requestString appendFormat:@"\"%@\"", str];
        if (c==max){

        }
        else{
            [requestString appendString:@", "];
        }
    }

    [requestString appendFormat:@"], \"id\":1}"];

    NSLog(@"Request:\n%@", requestString);

    NSData *requestData = [NSData dataWithBytes:[requestString UTF8String] length:[requestString length]];

    [requestString release];

    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:WEBSITELINK]] autorelease];

    [request setHTTPMethod:@"POST"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:requestData];

    NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:NO];
    [conn scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
    [conn start];

    UIApplication *app = [UIApplication sharedApplication];
    app.networkActivityIndicatorVisible = YES;

    if (conn) {
        NSMutableData *data = [[NSMutableData alloc] init];
        self.receivedData = data;
        [data release];
    }
    else {
        NSError *error = [NSError errorWithDomain:RPCErrorDomain
                                             code:RPCErrorNoConnection
                                         userInfo:nil];
        NSLog(@"*** error ***\n%@", error);
        /**
         * SENT A MESSAGE WITH A ERROR
         */
        if ([self.delegate respondsToSelector:@selector(rpcDidFailWithError:)])
            [delegate rpcDidFailWithError:error];

    }

}

How can I implement the same client side method on Android???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:17:06+00:00Added an answer on June 7, 2026 at 11:17 am

    You have to make JSON in the appropriate form with something like

    JSONArray params = new JSONArray();
                    params.put("");
                    params.put("");
                    ....
    
                    JSONObject rpcCall = new JSONObject();
                    rpcCall.put("method", METODNAME);
                    rpcCall.put("params", params);
                    rpcCall.put("id", 1);
    

    and send it to the server with HttpPost httppost and

    HttpResponse response = androidClient.execute(httppost);
    

    If you need more info about JSON request there are many tutorials.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a legacy Java webservice based on Axis2. This webservice classes consist of:
I have a webservice (ie. servlet) implemented in Java. It gets some data from
I have a java class that contain a method with some logic control .
I have created one application in flex that is accessing the Java webservice using
I have an ASP.NET Webform which currently calls a Java WebService. The ASP.NET Webform
I have a WebService in Java (Using Apache Axis) that get's the id of
I have devoloped a WebService (WS1) in Java which is deployed in a Tomcat
I have created a Java web service and I am trying to access this
I am trying to use Java based webservice and have soap request: <?xml version=1.0?>
I have created an application where i am fetching some data from a webservice,which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.