PDA

View Full Version : bind webservice to listview



s.aijaz1
07-04-2011, 07:49 AM
hi

i am a beginner in android application development. I have developed a web service in dotnet. the methods of the webservice are returning dataset. I need a help to understand how do we bind a webservice to list view for android(Eclipse). im stuck please help. below is web method:

[WebMethod(Description = "the method fetches clean log for a customer")]
public DataSet FetchCleanLog(int CustomerID)
{
DataSet aDataSet = new DataSet();
CleanLogBL bl = new CleanLogBL(0);
bl.FetchAllForCustomer(aDataSet, CustomerID);
return aDataSet;
}

WEB SERVICE GENERATED XML
----------------------------------------------
<DataSet xmlns="http://tempuri.org/">
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"id="NewDataSet">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="tbCleanLog">
<xs:complexType>
<xs:sequence>
<xs:element name="CleanLog" type="xs:long" minOccurs="0"/>
<xs:element name="Customer" type="xs:long" minOccurs="0"/>
<xs:element name="Name" type="xs:string" minOccurs="0"/>
<xs:element name="Cleaned" type="xs:boolean" minOccurs="0"/>
<xs:element name="Color" type="xs:long" minOccurs="0"/>
<xs:element name="ColorName" type="xs:string" minOccurs="0"/>
<xs:element name="CleanDate" type="xs:string" minOccurs="0"/>
<xs:element name="CreatedBySystemUser" type="xs:long" minOccurs="0"/>
<xs:element name="CreatedOnDate" type="xs:string" minOccurs="0"/>
<xs:element name="ModifiedBySystemUser" type="xs:long" minOccurs="0"/>
<xs:element name="ModifiedOnDate" type="xs:string" minOccurs="0"/>

</xs:sequence>



</xs:complexType>



</xs:element>



</xs:choice>



</xs:complexType>



</xs:element>



</xs:schema>


<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<tbCleanLog diffgr:id="tbCleanLog1" msdata:rowOrder="0">
<CleanLog>1</CleanLog>
<Customer>1</Customer>
<Name>Hitler</Name>
<Cleaned>true</Cleaned>
<Color>1</Color>
<ColorName>Yellow Brava</ColorName>
<CleanDate>01/06/2011</CleanDate>
<CreatedBySystemUser>1</CreatedBySystemUser>

</tbCleanLog>



</NewDataSet>



</diffgr:diffgram>



</DataSet>

Droid-Xer
07-04-2011, 09:04 PM
let me move this to the correct section for more help

alostpacket
07-08-2011, 08:28 PM
I dont use Webservices because... well... webservices.... I'll hold my toungue.

Anyways, Android doesnt have built in webservice <-> view binding. You'd have to bind it manually or try and find a library that helps you bind it.

For XML parsing I'd reccommend the DOM or SAX parser in the Android API, and for binding a data model to a Listview, you should look into creating an array of custom Java objects and extending the BaseAdapter interface. BaseAdapter will help you connect your data to the ListView.

Hope that helps.