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

  • SEARCH
  • Home
  • 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 7885807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:09:53+00:00 2026-06-03T05:09:53+00:00

There is a webservice that receive remote calls on a link in this form

  • 0

There is a webservice that receive remote calls on a link in this form http://example.com/webservicename.fga

I have tried to use json to make the login call but I don’t get any answer.
I must get the response of the webservice that should return a sessionKey and an id

The server-side method startSession on the webservice is

@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);
}

I have tried to access it using this client-side code

static final String BASE_URI="http://example.com/webservicename.fga"

HttpPost httppost = new HttpPost(BASE_URI); 

JSONObject json = new JSONObject(); 
String email="testmail@test.it";
String emailRic="email"+" "+"\""+email+"\"";
String password="1234";
String passwordRic="password"+" "+"\""+password+"\"";
String stayLogged="1";
String stayLoggedRic="stayLogged"+" "+"\""+stayLogged+"\"";
String idClient="ANDROID";
String idClientRic="idClient"+" "+"\""+idClient+"\"";

try {
    List<String> accessParameters=new ArrayList<String>();
    accessParameters.add(emailRic);
    accessParameters.add(passwordRic);
    accessParameters.add(stayLoggedRic);
    accessParameters.add(idClientRic);

    String parameterS=accessParameters.toString();
    String RPCx=BASE_URI+"{\"method\":\""+"startSession"+"\", \"accessParameters\":";
    RPCx+=parameterS;
    RPCx+=", \"id\":1}";
    String RPCString=RPCx.toString();


    JSONArray postjson=new JSONArray(); 
    postjson.put(RPCString); 
    httppost.setHeader("RPCString",RPCString.toString());
    httppost.getParams().setParameter("jsonpost",postjson); 
    System.out.print(RPCString); 
    HttpResponse response = mClient.execute(httppost); 

    if(response != null){
        InputStream is = response.getEntity().getContent();

        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        StringBuilder sb = new StringBuilder();
        System.out.println("the answer is:\n"+sb);
        String line = null;

    try {
            while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
   // text = sb.toString();
    }
   // tv.setText(text);

}catch (ClientProtocolException e) {
    // TODO Auto-generated catch block
} catch (IOException e) {
    // TODO Auto-generated catch block
}

But with no success.

Certainly there is something wrong in my client-side code (the webservice works fine).

  • 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-03T05:09:54+00:00Added an answer on June 3, 2026 at 5:09 am

    The syntax is wrong,

    I cannot send a whole string as json request in this way

    String RPCx=BASE_URI+"{\"method\":\""+"startSession"+"\", \"accessParameters\":";
    

    I should create a JSONObject with method attribute and a nested JSONArray for parameters, done this I must send the root JSONObject to the server.

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

Sidebar

Related Questions

I have custom drupal module. I receive result from a webservice that I need
I'm using a web service that returns a dataset. in this dataset there are
I have a WCF service that can receive several requests/minute (or seconds) that need
I receive json from a webservice into a NSMutableData. That gets converted into a
I have a web service that is running on a cluster of servers. This
I have a webservice in java that receives a list of information to be
I have a program that requests HTML from a webservice, modifies the HTML to
I'm writing a RESTful webservice that returns custom/existing HTTP headers on successful/unsuccessful operations. For
Okay this is a real headscratcher. I have an application which calls a web
Is there a web-service/API that will provide information on who the US State and

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.