开发者

Android calling WCF service

开发者 https://www.devze.com 2023-03-23 15:09 出处:网络
My application is calling wcf service. First time its call & list all table name then on that screen select \"Download\" from menu option , Its calling again service, That time its give error mess

My application is calling wcf service. First time its call & list all table name then on that screen select "Download" from menu option , Its calling again service, That time its give error message :Can not serialize

Android calling WCF service

I called Like this

  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 da开发者_开发知识库ta 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;
}

Please help ..

Thanks in advance.


make sure strBusinessUnit* AND **tablename AND strExecutive AND strTerritoryCode are Strings

The problem is

 new Date()
0

精彩评论

暂无评论...
验证码 换一张
取 消