How to set http request (message Body) in a java class ?
posted 7 years ago
i created a httpRedirector class, it gets the request and sends that to actual host and get the response, send to the requester client(java class).
1. httpdirector listens the port, say 8080
On the port 8084, one service is running as background process (like apache tomcat service).
2. Now the requester client (java class) has some sends the requesting url as hardcoded string, but the parameters are set by NameValuePair. The,
sends it by using PostMethod. Eg:- request to create a message in that service which runs in 8084, through the httpRedirector. So i request to 8080
3. The problem is,
If i pass the xml based message, in the hardcoded url means, it is created in that service thru my httpredirector.
also, if sets the parameter by namevaluepair means,
NameValuPair paramter settings are,
body=<?xml version=\"1.0\"?><root><data>My test message</data></root>