Llame a la variable de tipo de referencia WCF

Soy totalmente nuevo a C #. Tengo un método de servicio

//actual method public DataTable LoadDownLoadTablesData(string strBusinessUnit, string strExecutive, string strTableName, ref string strDate, string strTerritoryCode, string strUField1, string strUField2, string strUFeild3) { DataTable ds = new DataTable(); try { XontPDAServiceDAL vu = new XontPDAServiceDAL(); if (vu.validateExecutive(strBusinessUnit, strExecutive) == true) { DownloadFetchBLL wmd = new DownloadFetchBLL(); strDate = DateTime.Now.ToString(); ds = wmd.LoadDownLoadTableData(strBusinessUnit, strExecutive, strTableName, strTerritoryCode, strUField1, strUField2, strUFeild3); } else { throw new FaultException("Executive Not Active in the system."); } } catch (FaultException) { } catch (Exception ex) { throw new FaultException("Database Server is Not Responding." + ex.Message); } return ds; } //Converting datatable to String type public string LoadDownLoadTablesDataJson(string strBusinessUnit, string strExecutive, string strTableName, ref string strDate, string strTerritoryCode, string strUField1, string strUField2, string strUFeild3) { DataTable dtDownloadJson = new DataTable(); dtDownloadJson = this.LoadDownLoadTablesData(strBusinessUnit, strExecutive, strTableName, ref strDate, strTerritoryCode, strUField1, strUField2, strUFeild3); return this.ConverTableToJson(dtDownloadJson); } //Converting table to json public String ConverTableToJson(DataTable dtDownloadJson) { string[] StrDc = new string[dtDownloadJson.Columns.Count]; string HeadStr = string.Empty; // if (dtDownloadJson.Columns.Count > 0) // { for (int i = 0; i < dtDownloadJson.Columns.Count; i++) { StrDc[i] = dtDownloadJson.Columns[i].Caption; HeadStr += "\"" + StrDc[i] + "\" : \"" + StrDc[i] + i.ToString() + "¾" + "\","; } if (HeadStr.Length > 0) { HeadStr = HeadStr.Substring(0, HeadStr.Length - 1); StringBuilder Sb = new StringBuilder(); Sb.Append("{\"" + dtDownloadJson.TableName + "\" : ["); for (int i = 0; i < dtDownloadJson.Rows.Count; i++) { string TempStr = HeadStr; Sb.Append("{"); for (int j = 0; j < dtDownloadJson.Columns.Count; j++) { TempStr = TempStr.Replace(dtDownloadJson.Columns[j] + j.ToString() + "¾", dtDownloadJson.Rows[i][j].ToString()); } Sb.Append(TempStr + "},"); } Sb = new StringBuilder(Sb.ToString().Substring(0, Sb.ToString().Length - 1)); Sb.Append("]}"); return Sb.ToString(); }else { return "0"; } // }else{ // return "0"; // } } 

Esta variable de referencia LoadDownLoadTablesData () está allí.

Tengo que pasar la llamada de este LoadDownLoadTablesDataJson (….) de Android,

Llamé así;

  // ksoap2 calling wcf public SoapPrimitive soapPrimitiveData(String method_name1, String soap_action1, String NAMESPACE, String APPURL ,String tablename ) throws IOException,XmlPullParserException { SoapPrimitive responses = null; SoapObject request = new SoapObject(NAMESPACE, method_name1); // set up request.addProperty("strBusinessUnit", "HEMA"); request.addProperty("strExec", "4515"); request.addProperty("strTableName", "RD.AlternativeProductHeader"); // after login we will get these fields value request.addProperty("strDate", "2000-04-29"); request.addProperty("TerritoryCode", "KAND"); request.addProperty("strUField1", ""); request.addProperty("strUField2", ""); request.addProperty("strUField3", ""); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); // put all required data into a soap// envelope envelope.dotNet = true; envelope.setOutputSoapObject(request); AndroidHttpTransport httpTransport = new AndroidHttpTransport(APPURL); httpTransport.debug = true; try { httpTransport.call(soap_action1, envelope); responses = (SoapPrimitive) envelope.getResponse(); Log.w("log_tag", "@@@@ 218 @@@@" + responses); } catch (Exception e) { e.printStackTrace(); } return responses; } 

Esto siempre devuelve "0". Pero cuando corro a través de la prueba simulada C # sitio, devolver algún resultado. Ver

  String da1 = "2000-04-29"; String s = client.LoadDownLoadTablesDataJson("HEMA", "4515", "RD.AlternativeProductHeader", ref da1, "KAND", "", "", ""); Label1.Text = s; 

Salida es:

 {"Table1" : [{"TableName" : "LoadDistributor","Description" : "Distributor ","MandatoryFlag" : "1","Status" : "","Priority" : "0"},{"TableName" : "LoadPrice","Description" : "Price ","MandatoryFlag" : "1","Status" : "","Priority" : "0"}]} 

Tengo confundir cómo queremos pasar tipo de referencia con Android?

Por favor, ayúdame..

Gracias por adelantado.

Debe tener dar como este request.addProperty("strExecutive", "4515"); No request.addProperty("strExe", "4515");

Yo shoube ser nombre de argumento de servicio.No puedo dar nombre diferente

Parece que el nombre de la propiedad en su solicitud andriod no coincide con el nombre del parámetro en su método de servicio web .NET: strExe! = StrExecutive.

  • Android se conecta a un servicio de reposo de WCF en IIS con la autenticación de certificado de cliente autofirmada
  • WCF vs WEB api vs Web servicios para el nuevo sitio web de comercio electrónico
  • Cómo consumir servicio WCF con Android
  • Android - Https conexión a un servicio WCF de .NET da SSLException: "Ningún certificado de compañero"
  • Xamarin Android - Hacer una petición de descanso con un parámetro complejo (objeto) lanza excepción, en .NET funciona bien (Usando fábrica de canales)
  • Solicitud de aplicaciones para Android Servicio WCF (SerializationException - utf-8 related)
  • Pasar objetos al servicio de jabón wcf desde android usando ksoap2; Envía y recibe 0
  • Cómo llamar a un servicio WCF usando ksoap2 en android?
  • Android Value ... de tipo java.lang.String no se puede convertir a JSONArray
  • Wcf progressive descargar
  • Cómo consumir servicios WCF dependientes de la sesión usando Ksoap2-Android
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.