Search Results

Search found 335 results on 14 pages for 'httpclient'.

Page 4/14 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Fetching data (responsebody) with a HttpClient in an AsyncTask and returning the data outside the As

    - by Peter Warbo
    Basically I'm wondering how I'm able to do what I've written in the topic. I've looked through many tutorials on AsyncTask but I can't get it to work. I have a little form (EditText) that will take what the user inputs there and make it to a url query for the application to lookup and then display the results. What I think would seem to work is something like this: In my main activity i have a string called responseBody. Then the user clicks on the search button it will go to my search function and from there call the GrabUrl method with the url which will start the asyncdata and when that process is finished the onPostExecute method will use the function activity.this.setResponseBody(content). This is what my code looks like simpliefied with the most important parts (I think). public class activity extends Activity { private String responseBody; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); initControls(); } public void initControls() { fieldSearch = (EditText) findViewById(R.id.EditText01); buttonSearch = (Button)findViewById(R.id.Button01); buttonSearch.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ search(); }}); } public void grabURL(String url) { new GrabURL().execute(url); } private class GrabURL extends AsyncTask<String, Void, String> { private final HttpClient client = new DefaultHttpClient(); private String content; private boolean error = false; private ProgressDialog dialog = new ProgressDialog(activity.this); protected void onPreExecute() { dialog.setMessage("Getting your data... Please wait..."); dialog.show(); } protected String doInBackground(String... urls) { try { HttpGet httpget = new HttpGet(urls[0]); ResponseHandler<String> responseHandler = new BasicResponseHandler(); content = client.execute(httpget, responseHandler); } catch (ClientProtocolException e) { error = true; cancel(true); } catch (IOException e) { error = true; cancel(true); } return content; } protected void onPostExecute(String content) { dialog.dismiss(); if (error) { Toast toast = Toast.makeText(activity.this, getString(R.string.offline), Toast.LENGTH_LONG); toast.setGravity(Gravity.TOP, 0, 75); toast.show(); } else { activity.this.setResponseBody(content); } } } public void search() { String query = fieldSearch.getText().toString(); String url = "http://example.com/example.php?query=" + query; //this is just an example url, I have a "real" url in my application but for privacy reasons I've replaced it grabURL(url); // the method that will start the asynctask processData(responseBody); // process the responseBody and display stuff on the ui-thread with the data that I would like to get from the asyntask but doesn't obviously }

    Read the article

  • HttpClient POST fails to submit the form + resulting string is cut-off (incomplete)

    - by Jayomat
    Hi, I'm writing an app to check for the bus timetable's. Therefor I need to post some data to a html page, submit it, and parse the resulting page with htmlparser. Though it may be asked a lot, can some one help me identify if 1) this page does support post/get (I think it does) 2) which fields I need to use? 3) How to make the actual request? this is my code so far: String url = "http://busspur02.aseag.de/bs.exe?Cmd=RV&Karten=true&DatumT=30&DatumM=4&DatumJ=2010&ZeitH=&ZeitM=&Suchen=%28S%29uchen&GT0=&HT0=&GT1=&HT1="; String charset = "CP1252"; System.out.println("startFrom: "+start_from); System.out.println("goTo: "+destination); //String tag.v List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("HTO", start_from)); params.add(new BasicNameValuePair("HT1", destination)); params.add(new BasicNameValuePair("GTO", "Aachen")); params.add(new BasicNameValuePair("GT1", "Aachen")); params.add(new BasicNameValuePair("DatumT", day)); params.add(new BasicNameValuePair("DatumM", month)); params.add(new BasicNameValuePair("DatumJ", year)); params.add(new BasicNameValuePair("ZeitH", hour)); params.add(new BasicNameValuePair("ZeitM", min)); UrlEncodedFormEntity query = new UrlEncodedFormEntity(params, charset); HttpPost post = new HttpPost(url); post.setEntity(query); InputStream response = new DefaultHttpClient().execute(post).getEntity().getContent(); // Now do your thing with the facebook response. String source = readText(response,"CP1252"); Log.d(TAG_AVV,response.toString()); System.out.println("STREAM "+source); EDIT: This is my new code: try { HttpClient client = new DefaultHttpClient(); String getURL = "http://busspur02.aseag.de/bs.exe?SID=5FC39&ScreenX=1440&ScreenY=900&CMD=CR&Karten=true&DatumT="+day+"&DatumM="+month+"&DatumJ="+year+"&ZeitH="+hour+"&ZeitM="+min+"&Intervall=60&Suchen=(S)uchen&GT0=Aachen&T0=H&HT0="+start_from+"&GT1=Aachen&T0=H&HT1="+destination+""; HttpGet get = new HttpGet(getURL); HttpResponse responseGet = client.execute(get); HttpEntity resEntityGet = responseGet.getEntity(); if (resEntityGet != null) { //do something with the response Log.i("GET RESPONSE",EntityUtils.toString(resEntityGet)); } } catch (Exception e) { e.printStackTrace(); } But the output file is cut-off. If I do the same request in a browser I get like 14 different routes. Now the file suddenly stops and I only get 3 routes.... what's wrong? 04-30 12:19:12.362: INFO/GET RESPONSE(256): <!-- Ausgabebereich (automatisch erzeugt) --> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <div align="center"> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <p></p> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <p>Ihr Fahrplan für die Verbindung von Aachen, Kaiserplatz nach Aachen, Karlsgraben am Freitag, den 30.04.2010 (Koniginnedag), Abfahrten ab 12:19 Uhr</p> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <table class="Result"> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <th class="fussnote">Fussnote</th> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <th class="fahrzeug">Fahrzeug</th> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <th class="abfahrt">Abfahrt</th> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <th class="haltestellean">Haltestelle</th> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <th class="linie">Linie</th> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <th class="haltestelleab">Haltestelle</th> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <th class="ankunft">Ankunft</th> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <th class="fahrzeit">Fahrzeit/Tarif</th> 04-30 12:19:12.362: INFO/GET RESPONSE(256): </tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <td>&nbsp;</td><td>&nbsp;<img src="http://www.busspur.de/logos/efa-bus.gif" title="Niederflurbus"></td><td>12:23</td><td title="lc0">Aachen, Kaiserplatz [Heinrichsalle Ri. Hansemannplatz]&nbsp;<a href="http://download.avv.de/Umgebungsplaene/hlp_ac_kaiserplatz.pdf">Umgebungsplan</a></td><td>45</td><td title="lc0">Aachen, Karlsgraben&nbsp;<a href="http://download.avv.de/Umgebungsplaene/hlp_ac_karlsgraben.pdf">Umgebungsplan</a></td><td>12:34</td><td>00:11 /  1,00</td><td>&nbsp;</td> 04-30 12:19:12.362: INFO/GET RESPONSE(256): </tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr><td colspan="9"><a href="/bs.exe?RI=0&amp;SID=5FC39">Fahrtbegleiter</a>&nbsp;&nbsp;</td></tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr><td colspan="9"><hr></td></tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <td>&nbsp;</td><td>&nbsp;<img src="http://www.busspur.de/logos/efa-bus.gif" title="Niederflurbus"></td><td>12:26</td><td title="lc0">Aachen, Kaiserplatz [Heinrichsalle Ri. Hansemannplatz]&nbsp;<a href="http://download.avv.de/Umgebungsplaene/hlp_ac_kaiserplatz.pdf">Umgebungsplan</a></td><td>22</td><td title="lc0">Aachen, Karlsgraben&nbsp;<a href="http://download.avv.de/Umgebungsplaene/hlp_ac_karlsgraben.pdf">Umgebungsplan</a></td><td>12:37</td><td>00:11 /  1,00</td><td>&nbsp;</td> 04-30 12:19:12.362: INFO/GET RESPONSE(256): </tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr><td colspan="9"><a href="/bs.exe?RI=1&amp;SID=5FC39">Fahrtbegleiter</a>&nbsp;&nbsp;</td></tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr><td colspan="9"><hr></td></tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <td>&nbsp;</td><td>&nbsp;<img src="http://www.busspur.de/logos/efa-bus.gif" title="Niederflurbus"></td><td>12:28</td><td title="lc0">Aachen, Kaiserplatz [Heinrichsalle Ri. Hansemannplatz]&nbsp;<a href="http://download.avv.de/Umgebungsplaene/hlp_ac_kaiserplatz.pdf">Umgebungsplan</a></td><td>25</td><td title="lc0">Aachen, Karlsgraben&nbsp;<a href="http://download.avv.de/Umgebungsplaene/hlp_ac_karlsgraben.pdf">Umgebungsplan</a></td><td>12:39</td><td>00:11 /  1,00</td><td>&nbsp;</td> 04-30 12:19:12.362: INFO/GET RESPONSE(256): </tr> 04-30 12:19:12.362: INFO/GET RESPONSE(256): <tr><td colspan="9"><a href="/bs.exe?RI=2&amp;SID=5FC39">Fahrtbegl

    Read the article

  • Uploading images to a PHP server from Android

    - by Samuh
    I need to upload an image to a remote PHP server which expects the following parameters in HTTPPOST: *$_POST['title']* *$_POST['caption']* *$_FILES['fileatt']* Most of the internet searches suggested either : Download the following classes and trying MultiPartEntity to send the request: apache-mime4j-0.5.jar httpclient-4.0-beta2.jar httpcore-4.0-beta3.jar httpmime-4.0-beta2.jar OR Use URLconnection and handle multipart data myself. Btw, I am keen on using HttpClient class rather than java.net(or is it android.net) classes. Eventually, I downloaded the Multipart classes from the Android source code and used them in my project instead. Though this can be done by any of the above mentioned methods, I'd like to make sure if these are the only ways to achieve the said objective. I skimmed through the documentation and found a FileEntity class but I could not get it to work. What is the correct way to get this done in an Android application? Thanks.

    Read the article

  • How to send HTML as GET-Request parameter?

    - by Mork0075
    I would like to send a html string with a GET request like this with Apaches HttpClient: http://sample.com/?html=<html><head>... This doesnt work at the moment, i think its an encoding problem. Do you have any ideas how to do that? method.setQueryString(new NameValuePair[] {new NameValuePair("report", "<html>....")}); client.executeMethod(method) This fails with org.apache.commons.httpclient.NoHttpResponseException: The server localhost failed to respond. If i replace "<html>" by "test.." it works fine. EDIT It seams to be a problem of URL length after encoding, the server doesnt except such long URls. Sending it as POST solves the problem.

    Read the article

  • HttpClient POST fails to submit the form

    - by Jayomat
    Hi, I'm writing an app to check for the bus timetable's. Therefor I need to post some data to a html page, submit it, and parse the resulting page with htmlparser. Though it may be asked a lot, can some one help me identify if 1) this page does support post/get (I think it does) 2) which fields I need to use? 3) How to make the actual request? this is my code so far: String url = "http://busspur02.aseag.de/bs.exe?Cmd=RV&Karten=true&DatumT=30&DatumM=4&DatumJ=2010&ZeitH=&ZeitM=&Suchen=%28S%29uchen&GT0=&HT0=&GT1=&HT1="; String charset = "CP1252"; System.out.println("startFrom: "+start_from); System.out.println("goTo: "+destination); //String tag.v List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("HTO", start_from)); params.add(new BasicNameValuePair("HT1", destination)); params.add(new BasicNameValuePair("GTO", "Aachen")); params.add(new BasicNameValuePair("GT1", "Aachen")); params.add(new BasicNameValuePair("DatumT", day)); params.add(new BasicNameValuePair("DatumM", month)); params.add(new BasicNameValuePair("DatumJ", year)); params.add(new BasicNameValuePair("ZeitH", hour)); params.add(new BasicNameValuePair("ZeitM", min)); UrlEncodedFormEntity query = new UrlEncodedFormEntity(params, charset); HttpPost post = new HttpPost(url); post.setEntity(query); InputStream response = new DefaultHttpClient().execute(post).getEntity().getContent(); // Now do your thing with the facebook response. String source = readText(response,"CP1252"); Log.d(TAG_AVV,response.toString()); System.out.println("STREAM "+source); One person also gave me a hint to use firebug to read what's going on at the page, but I don't really understand what to look for, or more precisely, how to use the provided information. I also find it confusing, for example, that when I enter the data by hand, the url says, for example, "....HTO=Kaiserplatz&...", but in Firebug, the same Kaiserplatz is connected to a different field, in this case: \<\td class="Start3" Kaiserplatz <\/td (I inserted \ to make it visible) The last line in my code prints the html page, but without having send a request.. it's printed as if there was no input at all... My app is almost done, I hope someone can help me out to finish it! thanks in advance EDIT: this is what the s.o.p returns: (At some point there actually is some input, but only the destination ???) 04-30 03:15:43.524: INFO/System.out(3303): STREAM <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 04-30 03:15:43.524: INFO/System.out(3303): <html> 04-30 03:15:43.524: INFO/System.out(3303): <head> 04-30 03:15:43.545: INFO/System.out(3303): <title>Busspur online</title> 04-30 03:15:43.554: INFO/System.out(3303): <base href="http://busspur02.aseag.de"> 04-30 03:15:43.554: INFO/System.out(3303): <meta name="description" content="Busspur im Internet"> 04-30 03:15:43.554: INFO/System.out(3303): <meta name="author" content="Dr. Manfred Enning"> 04-30 03:15:43.554: INFO/System.out(3303): <meta name="AUTH_TYPE" content="Basic"> 04-30 03:15:43.574: INFO/System.out(3303): <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> 04-30 03:15:43.574: INFO/System.out(3303): <meta HTTP-EQUIV="Content-Language" CONTENT="de"> 04-30 03:15:43.574: INFO/System.out(3303): <link rel=stylesheet type="text/css" href="busspur.css"> 04-30 03:15:43.574: INFO/System.out(3303): </head> 04-30 03:15:43.574: INFO/System.out(3303): 04-30 03:15:43.574: INFO/System.out(3303): <body> 04-30 03:15:43.574: INFO/System.out(3303): <table border="0" cellspacing="0" cellpadding="0" width="100%"> 04-30 03:15:43.574: INFO/System.out(3303): <tr> 04-30 03:15:43.584: INFO/System.out(3303): <td align="left" width="25%"><small>Version: 6.8.1.9s2<br>Datenstand: 13.04.2010 04-30 03:15:43.584: INFO/System.out(3303): 04-30 03:15:43.584: INFO/System.out(3303): <br>12.04.2010 - 12.06.2010 04-30 03:15:43.584: INFO/System.out(3303): <br>1663 04-30 03:15:43.584: INFO/System.out(3303): 3D3B9</small> 04-30 03:15:43.584: INFO/System.out(3303): </td> 04-30 03:15:43.584: INFO/System.out(3303): 04-30 03:15:43.584: INFO/System.out(3303): <td align="center" width="50%"> 04-30 03:15:43.584: INFO/System.out(3303): <a href="/bs.exe/SL?Sprache=Nederlands&amp;SID=3D3B9"><img src="http://www.busspur.de/logos/nederlands.gif" alt="Nederlands" border="0" Width="32" Height="22"></a><a href="/bs.exe/SL?Sprache=English&amp;SID=3D3B9"><img src="http://www.busspur.de/logos/english.gif" alt="English" border="0" Width="32" Height="22"></a><a href="/bs.exe/SL?Sprache=Francais&amp;SID=3D3B9"><img src="http://www.busspur.de/logos/francais.gif" alt="Francais" border="0" Width="32" Height="22"></a> 04-30 03:15:43.584: INFO/System.out(3303): </td> 04-30 03:15:43.584: INFO/System.out(3303): 04-30 03:15:43.594: INFO/System.out(3303): <td align="right" width="25%"> 04-30 03:15:43.594: INFO/System.out(3303): <a href="http://www.avv.de/"><img src="/logos/avvlogo.gif" border="0" alt="AVV"></a> 04-30 03:15:43.594: INFO/System.out(3303): </td> 04-30 03:15:43.594: INFO/System.out(3303): </tr> 04-30 03:15:43.594: INFO/System.out(3303): </table> 04-30 03:15:43.594: INFO/System.out(3303): 04-30 03:15:43.594: INFO/System.out(3303): <!-- Kopfbereich (automatisch erzeugt) --> 04-30 03:15:43.594: INFO/System.out(3303): <div align="center"> 04-30 03:15:43.594: INFO/System.out(3303): 04-30 03:15:43.604: INFO/System.out(3303): <H2>Busspur-Online <i>Verbindungsabfrage</i></H2> 04-30 03:15:43.604: INFO/System.out(3303): </div> 04-30 03:15:43.604: INFO/System.out(3303): <!-- Ende Kopfbereich --> 04-30 03:15:43.604: INFO/System.out(3303): 04-30 03:15:43.604: INFO/System.out(3303): <!-- Ausgabebereich (automatisch erzeugt) --> 04-30 03:15:43.604: INFO/System.out(3303): <div align="center"> 04-30 03:15:43.614: INFO/System.out(3303): <p></p> 04-30 03:15:43.614: INFO/System.out(3303): <p></p> 04-30 03:15:43.614: INFO/System.out(3303): 04-30 03:15:43.614: INFO/System.out(3303): 04-30 03:15:43.624: INFO/System.out(3303): </div> 04-30 03:15:43.624: INFO/System.out(3303): <!-- Ende Ausgabebereich --> 04-30 03:15:43.634: INFO/System.out(3303): 04-30 03:15:43.634: INFO/System.out(3303): <!-- Fussnotenbereich (automatisch erzeugt) --> 04-30 03:15:43.634: INFO/System.out(3303): <div align="left"> 04-30 03:15:43.634: INFO/System.out(3303): 04-30 03:15:43.634: INFO/System.out(3303): 04-30 03:15:43.634: INFO/System.out(3303): </div> 04-30 03:15:43.634: INFO/System.out(3303): <!-- Ende Fussnotenbereich --> 04-30 03:15:43.634: INFO/System.out(3303): 04-30 03:15:43.634: INFO/System.out(3303): <!-- Nachschlageliste (automatisch erzeugt) --> 04-30 03:15:43.634: INFO/System.out(3303): <div align="center"> 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): </div> 04-30 03:15:43.644: INFO/System.out(3303): <!-- Ende Nachschlageliste --> 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): <!-- Eingabeformular --> 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): <!-- Eingabeformular --> 04-30 03:15:43.644: INFO/System.out(3303): <form name="Maske" action="/bs.exe" method="get"> 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): <input type="hidden" name="SID" value="3D3B9"> 04-30 03:15:43.644: INFO/System.out(3303): <input type="hidden" name="ScreenX" value=""> 04-30 03:15:43.654: INFO/System.out(3303): <input type="hidden" name="ScreenY" value=""> 04-30 03:15:43.654: INFO/System.out(3303): <input type="hidden" class="hiddenForm" name="CMD" value="CR" /> 04-30 03:15:43.654: INFO/System.out(3303): 04-30 03:15:43.654: INFO/System.out(3303): 04-30 03:15:43.654: INFO/System.out(3303): <input TYPE="Submit" name="Suchen" value="S" tabindex="20" style="visibility:hidden"> 04-30 03:15:43.654: INFO/System.out(3303): 04-30 03:15:43.654: INFO/System.out(3303): <table align="center" border="0" cellspacing="0" cellpadding="2"> 04-30 03:15:43.654: INFO/System.out(3303): <tr> 04-30 03:15:43.654: INFO/System.out(3303): <td class="Haupt"> 04-30 03:15:43.654: INFO/System.out(3303): 04-30 03:15:43.674: INFO/System.out(3303): <table border="0" cellspacing="0" cellpadding="2"> 04-30 03:15:43.674: INFO/System.out(3303): <!-- 1.Zeile Startauswahl --> 04-30 03:15:43.674: INFO/System.out(3303): <tr> 04-30 03:15:43.674: INFO/System.out(3303): <td rowspan="2" class="Start1"> 04-30 03:15:43.674: INFO/System.out(3303): Start 04-30 03:15:43.685: INFO/System.out(3303): </td> 04-30 03:15:43.685: INFO/System.out(3303): 04-30 03:15:43.685: INFO/System.out(3303): <td class="Start2" height="25"> 04-30 03:15:43.685: INFO/System.out(3303): Stadt/Gemeinde 04-30 03:15:43.685: INFO/System.out(3303): </td> 04-30 03:15:43.685: INFO/System.out(3303): 04-30 03:15:43.685: INFO/System.out(3303): <td class="Start3"> 04-30 03:15:43.685: INFO/System.out(3303): <input type="text" name="GT0" value="" tabindex="1" /> 04-30 03:15:43.704: INFO/System.out(3303): 04-30 03:15:43.704: INFO/System.out(3303): </td> 04-30 03:15:43.704: INFO/System.out(3303): 04-30 03:15:43.704: INFO/System.out(3303): 04-30 03:15:43.704: INFO/System.out(3303): <td rowspan="2" class="Start4"> 04-30 03:15:43.714: INFO/System.out(3303): <input type="submit" name="Map0" value="Karte" tabindex="100" /> 04-30 03:15:43.724: INFO/System.out(3303): 04-30 03:15:43.724: INFO/System.out(3303): </td> 04-30 03:15:43.724: INFO/System.out(3303): 04-30 03:15:43.724: INFO/System.out(3303): 04-30 03:15:43.724: INFO/System.out(3303): </tr> 04-30 03:15:43.724: INFO/System.out(3303): 04-30 03:15:43.724: INFO/System.out(3303): <tr> 04-30 03:15:43.734: INFO/System.out(3303): <td class="Start2" height="25"> 04-30 03:15:43.734: INFO/System.out(3303): <select name="T0" id="efaT0"> 04-30 03:15:43.734: INFO/System.out(3303): <option value="A" >Adresse 04-30 03:15:43.734: INFO/System.out(3303): <option value="H" selected="selected">Haltestelle 04-30 03:15:43.734: INFO/System.out(3303): <option value="Z" >Bes. Ziel 04-30 03:15:43.734: INFO/System.out(3303): </select> 04-30 03:15:43.734: INFO/System.out(3303): 04-30 03:15:43.734: INFO/System.out(3303): </td> 04-30 03:15:43.734: INFO/System.out(3303): 04-30 03:15:43.734: INFO/System.out(3303): <td class="Start3"> 04-30 03:15:43.734: INFO/System.out(3303): <input type="text" name="HT0" value="" tabindex="2" /> 04-30 03:15:43.734: INFO/System.out(3303): 04-30 03:15:43.745: INFO/System.out(3303): </td> 04-30 03:15:43.754: INFO/System.out(3303): 04-30 03:15:43.774: INFO/System.out(3303): </tr> 04-30 03:15:43.784: INFO/System.out(3303): 04-30 03:15:43.784: INFO/System.out(3303): <!-- 2.Zeile Ziel oder ViaAuswahl --> 04-30 03:15:43.784: INFO/System.out(3303): 04-30 03:15:43.805: INFO/System.out(3303): <tr> 04-30 03:15:43.834: INFO/System.out(3303): <td rowspan="2" class="Ziel1"> 04-30 03:15:43.834: INFO/System.out(3303): Ziel 04-30 03:15:43.834: INFO/System.out(3303): </td> 04-30 03:15:43.844: INFO/System.out(3303): 04-30 03:15:43.844: INFO/System.out(3303): <td class="Ziel2" height="25"> 04-30 03:15:43.844: INFO/System.out(3303): Stadt/Gemeinde 04-30 03:15:43.844: INFO/System.out(3303): </td> 04-30 03:15:43.854: INFO/System.out(3303): 04-30 03:15:43.854: INFO/System.out(3303): <td class="Ziel3"> 04-30 03:15:43.854: INFO/System.out(3303): Aachen 04-30 03:15:43.864: INFO/System.out(3303): </td> 04-30 03:15:43.874: INFO/System.out(3303): 04-30 03:15:43.874: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): <td rowspan="2" class="Ziel4"> 04-30 03:15:43.884: INFO/System.out(3303): <input type="submit" name="Map1" value="Karte" tabindex="101" /> 04-30 03:15:43.884: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): </td> 04-30 03:15:43.884: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): </tr> 04-30 03:15:43.884: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): <tr> 04-30 03:15:43.884: INFO/System.out(3303): <td class="Ziel2" height="25"> 04-30 03:15:43.894: INFO/System.out(3303): <small></small> 04-30 03:15:43.894: INFO/System.out(3303): </td> 04-30 03:15:43.894: INFO/System.out(3303): <td class="Ziel3"> 04-30 03:15:43.894: INFO/System.out(3303): Karlsgraben 04-30 03:15:43.904: INFO/System.out(3303): </td> 04-30 03:15:43.904: INFO/System.out(3303): </tr> 04-30 03:15:43.904: INFO/System.out(3303): 04-30 03:15:43.914: INFO/System.out(3303): 04-30 03:15:43.924: INFO/System.out(3303): 04-30 03:15:43.934: INFO/System.out(3303): 04-30 03:15:43.934: INFO/System.out(3303): 04-30 03:15:43.934: INFO/System.out(3303): 04-30 03:15:43.934: INFO/System.out(3303): <!-- 3.Zeile Datum/Zeit/Intervall --> 04-30 03:15:43.934: INFO/System.out(3303): <tr> 04-30 03:15:43.944: INFO/System.out(3303): <td rowspan="3" class="Zeit1"> 04-30 03:15:43.944: INFO/System.out(3303): Zeit 04-30 03:15:43.944: INFO/System.out(3303): </td> 04-30 03:15:43.944: INFO/System.out(3303): <td class="Datum2"> 04-30 03:15:43.944: INFO/System.out(3303): Datum 04-30 03:15:43.944: INFO/System.out(3303): </td> 04-30 03:15:43.944: INFO/System.out(3303): 04-30 03:15:43.944: INFO/System.out(3303): <!-- Für Abfragen ohne Karte alternativ Zeile ohne colspan hinzufügen --> 04-30 03:15:43.954: INFO/System.out(3303): 04-30 03:15:43.964: INFO/System.out(3303): <td class="Datum3" height="25" colspan="2"> 04-30 03:15:43.984: INFO/System.out(3303): <select name="DatumT" tabindex="10" id="efaDatumT"> 04-30 03:15:43.984: INFO/System.out(3303): <option >1</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >2</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >3</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >4</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >5</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >6</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >7</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >8</option> 04-30 03:15:43.994: INFO/System.out(3303): <option >9</option> 04-30 03:15:43.994: INFO/System.out(3303): <option >10</option> 04-30 03:15:43.994: INFO/System.out(3303): <option >11</option> 04-30 03:15:43.994: INFO/System.out(3303): <option >12</option> 04-30 03:15:44.005: INFO/System.out(3303): <option >13</option> 04-30 03:15:44.024: INFO/System.out(3303): <option >14</option> 04-30 03:15:44.034: INFO/System.out(3303): <option >15</option> 04-30 03:15:44.034: INFO/System.out(3303): <option >16</option> 04-30 03:15:44.034: INFO/System.out(3303): <option >17</option> 04-30 03:15:44.034: INFO/System.out(3303): <option >18</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >19</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >20</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >21</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >22</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >23</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >24</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >25</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >26</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >27</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >28</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >29</option> 04-30 03:15:44.044: INFO/System.out(3303): <option selected="selected">30</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >31</option> 04-30 03:15:44.055: INFO/System.out(3303): </select> 04-30 03:15:44.055: INFO/System.out(3303): . 04-30 03:15:44.055: INFO/System.out(3303): <select name="DatumM" tabindex="11" id="efaDatumM"> 04-30 03:15:44.055: INFO/System.out(3303): <option >1</option> 04-30 03:15:44.055: INFO/System.out(3303): <option >2</option> 04-30 03:15:44.055: INFO/System.out(3303): <option >3</option> 04-30 03:15:44.064: INFO/System.out(3303): <option selected="selected">4</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >5</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >6</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >7</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >8</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >9</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >10</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >11</option> 04-30 03:15:44.085: INFO/System.out(3303): <option >12</option> 04-30 03:15:44.085: INFO/System.out(3303): </select> 04-30 03:15:44.085: INFO/System.out(3303): . 04-30 03:15:44.085: INFO/System.out(3303): <select name="DatumJ" tabindex="12" id="efaDatumJ"> 04-30 03:15:44.095: INFO/System.out(3303): <option >2009</option> 04-30 03:15:44.095: INFO/System.out(3303): <option selected="selected">2010</option> 04-30 03:15:44.095: INFO/System.out(3303): <option >2011</option> 04-30 03:15:44.095: INFO/System.out(3303): </select> 04-30 03:15:44.095: INFO/System.out(3303): 04-30 03:15:44.095: INFO/System.out(3303): </td> 04-30 03:15:44.095: INFO/System.out(3303): 04-30 03:15:44.105: INFO/System.out(3303): </tr> 04-30 03:15:44.115: INFO/System.out(3303): 04-30 03:15:44.115: INFO/System.out(3303): <tr> 04-30 03:15:44.115: INFO/System.out(3303): <td class="Uhrzeit2"> 04-30 03:15:44.115: INFO/System.out(3303): <input type="radio" name="AbfAnk" value="Abf" checked />Abfahrten ab<br /> 04-30 03:15:44.115: INFO/System.out(3303): <input type="radio" name="AbfAnk" value="Ank" />Ankünfte bis 04-30 03:15:44.115: INFO/System.out(3303): 04-30 03:15:44.115: INFO/System.out(3303): </td> 04-30 03:15:44.125: INFO/System.out(3303): <td class="Uhrzeit3" height="25"> 04-30 03:15:44.125: INFO/System.out(3303): <select name="ZeitH" tabindex="14" id="efaZeitH"> 04-30 03:15:44.125: INFO/System.out(3303): <option >0</option> 04-30 03:15:44.125: INFO/System.out(3303): <option >1</option> 04-30 03:15:44.125: INFO/System.out(3303): <option >2</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >3</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >4</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >5</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >6</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >7</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >8</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >9</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >10</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >11</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >12</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >13</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >14</option> 04-30 03:15:44.145: INFO/System.out(3303): <option selected="selected">15</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >16</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >17</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >18</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >19</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >20</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >21</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >22</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >23</option> 04-30 03:15:44.155: INFO/System.out(3303): </select> 04-30 03:15:44.155: INFO/System.out(3303): : 04-30 03:15:44.155: INFO/System.out(3303): <select name="ZeitM" tabindex="15" id="efaZeitM"> 04-30 03:15:44.155: INFO/System.out(3303): <option >00</option> 04-30 03:15:44.155: INFO/System.out(3303): <option selected="selected">15</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >30</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >45</option> 04-30 03:15:44.155: INFO/System.out(3303): </select> 04-30 03:15:44.155: INFO/System.out(3303): 04-30 03:15:44.155: INFO/System.out(3303): </td> 04-30 03:15:44.155: INFO/System.out(3303): 04-30 03:15:44.165: INFO/System.out(3303): <td class="Uhrzeit2">&nbsp;</td> 04-30 03:15:44.165: INFO/System.out(3303): 04-30 03:15:44.165: INFO/System.out(3303): </tr> 04-30 03:15:44.165: INFO/System.out(3303): 04-30 03:15:44.165: INFO/System.out(3303): <tr> 04-30 03:15:44.165: INFO/System.out(3303): <td class="Intervall2"> 04-30 03:15:44.165: INFO/System.out(3303): Intervall 04-30 03:15:44.165: INFO/System.out(3303): </td> 04-30 03:15:44.184: INFO/System.out(3303): 04-30 03:15:44.184: INFO/System.out(3303): <td class="Intervall3" height="25"> 04-30 03:15:44.184: INFO/System.out(3303): <select name="Intervall" tabindex="13" id="efaIntervall"> 04-30 03:15:44.184: INFO/System.out(3303): <option value="60" >1 h</option> 04-30 03:15:44.184: INFO/System.out(3303): <option value="120" >2 h</option> 04-30 03:15:44.184: INFO/System.out(3303): <option value="240" >4 h</option> 04-30 03:15:44.184: INFO/System.out(3303): <option value="480" >8 h</option> 04-30 03:15:44.184: INFO/System.out(3303): <option value="1800" >ganzer Tag</option> 04-30 03:15:44.194: INFO/System.out(3303): </select> 04-30 03:15:44.194: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): </td> 04-30 03:15:44.204: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): <td class="Intervall3">&nbsp; 04-30 03:15:44.204: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): </tr> 04-30 03:15:44.204: INFO/System.out(3303): </table> 04-30 03:15:44.204: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): </td> 04-30 03:15:44.204: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): <td class="Schalter" valign="top"> 04-30 03:15:44.204: INFO/System.out(3303): <table class="Schalter"> 04-30 03:15:44.204: INFO/System.out(3303): <!-- Buttons --> 04-30 03:15:44.204: INFO/System.out(3303): <tr> 04-30 03:15:44.204: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.226: INFO/System.out(3303): <input TYPE="Submit" accesskey="s" class="SuchenBtn" name="Suchen" tabindex="20" VALUE="(S)uchen"> 04-30 03:15:44.226: INFO/System.out(3303): </td> 04-30 03:15:44.226: INFO/System.out(3303): </tr> 04-30 03:15:44.226: INFO/System.out(3303): 04-30 03:15:44.226: INFO/System.out(3303): 04-30 03:15:44.226: INFO/System.out(3303): <tr> 04-30 03:15:44.226: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.226: INFO/System.out(3303): <input TYPE="Submit" accesskey="o" name="Optionen" tabindex="22" VALUE="(O)ptionen"> 04-30 03:15:44.226: INFO/System.out(3303): </td> 04-30 03:15:44.226: INFO/System.out(3303): </tr> 04-30 03:15:44.226: INFO/System.out(3303): 04-30 03:15:44.226: INFO/System.out(3303): 04-30 03:15:44.226: INFO/System.out(3303): <tr> 04-30 03:15:44.226: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.226: INFO/System.out(3303): <input TYPE="Button" accesskey="z" tabindex="24" VALUE="(Z)urück" onClick="history.back()"> 04-30 03:15:44.226: INFO/System.out(3303): </td> 04-30 03:15:44.226: INFO/System.out(3303): </tr> 04-30 03:15:44.226: INFO/System.out(3303): <tr> 04-30 03:15:44.226: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.226: INFO/System.out(3303): <input TYPE="Button" accesskey="h" tabindex="25" VALUE="(H)ilfe" onClick="self.location.href='/bs.exe/FF?N=hilfe&amp;SID=3D3B9'"> 04-30 03:15:44.226: INFO/System.out(3303): </td> 04-30 03:15:44.235: INFO/System.out(3303): </tr> 04-30 03:15:44.235: INFO/System.out(3303): <tr> 04-30 03:15:44.235: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.235: INFO/System.out(3303): <input TYPE="Submit" accesskey="n" tabindex="26" name="Loeschen" VALUE="(N)eue Suche"> 04-30 03:15:44.235: INFO/System.out(3303): </td> 04-30 03:15:44.235: INFO/System.out(3303): </tr> 04-30 03:15:44.235: INFO/System.out(3303): 04-30 03:15:44.235: INFO/System.out(3303): <tr> 04-30 03:15:44.235: INFO/System.out(3303): 04-30 03:15:44.244: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.244: INFO/System.out(3303): <input TYPE="Button" accesskey="a" tabindex="27" VALUE="H(a)ltestelle" onClick="self.location.href='/bs.exe/RHFF?Karten=true?N=Result&amp;SID=3D3B9'"> 04-30 03:15:44.244: INFO/System.out(3303): </td> 04-30 03:15:44.244: INFO/System.out(3303): 04-30 03:15:44.244: INFO/System.out(3303): </tr> 04-30 03:15:44.244: INFO/System.out(3303): </table> 04-30 03:15:44.254: INFO/System.out(3303): 04-30 03:15:44.254: INFO/System.out(3303): </td> 04-30 03:15:44.254: INFO/System.out(3303): </tr> 04-30 03:15:44.254: INFO/System.out(3303): </table> 04-30 03:15:44.254: INFO/System.out(3303): </form> 04-30 03:15:44.254: INFO/System.out(3303): 04-30 03:15:44.254: INFO/System.out(3303): 04-30 03:15:44.254: INFO/System.out(3303): <!-- Meldungsbereich (automatisch erzeugt) --> 04-30 03:15:44.254: INFO/System.out(3303): <div align="center" id="meldungen"> 04-30 03:15:44.265: INFO/System.out(3303): <table class="Bedienhinweise"><tr><td rowspan="2"><img SRC="http://www.busspur.de/logos/hinweis.png" ALIGN="top" alt="Symbol" WIDTH="32" HEIGHT="20">&nbsp;</td><td rowspan="2">Start</td><td>Geben Sie den Namen der Stadt/Gemeinde ein</td></tr><tr><td>Geben Sie den Namen der Haltestelle ein</td></tr></table> 04-30 03:15:44.265: INFO/System.out(3303): </div> 04-30 03:15:44.265:

    Read the article

  • HttpPost request unsuccessful

    - by The Thom
    I have written a web service and am now writing a tester to perform integration testing from the outside. I am writing my tester using apache httpclient 4.3. Based on the code here: http://hc.apache.org/httpcomponents-client-4.3.x/quickstart.html and here: http://hc.apache.org/httpcomponents-client-4.3.x/tutorial/html/fundamentals.html#d5e186 I have written the following code. Map<String, String> parms = new HashMap<>(); parms.put(AirController.KEY_VALUE, json); postUrl(SERVLET, parms); ... protected String postUrl(String servletName, Map<String, String> parms) throws AirException{ String url = rootUrl + servletName; HttpPost post = new HttpPost(url); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); for(Map.Entry<String, String> entry:parms.entrySet()){ BasicNameValuePair parm = new BasicNameValuePair(entry.getKey(), entry.getValue()); nvps.add(parm); } try { post.setEntity(new UrlEncodedFormEntity(nvps)); } catch (UnsupportedEncodingException use) { String msg = "Invalid parameters:" + parms; throw new AirException(msg, use); } CloseableHttpResponse response; try { response = httpclient.execute(post); } catch (IOException ioe) { throw new AirException(ioe); } String result; if(HttpStatus.SC_OK == response.getStatusLine().getStatusCode()){ result = processResponse(response); } else{ String msg = MessageFormat.format("Invalid status code {0} received from query {1}.", new Object[]{response.getStatusLine().getStatusCode(), url}); throw new AirException(msg); } return result; } This code successfully reaches my servlet. In my servlet, I have (using Spring's AbstractController): protected ModelAndView post(HttpServletRequest request, HttpServletResponse response) { String json = String.valueOf(request.getParameter(KEY_VALUE)); if(json.equals("null")){ log.info("Received null value."); response.setStatus(406); return null; } And this code always falls into the null parameter code and returns a 406. I'm sure I'm missing something simple, but can't see what it is.

    Read the article

  • Client for restful web service

    - by Ish
    I'd like to create a http-centric client for a restful web service created using CXF. To that end: Does any one know the (maven) dependencies for ONLY the CXF clients (Proxy & HTTP)? Is there any advantage to using CXF's built-in clients over say, Apache HttpClient?

    Read the article

  • Sharing DefaultHttpClient in Android. To synchronize or not to synchronize?

    - by johnrock
    In an Android app, I am using one static instance of org.apache.http.impl.client.DefaultHttpClient and sharing that instance in all activities and services of the app, so that this client may be used to log in once to a remote server and all subsequent user requests to that remote server will remain authenticated. Every activity or Service that makes a GET or POST to this remote server calls the same method : MyUtilityClass.gettHttpClient() Do I need to worry about synchronization of this httpclient? If so, what is the best way to handle this?

    Read the article

  • Reading chunked data from HttpEntity

    - by Gagan
    I have the following code: HttpClient FETCHER HttpResponse response = FETCHER.execute(host, httpMethod); Im trying to read its contents to a string like this: HttpEntity entity = response.getEntity(); InputStream st = entity.getContent(); StringWriter writer = new StringWriter(); IOUtils.copy(st, writer); String content = writer.toString(); The problem is, when i fetch http://www.google.co.in/ page, the transfer encoding is chunked, and i get only the first chunk. It fetches till first "". How do i get all the chunks at once so i can dump the complete output and do some processing on it ?

    Read the article

  • Help with calling a secure (SSL) webservice in Android.

    - by mmattax
    I'm new to Android and am struggling to make a call to an SSL web service for an Android Application. My code is as follows: Log.v("fs", "Making HTTP call..."); HttpClient http = new DefaultHttpClient(); HttpGet request = new HttpGet("https://example.com/api"); try { String response = http.execute(request, new BasicResponseHandler()); Log.v("fs", response); } catch (Exception e) { Log.v("fs", e.toString()); } The Output is: Making HTTP call... javax.net.SSLPeerUnverifiedException: No peer certificate Any suggestions to make this work would be great. EDIT I should note that this is a valid cert. It is not self-signed.

    Read the article

  • Can you use POST to run a query in Solr (/select)

    - by RyanFetz
    I have queries that I am running against out solr index that sometimes have very long query parameters, I get errors when i run these queries, which i assume are do to the limit of a GET query parameters. Here is the method I use to query (JSON), this is to show I am using the Http Extensions (the client i use is a thin wrapper for HttpClient) not an end to end solution. 90% of the queries run fine, it is just when the params are large i get the 500 error from solr. I have read somewhere you can use POSt's when doing the select command but have not found examples of how to do it. Any help would be fantastic! public string GetJson(HttpQueryString qs) { using (var client = new DAC.US.Web.XmlHttpServiceClient(this.Uri)) { client.Client.DefaultHeaders.Authorization = new Microsoft.Http.Headers.Credential("Basic", DAC.US.Encryption.Hash.WebServiceCredintials); qs.Add("wt", "json"); if (!String.IsNullOrEmpty(this.Version)) qs.Add("version", this.Version); using (var response = client.Get(new Uri(@"select/", UriKind.Relative), qs)) { return response.Content.ReadAsString(); } } }

    Read the article

  • Getting ConnectionTimeoutException with the host did not accept the connection within timeout

    - by Sanjana
    Can Some one Help me, how we can solve the following problem. nested exception is org.apache.commons.httpclient.ConnectTimeoutException: The host did not accept the connection within timeout of 10000 ms at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:211) at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:144) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy19.isEmployeeToken(Unknown Source) at com.clickandbuy.webapps.surfer.commons.ContextUtils.isEmployeeToken(ContextUtils.java:375) at com.clickandbuy.webapps.surfer.commons.ContextUtils.validateLogin(ContextUtils.java:248) at sun.reflect.GeneratedMethodAccessor1364.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274) at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59) at org.jboss.el.parser.AstValue.getValue(AstValue.java:67) at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at org.springframework.binding.expression.el.BindingValueExpression.getValue(BindingValueExpression.java:54) at org.springframework.binding.expression.el.ELExpression.getValue(ELExpression.java:54) at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145) at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101) at org.springframework.webflow.engine.State.enter(State.java:194) at org.springframework.webflow.engine.Flow.start(Flow.java:535) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222) at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140) at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193) at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.clickandbuy.webapps.surfer.commons.filter.LogUserIPFilter.doFilter(LogUserIPFilter.java:61) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.clickandbuy.webapps.surfer.commons.filter.AddHeaderFilter.doFilter(AddHeaderFilter.java:54) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.clickandbuy.webapps.commons.filter.SessionSizeFilter.doFilter(SessionSizeFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.commons.httpclient.ConnectTimeoutException: The host did not accept the connection within timeout of 10000 ms at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:155) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) at org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor.executePostMethod(CommonsHttpInvokerRequestExecutor.java:195) at org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor.doExecuteRequest(CommonsHttpInvokerRequestExecutor.java:129) at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:136) at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:191) at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:173) at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:141) ... 57 more Caused by: java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140) ... 70 more Thanks In Advance Sanjana

    Read the article

  • Connection to webservice times out first time

    - by Neo
    My application needs to connect to a web service. The WSDL file given by the client was converted to java using the wsdl2java utility in axis 2-1.5.2. The problem occurs during the first connection to the webservice. It gives me java.net.SocketTimeoutException: Read timed out at jrockit.net.SocketNativeIO.readBytesPinned(Native Method) at jrockit.net.SocketNativeIO.socketRead(SocketNativeIO.java:46) at java.net.SocketInputStream.socketRead0(SocketInputStream.java) at java.net.SocketInputStream.read(SocketInputStream.java:129) at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293) at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:747) at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:238) at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78) at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106) at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413) at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1974) at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1100) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:558) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:230) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:166) at com.jmango.webservice.talker.WCFServiceStub.addSaleSupportRequest(WCFServiceStub.java:270) at com.jmango.domain.salessystem.talkerimp.RequestServiceInfoImp.addanewServiceRequest(RequestServiceInfoImp.java:58) at com.jmango.mobilenexus.service.MobileServiceImp.sendQueryforServiceInfo(MobileServiceImp.java:358) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy8.sendQueryforServiceInfo(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:180) at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:110) at org.springframework.remoting.caucho.Hessian2SkeletonInvoker.invoke(Hessian2SkeletonInvoker.java:94) at org.springframework.remoting.caucho.HessianExporter.invoke(HessianExporter.java:142) at org.springframework.remoting.caucho.HessianServiceExporter.handleRequest(HessianServiceExporter.java:70) at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:50) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:512) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:718) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:111) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:899) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at java.lang.Thread.run(Thread.java:619) I tried searching the web for answers though there was one place which mentions it could be the firewall at the webservice end that is blocking, I wasnt able to find a valid solution. Any help will be much appreciated. Running: Apache Tomcat 6.0 Axis2 1.5.2

    Read the article

  • Connect.registerUsers - Need helping creating array for accounts param

    - by mw_javaguy
    I keep getting the following error when I try to invoke the Facebook REST API Call: Connect.registerUsers Error Code: 100 - param accounts must be an array JSON based response (from Facebook): {"error_code":100,"error_msg":"param accounts must be an array.","request_args": [{"key":"accounts","value":"{email_hash:5232156322_55ddgvc3db5ddcf218049dd564da2x06}"}, {"key":"api_key","value":"23b2c4c6a23445fbffssf8aab96a5e5"}, {"key":"format","value":"JSON"},{"key":"method","value":"Connect.registerUsers"},{"key":"sig","value":"3sd54153a31382fa6e72eecf3c57d7c9"},{"key":"v","value":"1.0"}],"message":"Unknown exception","code":0} I set up the Java code to invoke the REST end point using HttpClient like this: String API_KEY = "23b2c4c6a23445fbffssf8aab96a5e5"; String toConnectRegisterUsersSignature = "accounts=" + "{email_hash:" + emailHash + "}" + "api_key=" + API_KEY + "format=JSON" + "method=Connect.registerUsers" + "v=1.0" + "0c786155bd3cxe8228d924542da5gf2"; String connectRegisterUsersSignature = SimpleMd5.MD5(toConnectRegisterUsersSignature); NameValuePair[] connectRegisterUsersParameters = { new NameValuePair("accounts", "{email_hash:" + emailHash + "}"), new NameValuePair("api_key", API_KEY), new NameValuePair("format", "JSON"), new NameValuePair("method", "Connect.registerUsers"), new NameValuePair("sig", connectRegisterUsersSignature), new NameValuePair("v", "1.0") }; Tried the following combinations and I still get the same error! Signature: "accounts=" + "[email_hash=" + emailHash + "]" new NameValuePair("accounts", "[email_hash=" + emailHash + "]") Signature: "accounts=" + "email_hash[" + emailHash + "]" new NameValuePair("accounts", "email_hash[" + emailHash + "]") Signature: "accounts=" + "email_hash(" + emailHash + ")" new NameValuePair("accounts", "email_hash(" + emailHash + ")") Signature: "accounts=" + "[email_hash=" + emailHash + "]" new NameValuePair("accounts", "[email_hash=" + emailHash + "]") Signature: "accounts=" + "email_hash=" + emailHash new NameValuePair("accounts", "email_hash=" + emailHash) Signature: "accounts=" + "[{email_hash:" + emailHash + "}]" new NameValuePair("accounts", "[{email_hash:" + emailHash + "}]"), Does anyone know how to construct this array that the response is requesting? Happy programming and thank you for taking the time to read this.

    Read the article

  • http connection timeout issues

    - by Mark
    I'm running into an issue when i try to use the HttpClient connecting to a url. The http connection is taking a longer time to timeout, even after i set a connection timeoout. int timeoutConnection = 5000; HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection); int timeoutSocket = 5000; HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket); It works perfect most of the time. However, every once in while, the http connection runs for ever and ignore the setconnectiontimeout, especailly when the phone is connected to wifi, and the phone was idling. So after the phone is idling, the first time i try to connect, the http connection ignores the setconnectiontimeout and runs forever, after i cancel it and try again, it works like charm everytime. But that one time that doesn't work it creates a threadtimeout error, i tried using a different thread, it works, but i know that the thread is running for long time. I understand that the wifi goes to sleep on idle, but i dont understand why its ignoring the setconnectiontimeout. Anyone can help, id really appreciated.

    Read the article

  • Unable to aquire image through ImageIO.read(url) because of connection timed out.

    - by Jake Frederix
    Following code always fails URL url = new URL("http://userserve-ak.last.fm/serve/126/8636005.jpg"); Image img = ImageIO.read(url); System.out.println(img); I've manually checked the url, and it is valid, and contains a valid jpg image. The problem I get is; Exception in thread "main" javax.imageio.IIOException: Can't get input stream from URL! at javax.imageio.ImageIO.read(ImageIO.java:1385) at maestro.Main2.main(Main2.java:25) Caused by: java.net.ConnectException: Connection timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163) at java.net.Socket.connect(Socket.java:546) at java.net.Socket.connect(Socket.java:495) at sun.net.NetworkClient.doConnect(NetworkClient.java:174) at sun.net.www.http.HttpClient.openServer(HttpClient.java:409) at sun.net.www.http.HttpClient.openServer(HttpClient.java:530) at sun.net.www.http.HttpClient.(HttpClient.java:240) at sun.net.www.http.HttpClient.New(HttpClient.java:321) at sun.net.www.http.HttpClient.New(HttpClient.java:338) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:814) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:755) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:680) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1005) at java.net.URL.openStream(URL.java:1029) at javax.imageio.ImageIO.read(ImageIO.java:1383) ... 1 more Java Result: 1 What does this mean? Funny thing is, if I change my internet-connection to that of the neighbour's wireless, it suddenly does work.

    Read the article

  • Java UnknownHostException When and Why?

    - by interstar
    I'm trying to post to a website from a Processing Sketch. (Processing is basically Java running in a fancy environment). I'm using this library : http://libraries.seltar.org/postToWeb/ but I don't know if that makes a difference. You can see from the stack trace below that this is just a wrapper for the Java standard library. Anyway, the important point is that the host "mysite.com" is up and running. I am seeing it from the browser. But when I try to post to it from Java I just get the UnknownHostException appearing. Given that the site is up. What else might this mean? The program is currently running inside the Processing environment. Presumably as an Applet. java.net.UnknownHostException: mysite.com at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at sun.net.NetworkClient.doConnect(NetworkClient.java:163) at sun.net.www.http.HttpClient.openServer(HttpClient.java:394) at sun.net.www.http.HttpClient.openServer(HttpClient.java:529) at sun.net.www.http.HttpClient.<init>(HttpClient.java:233) at sun.net.www.http.HttpClient.New(HttpClient.java:306) at sun.net.www.http.HttpClient.New(HttpClient.java:323) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014) at org.seltar.Bytes2Web.PostToWeb._post(PostToWeb.java:90) at org.seltar.Bytes2Web.ByteToWeb.post(ByteToWeb.java:66) at experimentPostToWeb.keyPressed(experimentPostToWeb.java:35) at processing.core.PApplet.handleKeyEvent(Unknown Source) at processing.core.PApplet.dequeueKeyEvents(Unknown Source) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:662)

    Read the article

  • HTTP client - HTTP 405 error "Method not allowed". I send a HTTP Post but for some reason HTTP Get i

    - by Shino88
    Hey I am using apache library. I have created a class which sends a post request to a servlet. I have set up the parameters for the client and i have created a HTTP post object to be sent but for some reason when i excute the request i get a reposnse that says the get method is not supported(which is true cause i have only made a dopost method in my servlet). It seems that a get request is being sent but i dont know why. The post method worked before but i started gettng http error 417 "Expectation Failed" which i fixed by adding paramenters. below is my class with the post method. P.s i am developing for android. public class HTTPrequestHelper { private final ResponseHandler<String> responseHandler; private static final String CLASSTAG = HTTPrequestHelper.class.getSimpleName(); private static final DefaultHttpClient client; static{ HttpParams params = new BasicHttpParams(); params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); params.setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, HTTP.UTF_8); ///params.setParameter(CoreProtocolPNames.USER_AGENT, "Android-x"); params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 15000); params.setParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register( new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register( new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(params, schemeRegistry); client = new DefaultHttpClient(cm,params); } public HTTPrequestHelper(ResponseHandler<String> responseHandler) { this.responseHandler = responseHandler; } public void performrequest(String url, String para) { HttpPost post = new HttpPost(url); StringEntity parameters; try { parameters = new StringEntity(para); post.setEntity(parameters); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } BasicHttpResponse errorResponse = new BasicHttpResponse( new ProtocolVersion("HTTP_ERROR", 1, 1), 500, "ERROR"); try { client.execute(post, this.responseHandler); } catch (Exception e) { errorResponse.setReasonPhrase(e.getMessage()); try { this.responseHandler.handleResponse(errorResponse); } catch (Exception ex) { Log.e( "ouch", "!!! IOException " + ex.getMessage() ); } } } I tried added the allow header to the request but that did not work as well but im not sure if i was doing right. below is the code. client.addRequestInterceptor(new HttpRequestInterceptor() { @Override public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { //request.addHeader("Allow", "POST"); } });

    Read the article

  • HttpProtocolParams.setUseExpectContinue(params, false) - when to set true?

    - by johnrock
    I am using org.apache.http.impl.client.DefaultHttpClient to retrieve xml from a webservice and am trying to determine whether to set HttpProtocolParams.setUseExpectContinue(params, true) or HttpProtocolParams.setUseExpectContinue(params, false). I am not clear on how to determine this. Can anyone offer a best practices guideline on when this should be true and when it should be false and also the possible implications of each setting? Thanks!

    Read the article

  • Delphi: problem with httpcli (ICS) post method

    - by www.yegorov-p.ru
    Hello I am using HttpCli component form ICS to POST a request. I use an example that comes with the component. It says: procedure TForm4.Button2Click(Sender: TObject); var Data : String; begin Data:='status=no'; HttpCli1.SendStream := TMemoryStream.Create; HttpCli1.SendStream.Write(Data[1], Length(Data)); HttpCli1.SendStream.Seek(0, 0); HttpCli1.RcvdStream := TMemoryStream.Create; HttpCli1.URL := Trim('http://server/something'); HttpCli1.PostAsync; end; But it fact, it sends not status=no but s.t.a.t.u I can't understand, where is the problem. Maybe someone can show an example, how to send POST request with the help of HttpCli component? PS I can't use Indy =)

    Read the article

  • Use HttpGet with illegal characters in the URL

    - by kaciula
    I am trying to use DefaultHttpClient and HttpGet to make a request to a web service. Unfortunately the web service URL contains illegal characters such as { (ex: domain.com/service/{username}). It's obvious that the web service naming isn't well written but I can't change it. When I do HttpGet(url), I get that I have an illegal character in the url (that is { and }). If I encode the URL before that, there is no error but the request goes to a different URL where there is nothing. The url, although has illegal characters, works from the browser but the HttpGet implementation doesn't let me use it. What should I do or use instead to avoid this problem?

    Read the article

  • non-static method cannot be referenced from a static context

    - by Mith
    I am modifying the source code here: http://thinkandroid.wordpress.com/2009/12/30/getting-response-body-of-httpresponse/ I get this error: non-static method getContentCharSet(org.apache.http.HttpEntity) cannot be referenced from a static context String charset = getContentCharSet(entity); This error is line 13 on the second box. Any ideas? I have been really struggling with this code :-(

    Read the article

  • How to set RequestBody for Http Delete method.

    - by Tushar Tarkas
    I am writing a client code for a server which Delete API. The API specification requires data to be sent. I am using HttpComponents v3.1 library for writing client code. Using the HtpDelete class I could not find a way to add request data to it. Is there a way to do so ? Below is the code snippet. HttpDelete deleteReq = new HttpDelete(uriBuilder.toString()); List<NameValuePair> postParams = new ArrayList<NameValuePair>(); postParams.add(new BasicNameValuePair(RestConstants.POST_DATA_PARAM_NAME, postData.toString())); try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(postParams); entity.setContentEncoding(HTTP.UTF_8); //deleteReq.setEntity(entity); // There is no method setEntity() deleteReq.setHeader(RestConstants.CONTENT_TYPE_HEADER, RestConstants.CONTENT_TYPE_HEADER_VAL); } catch (UnsupportedEncodingException e) { logger.error("UnsupportedEncodingException: " + e); } Thanks in advance.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >