开发者

cURL XML REST POST in Java Android

开发者 https://www.devze.com 2023-02-16 16:11 出处:网络
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&

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消