Hello There,
I want to do a http post using an object.
So I have method like this :
@POST
@Consumes("application/xml")
@Path("/update/update1")
public Response update(DomainClass scheduledTask) {
now with
unit testing I am successfully able to do the update:
String newTask = "<DomainClass >"
+ "<field1>test.jar</field1>"
+ "</DomainClass >";
URL postUrl = new URL("http://server//update/update1");
HttpURLConnection connection = (HttpURLConnection) postUrl
.openConnection();
connection.setDoOutput(true);
connection.setReadTimeout(5000);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/xml");
OutputStream os = connection.getOutputStream();
os.write(newTask.getBytes());
I want to send the same object thru
jsp any ideas how to do that ? converting form fields to xml string is way to go... but are there existing tools for that? I am looking here what people do usually?