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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:11:46+00:00 2026-06-08T09:11:46+00:00

I have checked many alternatives before posting here.. I don’t get why i am

  • 0

I have checked many alternatives before posting here..
I don’t get why i am getting this Error like UnKnownHost Exception..Please someone guide me to the Solution.

MyCalling Class

public class AndroidLoginExampleActivity extends Activity 
{
    private static final String SOAP_ACTION ="urn:Mage_Api_Model_Server_HandlerAction";
    private static final String NAMESPACE = "urn:Magento";
    private  static final String Method_Name="login";
    private static final String URL ="http://cws24/machinetest/api/?wsdl";

    TextView tv;
    Context mContext;
    /** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    tv=(TextView)findViewById(R.id.tv_status);

    SoapObject request = new SoapObject(NAMESPACE,Method_Name);
    request.addProperty("username", "android");
    request.addProperty("apiKey", "android");

    SoapSerializationEnvelope envelopes = new SoapSerializationEnvelope(
    SoapEnvelope.VER11);
    envelopes.dotNet = false;
    envelopes.setOutputSoapObject(request);
    mContext=AndroidLoginExampleActivity.this;
    try 
    {
        AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
        androidHttpTransport.debug =true;
        androidHttpTransport.call(SOAP_ACTION, envelopes);//Getting the Exception here
        SoapPrimitive resultString=(SoapPrimitive)envelopes.getResponse();
        tv.setText("Status "+resultString);
        new AlertDialog.Builder(mContext).setMessage(""+resultString).show();
    } 
    catch (Exception e) {e.printStackTrace();
    new AlertDialog.Builder(mContext).setMessage(""+e.toString()).show();
    }   
}
}  

Log output::

07-17 02:20:43.376: WARN/System.err(25212): java.net.UnknownHostException: Host is unresolved: cws24:80
07-17 02:20:43.416: WARN/System.err(25212):     at java.net.Socket.connect(Socket.java:1037)
07-17 02:20:43.466: WARN/System.err(25212):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
07-17 02:20:43.486: WARN/System.err(25212):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
07-17 02:20:43.496: WARN/System.err(25212):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:67)
07-17 02:20:43.496: WARN/System.err(25212):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:821)
07-17 02:20:43.496: WARN/System.err(25212):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:807)
07-17 02:20:43.496: WARN/System.err(25212):     at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:46)
07-17 02:20:43.506: WARN/System.err(25212):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:68)
07-17 02:20:43.506: WARN/System.err(25212):     at com.magento.example.AndroidLoginExampleActivity.onCreate(AndroidLoginExampleActivity.java:44)
07-17 02:20:43.506: WARN/System.err(25212):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-17 02:20:43.506: WARN/System.err(25212):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
07-17 02:20:43.516: WARN/System.err(25212):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
07-17 02:20:43.516: WARN/System.err(25212):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
07-17 02:20:43.516: WARN/System.err(25212):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
07-17 02:20:43.546: WARN/System.err(25212):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-17 02:20:43.546: WARN/System.err(25212):     at android.os.Looper.loop(Looper.java:123)
07-17 02:20:43.556: WARN/System.err(25212):     at android.app.ActivityThread.main(ActivityThread.java:4363)
07-17 02:20:43.556: WARN/System.err(25212):     at java.lang.reflect.Method.invokeNative(Native Method)
07-17 02:20:43.567: WARN/System.err(25212):     at java.lang.reflect.Method.invoke(Method.java:521)
07-17 02:20:43.567: WARN/System.err(25212):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-17 02:20:43.576: WARN/System.err(25212):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-17 02:20:43.576: WARN/System.err(25212):     at dalvik.system.NativeStart.main(Native Method)
  • 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-08T09:11:49+00:00Added an answer on June 8, 2026 at 9:11 am

    Moving to the Usage Of XMLRPC API from SOAP API has solved my problem.
    Below is the code that I used XMLRPC

    You have to DownLoad the XMLRPC library for that.

    Click here to DownLoad XMLRPC library for Android

    package org.xmlrpc;
    
    import org.xmlrpc.android.XMLRPCClient;
    import org.xmlrpc.android.XMLRPCException;
    
    import android.app.Activity;
    import android.app.ProgressDialog;
    import android.content.Context;
    import android.content.Intent;
    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.Toast;
    
    public class Test extends Activity {
    
    
        String sessionId ="";
        ProgressDialog pd;
        Context mContext;
        EditText username,apikey;
        Button login;
    
    
       @Override
       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);
           mContext=Test.this;
    
    
           username=(EditText)findViewById(R.id.username);
           apikey=(EditText)findViewById(R.id.apikey);
           login=(Button)findViewById(R.id.login);
       }
       public void checkUser(View v) 
       {
           if(username.getText().toString().equals("") || apikey.getText().toString().equals(""))
           {
               if(username.getText().toString().equals(""))
               {
                   username.requestFocus();
               }
               else
               {
                   apikey.requestFocus();
               }
               Toast.makeText(mContext, "Please fill this empty field", Toast.LENGTH_LONG).show();
            }
           else
           {
               new DownloadWebPageTask().execute();   
           }
        }
    
       private class DownloadWebPageTask extends AsyncTask<Void, Integer, Void> {
           @Override
              protected void onPreExecute() 
              {
                    pd=ProgressDialog.show(mContext, "", "Please Wait...\nLoading data...", false);
              }
              @Override
              protected void onPostExecute(Void v) 
              {
                  if(pd.isShowing())
                        {
                           pd.dismiss();
                        }
                if(sessionId.equals(""))
                {
                    Toast.makeText(mContext, "in Correct Details..Please try again", 
                            Toast.LENGTH_LONG).show();
                }
                else
                {
                    Utils.sessionId=sessionId;
                    startActivity(new Intent(mContext,Dashboard.class));
                    finish();   
                }
    
              }
    
    
           @Override
           protected Void doInBackground(Void... arg0) 
           {
               XMLRPCClient client = new XMLRPCClient( "http://192.168.1.237/machinetest/index.php/api/xmlrpc");
               try 
               {
                       sessionId = (String)client.call( "login", username.getText().toString(),
                               apikey.getText().toString());
                       Log.d( "MY_XMLRPC_SUCCESS_SESSION_ID", sessionId);
               }
               catch (XMLRPCException e) 
               {
                   Log.d( "APP_INFO ",  "Exception:  " + e.getMessage());
                   Log.e( "APP_INFO ",  "Exception:  " + e.toString());
               }     
               return null;
           }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have checked many of other questions involving issues like this, but none have
I have checked many questions here but none has my answer. I appreciate if
I have checked many question based on this but still I am not able
I have need of a checked combobox control like this one --> DevExpress (I
I have already checked many questions in StackOverflow but none of them worked for
We have many projects with several files inside each. Files can be checked in
I have checked this similar question, but the suggestions did not solve my problem:
I have checked as many SO pages as I could and tried everything I
I have checked many questions and answers regarding how to stop any browser at
I'm really lost here. I already checked many answers to how to add something

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.