How can I convert this statement in cURL curl -i -X POST -H开发者_C百科 "Content-Type:application/xml" -H "Accept: application/xml" -d "<ticket><summary>This is a Summary</summary><priority>3</priority></ticket>" http://user:password@www.assembla.com/spaces/my_space_id/tickets
to Java in Android? The most important part is how to invoke the XML in the URL?
Use HttpClient, specifically HttpPost
for your POST request. The -H
switches turn into addHeader()
calls. You would probably just use a StringEntity
for the XML payload, though I haven't tried a non-urlencoded POST with HttpClient before.
精彩评论