I would like to see the XML that is submitted with my POST
request that is processed using jax-rs
and Apache CXF
:
@POST
@Path("entity/register")
@Consumes(MediaType.APPLICATION_XML)
public Response registerEntity(Entity entity ) { ... }
I call the service using Spring
RestTemplate
:
String postURI = "...";
Entity entity = new Entity(...);
restTemplate.postForLocation(postURI, entMap);
So both the RestTemplate and CXF encapsulate the boilerplate functions of preparing and parsing the request. However, I would like to see either how the RestTemplate marshals the object into XML or how CXF unmarshals it but preferably I would like to be able to see the entire HTTP request including the headers.
The reason I would like that is so that I can mimic the request in other clients, such as Python
, Chrome Poster
etc. More specifically, I would like to write a Python script that will be posting the same XML format to the same REST service and there I do not have Java frameworks to encapsulate the (un)marshaling for me.
I am using Tomcat 7
but was hoping to find a way to do it in Java (debugging) and without logging all HTTP requests in the Tomcat logs.
This didn't work for me because the context was not getting injected and remained null.