无法在android中显示来自webservice的完整响应

时间:2014-05-27 11:36:33

标签: android web-services

到目前为止,有没有人遇到过这种情况?

现在我正在使用android.Its中的一个webservice以json格式返回它的响应,但是我觉得那个响应的大小超过3mb,那时我只能看到来自该服务的一半响应数据。 谁能告诉我如何查看该服务的所有响应数据?

建议

感谢您宝贵的时间!..

private void Calling_Webservice() 
{
    // TODO Auto-generated method stub

    System.setProperty("http.keepAlive", "false");

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;

    String URL      =   "";
    String METHOD_NAME  =   "";
    String NAMESPACE    =   "";
    String SOAPACTION   =   "";

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty("","");

    envelope.setOutputSoapObject(request);
    HttpTransportSE httpTransportSE = new HttpTransportSE(URL,15000);
    try {

        httpTransportSE.call(SOAPACTION, envelope);
        SoapPrimitive result = (SoapPrimitive)envelope.getResponse();


    /* Checking response */

        if (result != null) {
            InputStream in = httpTransportSE.getEntity().getContent(result); 

            // Get the data in the entity

            InputStreamReader isr = new InputStreamReader(in);
            BufferedReader br = new BufferedReader(isr);

            String result_data =  new String();
            while ((result_data = br.readLine()) != null) 
        {
                System.out.println("RESPONSE IS     :   " + result_data);
            }

        }}

    catch (Exception e) 
    {
        e.printStackTrace();
        }
    }

2 个答案:

答案 0 :(得分:0)

选择一个Scrollview并添加Textview以滚动视图 首先获取字符串变量和postexecute textview.settext(yourresponse)中的所有响应。那就是它,然后你可以显示所有的响应数据。

答案 1 :(得分:0)

这段代码对我很有用,试试这个 -

public static void longInfo(String str) {
        if(str.length() > 4000) {
            Log.i(str.substring(0, 4000));
            longInfo(str.substring(4000));
        } else
            Log.i(str);
    }