1
我有一個xml有效載荷,我將其輸入到Web資源PUT。 我得到一個錯誤400錯誤的請求 我載荷:使用WebResource的XML PAYLOAD輸入PUT
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<value>100</value>
<name>a</name>
代碼:
Client client = Client.create();
WebResource webResource = client.resource("url");
String input ="<?xml version=\"1.0\" encoding=\"UTF-8\"?><value>100</value><name>a</name>";
ClientResponse res=webResource.webResource.type(MediaType.APPLICATION_XML).header("Content-Type","application-xml").put(ClientResponse.class,input);
但我將XML作爲字符串傳遞 – codehacker
它是如何在服務器上處理的?這是發送錯誤請求的客戶端的服務器。服務器發送一個錯誤的請求可能是因爲它不是有效的XML –