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

The Archive Base Latest Questions

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

i am getinng the following exception: Target host must not be null or set

  • 0

i am getinng the following exception:

    Target host must not be null or set in parameters.scheme=null,
host=null,path=/webservices/tempconvert.asmx/FahrenheitToCelsius

My source code:

public class ParActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView t=new TextView(this);
        String encodedUrl = null;
      //  setContentView(R.layout.main);

                HttpClient client = new DefaultHttpClient();  
               //String query = "?Fahrenheit=26";
            //  String host = "www.w3schools.com/webservices/tempconvert.asmx/";
            //   encodedUrl = host + URLEncoder.encode(query,"utf-8");
            //  int p=(Integer) null;
              // URI uri = URIUtils.createURI("vv", "www.w3schools.com", 50, "/webservices/tempconvert.asmx", "?Fahrenheit=26", null);

                try{ 
               String postURL = "/webservices/tempconvert.asmx/FahrenheitToCelsius";
                HttpPost post = new HttpPost(postURL);
              // post.addHeader("scheme","vv");
               // post.setHeader("host", "www.w3schools.com");
                String PostData="36";
                StringEntity httpPostEntity = new StringEntity(PostData, HTTP.UTF_8);
                post.setEntity(httpPostEntity);
                post.setHeader("host", "www.w3schools.com");
                post.setHeader("Content-Length", new Integer(PostData.length()).toString());
                post.setHeader("Content-Type", "application/x-www-form-urlencoded");


                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
               // nameValuePairs.add(new BasicNameValuePair("host", "www.w3schools.com"));
                nameValuePairs.add(new BasicNameValuePair("Fahrenheit", "26"));
               post.setEntity(new UrlEncodedFormEntity(nameValuePairs));


               HttpResponse responsePOST = null;
                // Execute HTTP Post Request
               // HttpResponse response = httpclient.execute(post);
                client.getConnectionManager();



                   responsePOST = client.execute(post); 
                HttpEntity resEntity = responsePOST.getEntity();  
                String response=EntityUtils.toString(resEntity);
                response=response.trim();
              //  Log.i("RESPONSE=",response);
                t.setText("response"+response);
                setContentView(t);
        } catch (Exception e) {
            // TODO Auto-generated catch block
           //e.printStackTrace();
            t.setText("ex"+e.getMessage());
        setContentView(t);
        }
    }

}

i want to invoke the webservice at:
http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit

using HttpClient.How should i give host and scheme as input?

please help…

  • 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:31:14+00:00Added an answer on May 26, 2026 at 2:31 pm

    This is your Host error
    You are passing "www.w3schools.com" in post.setHeader("host", "www.w3schools.com"); line instead you have to pass "http://www.w3schools.com"

    You can refer the same issue from here

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

Sidebar

Related Questions

i am geting following error Am i missing some jar file? Exception in thread
I am geting an exception while hitting the line self.myData = ... GDB Program
My form field looks something like the following: class FooForm(ModelForm): somefield = models.CharField( widget=forms.TextInput(attrs={'readonly':'readonly'})
I am geting an an error in the following code it worked fine in
Getting the following error in a JavaScript link using perl - WWW::Mechanize . Error
Edit: Made an official bug report at developers.Facebook.com GETing either of the following: graph.facebook.com/me/photos
How to create a SQL Function without input parameters Im geting a error for
I'm geting when I just do phpinfo() Warning: phpinfo(): It is not safe to
onRestoreInstanceState(Bundle savedInstanceState) is not geting called, I am pasting my code below. Actually I
With the following php code $url = http://ichart.finance.yahoo.com/table.csv?s=EURUSD%3DX&a=6&b=27&c=2011&d=7&e=05&f=2011&g=d&ignore=.csv; $this->trace(Geting from: $url); $raw_quote_data = file_get_contents($url);

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.