Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java XML问题:内容类型';text/xml;字符集=ISO-8859-1';不是预期的类型';text/xml;字符集=utf-8';_Java_Xml_Post - Fatal编程技术网

Java XML问题:内容类型';text/xml;字符集=ISO-8859-1';不是预期的类型';text/xml;字符集=utf-8';

Java XML问题:内容类型';text/xml;字符集=ISO-8859-1';不是预期的类型';text/xml;字符集=utf-8';,java,xml,post,Java,Xml,Post,您好,我目前正在用java编写代码,向url发送post xml请求 response = given().relaxedHTTPSValidation().request().contentType("text/xml").body(new String(readFileContent(fileName, folderName, jsonObj, "xml", csvData))).when().post(url); 但是,当我的代码尝试运行代码时,我得到一个: HTTP/1.1 415 C

您好,我目前正在用java编写代码,向url发送post xml请求

response = given().relaxedHTTPSValidation().request().contentType("text/xml").body(new String(readFileContent(fileName, folderName, jsonObj, "xml", csvData))).when().post(url);
但是,当我的代码尝试运行代码时,我得到一个:

HTTP/1.1 415 Cannot process the message because the content type 'text/xml; charset=ISO-8859-1' was not the expected type 'text/xml; charset=utf-8'.

原因可能是什么,我可以通过调试找出问题所在?

请在此基础上添加一个最小的可复制示例:尝试使用application/xml charset=utf-8作为内容类型,而不是text/xml。对此,我的第一反应是,所调用的服务是由不知道自己在做什么的人编写的。绝对没有理由要求对XML内容进行特定编码。请在此基础上添加一个最小的可复制示例:尝试使用application/XML charset=utf-8作为内容类型,而不是text/XML。对此,我的第一反应是,调用的服务是由不知道自己在做什么的人编写的。绝对没有理由要求对XML内容进行特定编码。