1
Мне нужно написать Джерси-клиент весной.Джерси: http ошибка 400
Используя CURL, это работает:
curl --header "Authorization: Basic aaaaaaabbbbb" --header "Content-Type: application/json" --request POST "http://163.162.8.112:9000/path" --data @TestWrapperJob.json
--> return a STRING
-- TestWrapper.json
{ "name": "job2aad",
"description": "Descrizione test job1",
"tests": [ {
"TestPath": "EsempiRiccardo\\TestWrapper",
"TestDuration": "2"
} ],
"topology": null
}
Теперь я пытаюсь перевести в JAVA, но я получаю HTTP ERROR 400
Client client = Client.create();
String temp = "{ \"name\": \"job2aad\", "
+ " \"description\": \"Descrizione test job1\", "
+ " \"tests\": [ { "
+ " \"TestPath\": \"EsempiRiccardo\\TestWrapper\", "
+ " \"TestDuration\": \"2\" "
+ " } ], "
+ " \"topology\": null "
+ "}";
WebResource webResource = client.resource("http://163.162.8.112:9000/path");
ClientResponse response = webResource.header("Authorization", "Basic aaaaaaabbbbb")
.type("application/json")
.post(ClientResponse.class, temp);
Что случилось?
Риккардо