Note that there are some explanatory texts on larger screens.

plurals
  1. POGet array item from webservice object to android
    primarykey
    data
    text
    <p>Im trying to get details like. District, name, Id ect... from MsSql DB through .Net web Service from a array object.</p> <p>My web Service</p> <p>[WebMethod]</p> <pre><code>public DisAndPanDetails[] GetDistrictNameDetails() { DisAndPanDetails[] objDetails = new DisAndPanDetails[1]; SQLHelper objHelper = new SQLHelper(); DataTable dtblDetails = new DataTable(); string sQuery = string.Empty; try { sQuery = "SELECT DISTINCT District FROM OnlineTaxMerchantIdDetails ORDER BY District"; objHelper.CreateConnection("Connect"); dtblDetails = objHelper.FillDataTableByQueryString(sQuery); if (dtblDetails.Rows.Count &gt; 0) { DisAndPanDetails[] objDetail = new DisAndPanDetails[dtblDetails.Rows.Count]; for (int iRowIdx = 0; iRowIdx &lt; dtblDetails.Rows.Count; iRowIdx++) { objDetail[iRowIdx] = new DisAndPanDetails(); objDetail[iRowIdx].District = dtblDetails.Rows[iRowIdx]["District"].ToString(); } } } catch (Exception ex) { objDetails[0] = new DisAndPanDetails(); objDetails[0].Error = ex.Message.ToString(); } finally { objHelper = null; dtblDetails = null; } return objDetails; } </code></pre> <p>My KvmSerializable class</p> <pre><code> public class DisAndPanDetails implements KvmSerializable { public String District; public DisAndPanDetails() { } public DisAndPanDetails(String District) { this.District= District; } public Object getProperty(int arg0) { // TODO Auto-generated method stub switch(arg0) { case 0: return District; } // return null; return null; } public int getPropertyCount() { // TODO Auto-generated method stub return 1; } public void getPropertyInfo(int index, Hashtable arg1, PropertyInfo info) { // TODO Auto-generated method stub switch(index) { case 0: info.type = PropertyInfo.STRING_CLASS; info.name = "District"; break; default: break; } } public void setProperty(int index, Object value) { // TODO Auto-generated method stub switch(index) { case 0: District = value.toString(); break; default: break; } } </code></pre> <p>My Activity Class</p> <pre><code> DisAndPanDetails C = new DisAndPanDetails(); PropertyInfo pi = new PropertyInfo(); pi.setName("C"); pi.setValue(C); pi.setType(C.getClass()); Request.addProperty(pi); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(Request); envelope.addMapping(NAMESPACE, "DisAndPanDetails",new DisAndPanDetails().getClass()); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { androidHttpTransport.call(SOAP_ACTION, envelope); SoapObject response = (SoapObject)envelope.getResponse(); C.District = response.getProperty(0).toString(); System.out.println("Result yash= Dist: "+C.District1+" count:"+intPropertyCount); } KvmSerializable ks = (KvmSerializable)envelope.bodyIn; for(int i=0;i&lt;ks.getPropertyCount();i++) { String obj[] = soap.getProperty(0).toString(); String values[] = (String[])Request.getAttribute("District1"); } System.out.println("rrrr"+response); TextView tv = (TextView)findViewById(R.id.text123); tv.setText(C.District); System.out.println("kkkk"+C.District); } catch(Exception e) { e.printStackTrace(); System.out.println("error:"+e); } } </code></pre> <p>I need to get all district ,name, id into spinner. <strong>I can bind it to spinner but how can I get those detail of array obj as string from web service</strong>. Pls do help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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