Created
April 11, 2012 05:14
-
-
Save zackster/2357128 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Submits a POST request to the given URL with the given XML as an attachment. | |
* | |
* @param url | |
* @param xmlContent | |
* @return | |
* @throw IOException | |
* */ | |
public ContentExchange postXML(String url, String xmlContent) throws IOException { | |
HttpClient client = getClient(); | |
ContentExchange exchange = new ContentExchange(); | |
exchange.setMethod("POST"); | |
exchange.setURL(url); | |
exchange.setRequestContent( new ByteArrayBuffer( xmlContent.getBytes("UTF-8") ) ); | |
exchange.setRequestContentType("text/xml;charset=utf-8"); | |
client.send(exchange); | |
return exchange; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment