注册

环信创建聊天室一直返回500

public String CreateChatromm(Map params){
       String bearer="Bearer"+" "+this.token;
    
       System.out.print(bearer);
       System.out.print("\n");
       Map header=new HashMap();
       header.put("Authorization",bearer);
       String result="";
       try {
           //https://a1.easemob.com/faceapp/faceapp/chatrooms
        result=httpUtils.httpPost("https://a1.easemob.com/faceapp/faceapp/chatrooms", params, header);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
       return result;
   }
 
 
public  String httpPost(String url,Map map,Map header) throws IOException{
        Connection con = Jsoup.connect(url);
        String result="";
         if(map!=null){
             for (Entry entry : map.entrySet()) {     
                //添加参数
                 con.data(URLEncoder.encode(entry.getKey(),"UTF-8"), URLEncoder.encode(entry.getValue(),"UTF-8"));
                
                } 
         }
           
            con.header("User-Agent", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0))"); 
            con.header("Accept", "application/json"); 
            con.header("Content-Type","application/json");
        
            if(header!=null){
                for (Entry entry1 : header.entrySet()) {     
                    //添加参数
                     con.header(entry1.getKey(), entry1.getValue());
                    
                    } 
            }  
            con.ignoreContentType(true);
            result=con.execute().body();
            int statusCode =con.execute().statusCode();
            if(statusCode==200){
                  result=con.execute().body();
            }else{
                System.out.println("请求错误 状态码为"+statusCode);
                result="请求错误,状态码为:"+String.valueOf(statusCode);
            }  
          
            return result;
           
    }
    
已邀请:
HTTP error fetching URL. Status=500, URL=https://a1.easemob.com/fapp/fapp/chatrooms?description=ts&name=test1&owner=1

要回复问题请先登录注册