简体   繁体   English

SpringBoot Post 在本地工作,但在开发区域失败,出现 415“内容类型 'application/xml;charset=UTF-8' not supported”

[英]SpringBoot Post works locally but in dev region fails with 415 “Content type 'application/xml;charset=UTF-8' not supported”

I have a springboot Rest service with below request mapping.I need the request and response in XML.我有一个带有以下请求映射的springboot Rest服务。我需要XML中的请求和响应。 When I test "POST" works locally and response received in XML format but in Dev region same request fails with status 415?any thoughts\help?当我测试“POST”在本地工作并且以 XML 格式收到响应但在开发区域相同的请求失败时,状态为 415?任何想法\帮助?

@RequestMapping(value = "/get", method = RequestMethod.POST, produces = {
            MediaType.APPLICATION_XML_VALUE }, headers = "Accept=application/xml")

Response I get from Dev region我从开发区得到的回应

{
    "timestamp": "2020-04-23T14:49:29.293+0000",
    "status": 415,
    "error": "Unsupported Media Type",
    "message": "Content type 'application/xml;charset=UTF-8' not supported",
    "path": "/get"
}

Added below Gradle dependency - implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.10.0'在 Gradle 依赖项下方添加 - 实现 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.10.0'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 "status":415, "status":"UNSUPPORTED_MEDIA_TYPE","message":"内容类型 'application/x-www-form-urlencoded;charset=UTF-8' 不支持 - "status":415, "status":"UNSUPPORTED_MEDIA_TYPE","message":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported 使用消息“ message”测试Post API时获得415状态代码:“内容类型'text / plain; charset = UTF-8'不支持” - Getting 415 status code while testing a Post API with the message “message”: “Content type 'text/plain;charset=UTF-8' not supported” 不支持的内容类型:文本/xml; charset=utf-8 支持的有:[application/soap+xml] - Unsupported Content-Type: text/xml; charset=utf-8 Supported ones are: [application/soap+xml] 使用 XML 数据时出错 内容类型 'application/xml;charset=utf-8' not supported spring - Error in consuming XML data Content type 'application/xml;charset=utf-8' not supported spring 其余API POST内容类型'application / json; charset = UTF-8'不支持 - Rest API POST Content type 'application/json;charset=UTF-8' not supported 不支持内容类型 'application/json;charset=UTF-8' - Content type 'application/json;charset=UTF-8' not supported 发布到restController时不支持内容类型'application / json; charset = UTF-8' - Content type 'application/json;charset=UTF-8' not supported when post to restController org.springframework.web.HttpMediaTypeNotSupportedException:内容类型'application / xml; charset = UTF-8'不支持 - org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/xml;charset=UTF-8' not supported 内容类型 'application/json;charset=UTF-8' - Content type 'application/json;charset=UTF-8' Spring Rest 应用程序中的“不支持内容类型‘application/json;charset=UTF-8’” - "Content type 'application/json;charset=UTF-8' not supported" in Spring Rest application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM