hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zulfi Umrani" <zumr...@novell.com>
Subject Following code throws IllegalArgumentException: host parameter is null! Does any one know why?
Date Mon, 09 Jun 2003 21:24:52 GMT
Following code throws IllegalArgumentException: host parameter is null!
Does any one know why?

HttpClient hc = new HttpClient();
	HttpState state = hc.getState();
	state.setCredentials("", new
UsernamePasswordCredentials("zulfi", "zulfi"));

	String urlstr = "http://localhost:9999/services1/test";
	URL url = new URL(urlstr);

	UrlPostMethod post = new UrlPostMethod(urlstr);
	post.setDoAuthentication(true);

	post.addRequestHeader("Connection", "Keep-Alive");
	post.addRequestHeader("Content-Length", ""+msg.length());
	post.addRequestHeader("Content-Type", "text/xml;
charset=utf-8");

	InputStream reqis = new ByteArrayInputStream(msg.getBytes());
	
	post.setRequestBody(reqis);
	
	hc.executeMethod(post);

	

Thanks,
Zulfi

Mime
View raw message