Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid consume WCF , that particular method return DataTable
    text
    copied!<p>I am new to this site &amp; Android, If there are any wrong please indicate me . My problem is in soap response, </p> <p>This is my Android code: </p> <pre><code> public static final String APPURL = "http://192.168.1.213:7986/XontService"; private static final String METHOD_NAME = "LoadDownLoadTables"; private static final String NAMESPACE = "http://tempuri.org/"; private static String SOAP_ACTION = "http://tempuri.org/IXontPDAService/LoadDownLoadTables"; try { response = soap(METHOD_NAME, SOAP_ACTION, NAMESPACE, APPURL); Log.w("log_tag","*********" + response.getProperty(0).toString()); } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } // ksoap2 calling wcf public SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //set up request request.addProperty("strExec", "7437"); request.addProperty("strBusinessUnit", "HHHHH"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //put all required data into a soap envelope envelope.dotNet = true; envelope.setOutputSoapObject(request); AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL); httpTransport.debug = true; try{ Log.w("log_tag", " ===========" +SOAP_ACTION.toString() ); Log.w("Log_cat" ,"*********" + envelope.toString()); httpTransport.call(SOAP_ACTION, envelope); // Log.d("resBundle", String.valueOf(resBundle)); } catch(Exception e) { e.printStackTrace(); } SoapObject responses = (SoapObject)envelope.getResponse(); return responses; } // response processing public String[] getStringArrayResponse(SoapObject node, Vector&lt;String&gt; strings) { boolean isFirstCall = false; if (strings == null) { isFirstCall = true; strings = new Vector&lt;String&gt;(); } int count = response.getPropertyCount(); for (int i = 0; i &lt; count; i++) { Object obj1 = node.getProperty(i); if (obj1 instanceof SoapObject) { if (((SoapObject)obj1).getPropertyCount() &gt; 0) { getStringArrayResponse((SoapObject)obj1, strings); } } else if (obj1 instanceof SoapPrimitive) { strings.add(((SoapPrimitive)obj1).toString()); } } // only make this for the original caller if (isFirstCall) { return (String[])strings.toArray(new String[strings.size()]); } return null; } </code></pre> <p>This is C# method:</p> <pre><code> public DataTable LoadDownLoadTables(string strExec, string strBusinessUnit) { DataTable dtDownload = new DataTable(); try { XontPDAServiceDAL vu = new XontPDAServiceDAL(); if (vu.validateExecutive(strBusinessUnit, strExec) == true) { DownloadFetchBLL wmd = new DownloadFetchBLL(); dtDownload = wmd.LoadDownLoadTable(strBusinessUnit, strExec); } else { throw new FaultException("Executive Not Active in the system."); } } catch (FaultException) { } catch (Exception ex) { throw new FaultException("Database Server is Not Responding."); } return dtDownload; } </code></pre> <p>This is my WSDl</p> <pre><code> &lt;wsdl:definitions name="XontPDAService" targetNamespace="http://tempuri.org/"&gt; &lt;wsdl:types&gt; &lt;xsd:schema targetNamespace="http://tempuri.org/Imports"&gt;&lt;xsd:import schemaLocation="http://192.168.1.213:7986/XontService?xsd=xsd0" namespace="http://tempuri.org/"/&gt; &lt;xsd:import schemaLocation="http://192.168.1.213:7986/XontService?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/&gt; &lt;xsd:import schemaLocation="http://192.168.1.213:7986/XontService?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/&gt; &lt;xsd:import schemaLocation="http://192.168.1.213:7986/XontService?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/System.Data"/&gt; &lt;xsd:import schemaLocation="http://192.168.1.213:7986/XontService?xsd=xsd4" namespace="http://schemas.datacontract.org/2004/07/XONT.Common.Data.PDAServiceBLL"/&gt; &lt;xsd:import schemaLocation="http://192.168.1.213:7986/XontService?xsd=xsd5"/&gt;&lt;/xsd:schema&gt; &lt;/wsdl:types&gt; ------ ------ &lt;wsdl:operation name="LoadDownLoadTables"&gt; &lt;soap:operation soapAction="http://tempuri.org/IXontPDAService/LoadDownLoadTables" style="document"/&gt;&lt;wsdl:input&gt; &lt;soap:body use="literal"/&gt;&lt;/wsdl:input&gt; &lt;wsdl:output&gt;&lt;soap:body use="literal"/&gt;&lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; </code></pre> <p>and schema file is :</p> <pre><code> &lt;xs:schema elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/System.Data" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/System.Data"&gt; &lt;xs:element name="DataTable" nillable="true"&gt; &lt;xs:complexType&gt; &lt;xs:annotation&gt; &lt;xs:appinfo&gt; &lt;ActualType Name="DataTable" Namespace="http://schemas.datacontract.org/2004/07/System.Data" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" /&gt; &lt;/xs:appinfo&gt; &lt;/xs:annotation&gt; &lt;xs:sequence&gt; &lt;xs:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" /&gt; &lt;xs:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>I got following message: <strong>AnyType{element=anyType{complexType=anyType{choice=anyType{element=anyType{complexType=anyType{sequence=anyType{element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; }; }; }; }; }; }; }</strong></p> <p>Please help me ..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload