415-不支持的媒体类型 [英] 415-UnSupported Media Type

查看:132
本文介绍了415-不支持的媒体类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用POSTMAN执行RESTFUL Web服务测试时,遇到以下错误:


415不支持的媒体类型


当前在我的代码中,我正在使用MediaType.TEXT_PLAIN。这是由于

解决方案

解决方案。
1.在SOAP UI中删除标头值。
2.我无法在Jersey处理数组。我不是一路处理MethodClass [] [] methodSet,而是一一发送值。
3.我还从MediaType.MULTIPART_FORM_DATA更改回MediaType.PLAIN_TEXT



我的代码正在运行。



感谢您的帮助。


While performing testing RESTFUL Web Service using POSTMAN, I encountered the below error :

415 UnSupported Media Type

Currently in my code, I'm using MediaType.TEXT_PLAIN. This is due to one of the answer from page enter link description here telling that if you need to return integer, you need to use TEXT_PLAIN.

May I know is the data that I provide in the web service is compatible with TEXT_PLAIN or not.

@POST
@Path("/post")
@Produces(MediaType.TEXT_PLAIN)

public int adaptiveAuth( @FormDataParam("uuid") String uuID, 
        @FormDataParam("browserinfo") String browserInfo, 
        @FormDataParam("ipint") long ipInt, 
        @FormDataParam("lat") double latiTude, 
        @FormDataParam("longitude") double longiTude, 
        @FormDataParam("sessionid") String sessionID, 
        @FormDataParam("spid") String spID, 
        @FormDataParam("tr") int tR, 
        @FormDataParam("jsnum") int jsNum, 
        @FormDataParam("fingerprint") String fingerPrint, 
        @FormDataParam("methodset") MethodClass[][] methodSet) throws SQLException{ 

The way I tested in Postman are describe as below:

解决方案

Solution. 1. Remove header value in SOAP UI. 2. I was unable to process an array in Jersey. Instead of process MethodClass [][] methodSet, I'm sending the value one by one. 3. I also change back from MediaType.MULTIPART_FORM_DATA to MediaType.PLAIN_TEXT

My code is working now.

Thanks for the help.

这篇关于415-不支持的媒体类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆