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 6766785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:52:22+00:00 2026-05-26T14:52:22+00:00

i need to authenticate my services with username and passwor i have try this

  • 0

i need to authenticate my services with username and passwor i have try this but not get sucess can you help me

when i print inlog cat i got ::

Update 3 ::

11-04 16:07:58.767: INFO/System.out(1531): Returned ======>>> <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---&gt; Data at the root level is invalid. Line 1, position 1.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>

Code ::

   DefaultHttpClient UserIDclient = new DefaultHttpClient();
                 HttpPost httppost = new HttpPost(url);
                 List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
                 nvps.add(new BasicNameValuePair("username","password"));
                 UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps,HTTP.UTF_8);
                 httppost.setEntity(p_entity);
                 HttpResponse response = UserIDclient.execute(httppost);
                 HttpEntity resEntity = response.getEntity();
                    Returned = EntityUtils.toString(resEntity);
                    System.out.println("ans is :: "+ Returned);

            System.out.println("Returned ======>>> "+Returned);
  • 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-05-26T14:52:23+00:00Added an answer on May 26, 2026 at 2:52 pm

    1st Thing:

    Check whether the “returned” string is null or not.

    2nd Thing:

    One thing i notice that you have written below lines for twice, what is the need to call execute() method before passing username and password:

    HttpResponse response = httpclient.execute(post);
    HttpEntity entity = response.getEntity();
    Returned = EntityUtils.toString(entity);
    

    Instead your code should be:

    HttpClient httpclient = new DefaultHttpClient();
             HttpPost post = new HttpPost(url);
    
     List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            // Your DATA
            nameValuePairs.add(new BasicNameValuePair("ID", "username"));
    
            nameValuePairs.add(new BasicNameValuePair("Password", "password"));
    
            response.setEntity(new UrlEncodedFormEntity(nameValuePairs,
                    HTTP.UTF_8));
            HttpResponse response1 = httpclient.execute(post);
    
            if(response1.getStatusLine().getStatusCode()==200)
            {
                HttpEntity resEntity = response1.getEntity();
                System.out.println("=========> Response => "+iStream_to_String(resEntitiy.getContent()));  
    
            }
    

    // You can get iStream_to_String from here.

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

Sidebar

Related Questions

I have situation where I need to authenticate a client across multiple web services.
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
We are using WCF services. Right now, we are using Windows Auth but this
I have this web app created using MVC3 and need to make a Windows
I have a dynamic php page which I need to call with a get
I have an sql azure database. I need an silverlight application with username/password authentication
What is the best practice when you need to authenticate specific OperationContracts , while
I want to authenticate users against our AD so I understand that I need
Need to use own imaged markers instead built-in pins. I have several questions. 1.
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card

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.