File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Printing POST message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Printing POST message" Watch "Printing POST message" New topic
Author

Printing POST message

Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 257
Hello. If somebody has a minute, is there a way to print the contents of a POST message to the console, ie....

POST /EndorsementSearch HTTP/1.1
Host: www.snowboard-info.com
Content-Type: text/xml; charset="utf-8"
Content-Length: 261
SOAPAction: "http://www.snowboard-info.com/EndorsementSearch"
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:GetEndorsingBoarder xmlns:m="http://namespaces.snowboard-info.com">
<manufacturer>K2</manufacturer>
<model>Fatbob</model>
</m:GetEndorsingBoarder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I can obviously print the httpresponse using a bufferedreader and setting up an InputStream on the response...but not sure about outbound POST messages. Thank you very much for reading this.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
See if the Apache Commons HTTPClient package has anything to help. They have an HttpURLConnection replacement that may be a bit more open. I tried to write one once using a raw socket inside so I could do some weird stuff, and realized it would involve implementing a major chunk of the HTTP protocol. I found another way to meet my requirements. You might, too. Have you tried an HTTP sniffer like HttpLook? Or maybe a proxy? (I know zip about proxies, but they seem to live in the right place to print out everything that goes through.)
[ July 31, 2006: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing POST message