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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:49:14+00:00 2026-05-27T08:49:14+00:00

I am facing a problem to call https from Android. Can any one please

  • 0

I am facing a problem to call https from Android. Can any one please help with steps to connect to the https server.

I tried to connect to google with https and its working fine but when I try to connect to my local server, I am facing problems.

  1. want to connect a RESTful web service with https
  2. want to connect a SOAP based web service developed using JAX-WS with https.

  3. Code to connect with RESTFul

    HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
    
    DefaultHttpClient client = new DefaultHttpClient();
    
    SchemeRegistry registry = new SchemeRegistry();
    SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
    socketFactory.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier);
    registry.register(new Scheme("https", socketFactory, 443));
    SingleClientConnManager mgr = new SingleClientConnManager(client.getParams(), registry);
    DefaultHttpClient httpClient = new DefaultHttpClient(mgr, client.getParams());
    
    // Set verifier     
    HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);
    
    // Example send http request
     //final String url = "https://encrypted.google.com/";
     final String url = "https://ipaddress:8181/RESTTest/cars";
     HttpPost httpPost = new HttpPost(url);
      try{
         HttpResponse response = httpClient.execute(httpPost);
         System.out.println(response);
     }catch(Exception e){
         e.printStackTrace();
     }
    

    its working fine for google but not working for my server and it’s giving

    javax.net.ssl.SSLException: Not trusted server certificate

  4. Code for connect with SOAP:

    public String getString(final String methodName, Map<String, Object>        params)        throws     Exception {
    HttpTransportSE httpsTransportSE = new         HttpTransportSE("https://ipaddress:8181/BankingWS/banking?wsdl");
    
    try {
        SoapObject request = new SoapObject("https://test/",
                methodName);
        if(params != null && params.size() > 0){
            Set<String> keys = params.keySet();
            Iterator<String> iterator = keys.iterator();
            while(iterator.hasNext()){
                String key = iterator.next();
                request.addProperty(key, params.get(key));
                key = null;
            }
        }
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);
    
        TrustManagerManipulator.allowAllSSL();
        httpsTransportSE.call(methodName, envelope);
    
        SoapPrimitive sp = (SoapPrimitive) envelope.getResponse();
    
        return sp.toString();
    } catch (Exception exception) {
        System.out.println(exception.toString());
        throw exception;
    }
    }
    

    In above code using the TrustManagerManipulator from following link:
    http://abhinavasblog.blogspot.com/2011/07/allow-untrusted-certificate-for-https.html

This is also not working and when I check the response code it’s giving

SoapFault - faultcode: 'S:Client' faultstring: 'Cannot find dispatch method for {test.WSEndPointPort}authenticate' faultactor: 'null' detail: null

Please help to fix this problem, as I am not able to call https from Android by any way 🙁

Thank you very much for your time and efforts.

Thank you,
Ishan

  • 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-27T08:49:15+00:00Added an answer on May 27, 2026 at 8:49 am

    You need to create a X509TrustManager which bypass all the security check. You can find an example in this similar questions:

    Make a connection to a HTTPS server from Java and ignore the validity of the security certificate

    or

    How to ignore SSL certificate errors in Apache HttpClient 4.0

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

Sidebar

Related Questions

I'm facing this problem again and again, but can't find any solution (except mine,
I am facing a strange problem on my Ubuntu Karmic system. When I call
I'm facing a problem with IE6. I took the toggle function from this website
I am facing one problem while writing one xslt: xml: <students> <studentDetails tag=to id=1
I am facing a problem while calling processRequest function from javascript. I need two
I am facing a problem in connecting my Android code to a .NET web
I am facing problem while calling the alert box. Can I know what is
I am facing problem with an Oracle Query in a .net 2.0 based windows
I am facing problem with the control flajaxian.FileUploader i.e. after downloading the dll file
I am new to struts 2. I am facing problem in filling Select tag

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.