0
我需要使用URL參數以及XML對下面的URL進行http post請求。我正在嘗試使用下面的代碼,但無法獲得正確的回覆。PostMethod/HttpClient
URL - https://mytest.com?z=123&b=abc&c=%10
xml - <test>
<data> This is test XML </data>
</test>
public String getResponse(String xml) {
HttpClient client = new HttpClient();
String url="https://mytest.com";
PostMethod pMethod = new pMethod(url);
pMethod.addParameter("z","123");
pMethod.addParameter("b","abc");
pMethod.addParameter("c","%10");
post.setRequestEntity(new StringRequestEntity(xml, "application/xml", "UTF-8"));
client.executeMethod(pMethod);
}
我在等待XML響應。由於這是http post請求,我想隱藏我的URL參數。除了URL參數外,我還需要發佈XML。我無法一起執行這兩個操作(編碼URL參數+發佈XML)。 – user2893856