Have you tried to set the "Accept" header of your request to the proper media 
type ? Without it, your server might consider that you expect the default, e.g. 
text/html, and won't serve you the xml. That's my guess.

On 2 déc. 2009, at 04:25, sc...@seanet.com wrote:

> Hi,
> 
> Please excuse a newbie question but how do I get back the XML content back
> from a servlet.  All I seem to get is the index.html web page..
> 
> Basic call is:
> 
> HttpClient httpclient = new DefaultHttpClient();
> HttpGet httpget = new
>   HttpGet("http://localhost:8080/wc_server?task=get_results";);
> HttpResponse response = httpclient.execute(httpget);
> 
> HttpEntity entity = response.getEntity();
> 
> if (entity != null)
> {
>    long len = entity.getContentLength();
>    if (len != -1 ) // && len < 8192)
>    {
>        System.out.println(EntityUtils.toString(entity));
>    }
> }
> 
> 
> Whats returned is the index.html page in that servlets top directory, not
> the XML data for that method call.  I get the same results with either:
> 
> HttpGet("http://localhost:8080/wc_server?task=get_results";);
> 
> or
> 
> HttpGet("http://localhost:8080/wc_server";);
> 
> It seems like it's not getting/processing the '?task=get_results'
> 
> If I remove the index.html file from the servlet directory it just errors
> back...
> 
> Thanks
> Steve Cook
> sc...@seanet.com

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to