Hi,
I send a POST request to the server. The response should be in text/xml
format. However, I could not get the response properly. I also tried to
use other methods, such as getResponseAsStream and etc. They all could
not work. I do not know why.
The server is Tomcat + JSP + servlet. I use http client to develop the
client .
The code is like below:
public void SendReceivePOST() {
System.out.println("SendReceivePOST is called ");
HttpClient client = new HttpClient();
System.out.println("this.url is " + this.url);
PostMethod method_tmp= new PostMethod(this.url);
.... //this block is to add parameters to POST request ;
try {
System.out.println("try block begins");
// Execute the method.
int statusCode = client.executeMethod(method_tmp);
if (statusCode == HttpStatus.SC_OK) {
this.response = method_tmp.getResponseBodyAsString() ;
System.out.println("this.response is" + this.response) ;
}
....
}
For the server, the servlet just write following string as response:
<root><index>7</index><data_lists><list>---</list><list>Jason
Hunter</list><list>Richard Monson - Haefel</list><list>Kathy
Sierra</list><list>Michael Morrison</list><list>Craig
Larman</list><list>Hanumant Deshmukh</list></data_lists></root>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]