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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:52:58+00:00 2026-06-06T19:52:58+00:00

I am trying to send SMS using a webservice call. But am having errors

  • 0

I am trying to send SMS using a webservice call. But am having errors in doing so

This is the code snippet of what I am making use of

public void sendSMS(String from, String to, String msg) {
        if (stat == -1) {
            sms_url = username + "&password=" + password + "&from=" + from
                    + "&to=" + to + "&message=" + msg + "";
            new SendSMS().execute(sms_url);
        }
    }

private class SendSMS extends AsyncTask<String, Void, String> {
        @Override
        protected String doInBackground(String... urls) {

            for (String url : urls) {
                HttpClient client = new DefaultHttpClient();
                HttpGet httpGet = new HttpGet(url);
                try {
                    HttpResponse execute = client.execute(httpGet);
                    InputStream content = execute.getEntity().getContent();

                    BufferedReader buffer = new BufferedReader(
                            new InputStreamReader(content));
                    String s = "";
                    while ((s = buffer.readLine()) != null) {
                        result += s;
                    }

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return result;
        }

        @Override
        protected void onPostExecute(String result) {
            // textView.setText(result);
            Intent intent = new Intent("com.sms.subsahara.CONFIRMACTIVITY");
            startActivity(intent);
        }
    }

    class PostService extends AsyncTask<String, Void, String> {

        @Override
        protected String doInBackground(String... params) {

            Login();
            Log.d(LOGTAG, "Success");

            return "success";
        }

        @Override
        protected void onPostExecute(String r) {
            // TODO Auto-generated method stub
            super.onPostExecute(result);
            String msg = "Login successful";

            if (MenuActivity.status == 2) {
                Log.d(LOGTAG, result);
                Log.d(LOGTAG, error + " " + uid + " " + langId + " " + rank);

            } else if (SendUsing.status == 0) {
                if (result.substring(0, 16).trim().equals(msg)) {
                    Log.d(LOGTAG, " " + "Connection Test" + result);

                    stat = -1;
                    String from = composesms.sender;
                    String to = composesms.phoneNo;
                    String message = composesms.message;
                    sendSMS(from, to, message);
                    Log.d(LOGTAG, result);
                    // new SendSMS().execute(params);

                } else {
                    Toast.makeText(getBaseContext(),
                            "Login UnSuccesful. Check Username or password",
                            Toast.LENGTH_SHORT).show();
                }

            }
        }

And on the submit Button, I have

 public void onClick(View v) {

                if (SendUsing.status == 0) {
                        new PostService().execute("success");
                } 
}

The Problem is when I do so, I get the following Exception

java.lang.IllegalStateException: Target host must not be null, or set in parameters.
   at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:561)
   at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:292)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
 freed 4919 objects / 298512 bytes in 153ms
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
   **at com.sms.subsahara.WebMessengerActivity$SendSMS.doInBackground(WebMessengerActivity.java:272)
   at com.sms.subsahara.WebMessengerActivity$SendSMS.doInBackground(WebMessengerActivity.java:1)**

Please how do I solve this

  • 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-06T19:53:01+00:00Added an answer on June 6, 2026 at 7:53 pm
    sms_url = username + "&password=" + password + "&from=" + from
                        + "&to=" + to + "&message=" + msg + "";
    

    looks this line is only making paramas of url but not complete url

     sms_url = "http://your_serviceurl.com?"+sms_url;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am trying to send SMS using the url but it's not working the result
I`m trying to send e-mail via c# and use the following code: public static
I'm trying to send a byte[] (using PUT) with Restlet but I can't find
I am trying to send an SMS on an iPhone using MFMessageComposeVieController and I
I am trying to access and send SMS through Wavecom's FXT-009 using Serial Port
I am actually trying to send SMS using CDYNE and their API. To do
I am trying to use smslib to send an sms. It works fine on
I am trying to write a small program using Qt to send SMS messages
I'm currently trying to code an app to send mass SMS to 300+ numbers
I am trying to send sms from java application using SMPPSim as SMS gateway

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.