How to get plain XML from javax.ws.rs Entity on client side
<p>I have a <code>REST</code> client that creates a <code>XML</code> entity via <code>Entity.entity(myObject, MediaType.APPLICATION_XML_TYPE)</code>. After that, I call <code>webTarget.request().buildPost(...</code></p>

<p>How can I get the request body <code>XML</code> that my client will send to the server? (I need it for debugging reasons.) All I get here is a <a href="https://docs.oracle.com/javaee/7/api/javax/ws/rs/client/Entity.html" rel="nofollow"><code>Entity</code></a> object.</p>

<p>Of course I could serialize it myself with a <a href="https://docs.oracle.com/javase/7/docs/api/javax/xml/bind/Marshaller.html" rel="nofollow"><code>Marshaller</code></a> but is this really the same <code>XML</code> the client would send?</p>