2012-09-14 105 views
0

我正在使用kso​​ap庫進行web服務調用。以下是調用webserive的簡單功能。Android ksoap web服務響應截斷

try {  
       METHOD_NAME = method; 
       SOAP_ACTION = "http://tempuri.org/"+method; 
       URL = "http://172.27.212.2:8080/services/"+serviceName; 

       request = new SoapObject(NAMESPACE, METHOD_NAME);       
       soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
       soapEnvelope.dotNet = true;    
       soapEnvelope.setOutputSoapObject(request); 
       androidHttpTransport = new HttpTransportSE(URL);       
       androidHttpTransport.call(SOAP_ACTION, soapEnvelope); 
       SoapPrimitive resultString = (SoapPrimitive) soapEnvelope.getResponse(); 

       return resultString.toString(); 
      } catch (Exception e) { 
       throw e; 
      } 

Webservice方法返回一個json字符串。但在Eclipse中這個字符串被截斷。
我調試和截斷resultString是如下:

輸出:

{"menu":{ "Arrival": [ 
    { 
     "traveldeskdetailid": 1968, 
     "traveldeskid": 4, 
     "AirlineName": "United Airlines", 
     "AirlineLogo": "UA1.gif", 
     "FlightNumber": "1239", 
     "Codeshare": "", 
     "City": "Newark", 
     "AirportName": "Newark Liberty International Airport", 
     "Delayed": "T", 
     "ScheduledTime": "8:29 PM", 
     "Remarks": "126 minutes late", 
     "RemarksWithTime": "Estimated 10:35 PM", 
     "Terminal": "3", 
     "Gate": "85", 
     "path": "http://dem5xqcn61lj8.cloudfront.net/logos/UA1.gif" 
    }, 
    { .. },{ .. }, 
    { 
     "traveldeskdetailid": 1983, 
     "traveldeskid": 4, 
     "AirlineName": "Air Canada", 
     "AirlineLogo": "AC.gif", 
     "FlightNumber": "564", 
     "Codeshare": "", 
     "City": "Vancouver", 
     "AirportName": "Vancouver International Airport", 
     "Delayed": "T", 
     "ScheduledTime": "10:45 PM", 
     "Remarks": "19 minutes late", 
     "RemarksWithTime": "Estimated 11:04 PM", 
     "Terminal": "I", 
     "Gate": "73", 
     "path": "http://dem5xqcn61lj8.cloudfront.net/logos/AC.gif" 
    }, 

    { 
     "traveldeskdetaili... 

響應字符串截斷像

{ 「traveldeskdetaili ...

我如何獲得完整回覆?

回答

0

Eclipse IDE在變量和監視調試字段中顯示了字符數限制。我想,你應該打印出來logcat解析JSON,因爲你已經有了json格式。

+0

我在logcat甚至在logcat字符串中顯示截斷的打印字符串。 – Priyank

+0

響應字符串不被截斷!正如我所想,這不是有限的。請告訴我,你如何打印響應logcat?不幸的是,logcat是有限的。無論如何,給我的代碼處理響應,請 – JunR

+0

我使用此代碼打印Log.e(「Json」,resultString.toString()); – Priyank

0

這或許可以幫助你 這裏 http://tempuri.org/ 變化與您的特定ip地址 像

SOAP_ACTION =「http://172.27.212.2:8080/services/"+method;

+0

我認爲你指向我的地方並不是真正的問題,因爲我可以成功地進行Web服務調用。問題是響應字符串是截斷的。 ! – Priyank