http-status-code-415

Unable to post the data to server, getting error java.io.IOException: Server returned HTTP response code: 415

霸气de小男生 提交于 2019-12-03 21:18:59
Iam unable to post the data to the server, getting error as . But it is working fine in curl script. Error reading URL java.io.IOException: Server returned HTTP response code: 415 for URL: https://8.7.177.4/api/domains/amj.nms.mixnetworks.net/subscribers/9001?do_not_disturb=no at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at CurlAuthentication.authenticatePostUrl(CurlAuthentication.java:109) at CurlAuthentication.main(CurlAuthentication.java:134) Error reading URL Below is the

Spring MVC 3.1 REST services post method return 415

若如初见. 提交于 2019-12-02 06:07:39
问题 I'm doing a Spring MVC controller and I still get problem with POST operation. I've read many solutions on stackoverflow without to fix my problem. My achievement at the moment : I sent a GET request with an Id and return an Object converted to JSON successfully. I failed to send a POST request with a JSON body, return = 415 UNSUPPORTED_MEDIA_TYPE 1) I added to my pom.xml the Jackson API : 1.8.5 2) My Spring configuration file: I added all necessary parts : viewResolver org.springframework

Http 415 Unsupported Media type error with JSON

半城伤御伤魂 提交于 2019-11-26 04:33:53
I am calling REST service with JSON request and it gives Http 415 "Unsupported Media Type" error. Request content type is set to ("Content-Type", "application/json; charset=utf8"). It works fine if I don't include Json object in the request. I am using google-gson-2.2.4 library for json. I tried using a couple of different libraries but it made no difference. Can anybody please help me to resolve this? Here is my code: public static void main(String[] args) throws Exception { JsonObject requestJson = new JsonObject(); String url = "xxx"; //method call for generating json requestJson =

Http 415 Unsupported Media type error with JSON

橙三吉。 提交于 2019-11-26 01:53:35
问题 I am calling REST service with JSON request and it gives Http 415 \"Unsupported Media Type\" error. Request content type is set to (\"Content-Type\", \"application/json; charset=utf8\"). It works fine if I don\'t include Json object in the request. I am using google-gson-2.2.4 library for json. I tried using a couple of different libraries but it made no difference. Can anybody please help me to resolve this? Here is my code: public static void main(String[] args) throws Exception {

POST JSON fails with 415 Unsupported media type, Spring 3 mvc

情到浓时终转凉″ 提交于 2019-11-26 00:14:39
问题 I am trying to send a POST request to a servlet. Request is sent via jQuery in this way: var productCategory = new Object(); productCategory.idProductCategory = 1; productCategory.description = \"Descrizione2\"; newCategory(productCategory); where newCategory is function newCategory(productCategory) { $.postJSON(\"ajax/newproductcategory\", productCategory, function( idProductCategory) { console.debug(\"Inserted: \" + idProductCategory); }); } and postJSON is $.postJSON = function(url, data,