2011-08-12 10 views
0

android Post 메소드의 최대 크기는 얼마입니까? 서버에서 응답을 받으면 메시지의 일부가 누락됩니다. 포스트 메서드의 최대 크기에 도달했을 수도 있습니다. 게시 방법에 제한이 없으면이를 위해 서버 사양을 변경해야합니까?android의 HTTP Post 메소드의 최대 크기는 얼마입니까

+0

브라우저 기반으로 보이며 서버 구성에 따라 달라집니다. 나는 이론적으로 한계가 있다고 생각하지 않는다. – Randroid

답변

0

이론적으로 제한이 없습니다. POST 응답 크기는 Java VM 힙 크기 which is device independent으로 제한됩니다. 아마 당신의 게시물 응답이 소비하는 것 이상일 것입니다.

응답 부분이 누락되었는지 어떻게 확인합니까? LogCat으로 인쇄하거나 디버그 모드로 보면 3 개의 점으로 끝나는 메시지의 시작 부분 만 볼 수 있습니다 (메시지가 모두 표시되며 사용자에게 표시되지 않습니다).

1

동일한 문제가있어서 HttpPost를 사용했으며 응답은 서버에서 가져 왔지만 데이터의 일부는 매우 큰 크기 때문에 누락되었습니다. 그래서 다른 방법을 사용했습니다. HttpURLConnection을 OuputStream과 함께 사용하여 서버에 요청하고 BufferedReader/InputStream을 사용하여 응답을받습니다.

HttpURLConnection my_httpConnection = (HttpURLConnection) new URL("https://integrator-ut.vegaconnection.com/Authentication.svc?wsdl").openConnection(); 
    my_httpConnection.setRequestMethod("POST"); 
    my_httpConnection.setDoInput(true); 
    my_httpConnection.setDoOutput(true); 
    my_httpConnection.setRequestProperty("Content-type", "text/xml; charset=utf-8"); 



    OutputStream my_outPutStream = this.my_httpConnection.getOutputStream(); 
    Writer my_writer = new OutputStreamWriter(my_outPutStream); 
    my_writer.write(YOUR_REQUEST); //YOUR_REQUEST is a String 
    my_writer.flush(); 
    my_writer.close();   

    BufferedReader my_bufferReader = new BufferedReader(new InputStreamReader(this.my_httpConnection.getInputStream())); 
    char[] buffer = new char[10000]; 
    int nbCharRead=0; 
    try 
    { 
     while((nbCharRead = my_bufferReader.read(buffer, 0, 10000)) != -1) 
     { 
      /* Your treatement : saving on a file/arraylist/etc 

     } 
    } 
관련 문제