2011-07-29 46 views
0

我的應用程序正在調用wcf服務。第一次呼籲&列表中的所有表的名稱,然後在該屏幕上選擇菜單選項,它再次呼叫服務,那個時候它給予錯誤信息「下載」:無法序列Android調用WCF服務

enter image description here

我這樣調用

public static final String APPURL = "http://192.168.1.213:7986/XontService"; 
    private static final String METHOD_NAME = "LoadDownLoadTablesInJSON"; 
    private static final String NAMESPACE = "http://tempuri.org/"; 
    private static String SOAP_ACTION = "http://tempuri.org/IXontPDAService/LoadDownLoadTablesInJSON"; 

    private static final String METHOD_NAME1 = "LoadDownLoadTablesDataJson"; 
    private static String SOAP_ACTION1 = "http://tempuri.org/IXontPDAService/LoadDownLoadTablesDataJson"; 


    // ksoap2 calling wcf 
public SoapPrimitive soapPrimitiveData(String tablename) throws IOException,XmlPullParserException { 
    SoapPrimitive responsesData = null; 
    SoapObject requestData = new SoapObject(NAMESPACE, METHOD_NAME1); // set 

    System.out.println(" ------- " + strBusinessUnit + " -- "+ strExecutive + " -- " + strTerritoryCode + "mrthod : " + METHOD_NAME1); 

    requestData.addProperty("strBusinessUnit", strBusinessUnit); 
    requestData.addProperty("strExecutive", strExecutive); 
    requestData.addProperty("strTableName", tablename); 

    requestData.addProperty("strDate", new Date()); 
    requestData.addProperty("strTerritoryCode", strTerritoryCode); 

    requestData.addProperty("strUField1", ""); 
    requestData.addProperty("strUField2", ""); 
    requestData.addProperty("strUField3", ""); 

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
      SoapEnvelope.VER11); // put all required data into a soap// 
            // envelope 
    envelope.dotNet = true; 
    envelope.setOutputSoapObject(requestData); 
    AndroidHttpTransport httpTransport = new AndroidHttpTransport(APPURL); 
    httpTransport.debug = true; 

    try { 
     httpTransport.call(SOAP_ACTION1, envelope); 
     responsesData = (SoapPrimitive) envelope.getResponse(); 
     System.out.println("-- responses ---- " + responsesData); 
    } catch (SocketException ex) { 
     ex.printStackTrace(); 
    } catch (Exception e) { 
     e.printStackTrace(); 
    } 
    return responsesData; 
} 

請幫助..

在此先感謝。

+1

確保** ** strBusinessUnit和* * tablename **和** strExecutive **和** strTerritoryCode **是字符串 –

+0

一切都是字符串,除了Da te。這是ref字符串strDate – Piraba

+0

謝謝,這是一個問題。我已經通過日期作爲日期類型 – Piraba

回答

1

確保strBusinessUnit *和**的tablenamestrExecutivestrTerritoryCode是字符串

問題是

new Date()