I am new for android developing and i am trying to get a xml list to android from self-created listview.
I am looking for some examples but they are using only one example about fahrenheit to calcius. So i need to get full list of web service.
Here is my code;
private static String SOAP_ACTION1 = "http://ift.tt/1PtxiEb";
private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME1 = "kategoriler";
private static String URL = "http://ift.tt/1OI91ql";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION1, envelope);
SoapObject result = (SoapObject)envelope.bodyIn;
if(result != null)
{
for (int i = 0 ; i<= result.getPropertyCount();i++) {
Object property = result.getProperty(i);
if (property instanceof SoapObject) {
SoapObject info = (SoapObject) property;
String id = info.getProperty("id").toString();
String resim = info.getProperty("resim").toString();
String kategori_adi = info.getProperty("kategori_adi").toString();
Toast.makeText(getApplicationContext(), kategori_adi, Toast.LENGTH_LONG).show();
}
}
}
else
{
Toast.makeText(getApplicationContext(), "No Response", Toast.LENGTH_LONG).show();
}
}
catch (Exception ex) {
Toast.makeText(getApplicationContext(),ex.getMessage(), Toast.LENGTH_SHORT).show();
}
}
When i tried to run this project it gave me unfortu... stopped. My web service file is
<DataSet xmlns="http://tempuri.org/">
<xs:schema xmlns="" xmlns:xs="http://ift.tt/tphNwY" 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="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:int" minOccurs="0"/>
<xs:element name="kategori_adi" type="xs:string" minOccurs="0"/>
<xs:element name="resim" type="xs:string" minOccurs="0"/>
<xs:element name="kategori_no" 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="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<id>1</id>
<kategori_adi>Arkadaşlık & Sohbet</kategori_adi>
<resim>
kategoriresim/eb5b34ba-2ec4-4c96-9ade-4653a01c2a2fa1.jpg
</resim>
</Table>
<Table diffgr:id="Table2" msdata:rowOrder="1">
<id>2</id>
<kategori_adi>Bilgisayar & Internet</kategori_adi>
<resim>
kategoriresim/eb5b34ba-2ec4-4c96-9ade-4653a01c2afa2.jpg
</resim>
</Table>
<Table diffgr:id="Table3" msdata:rowOrder="2">
<id>5</id>
<kategori_adi>Astroloji & Burç</kategori_adi>
<resim>
kategoriresim/eb5b34ba-2ec4-4c96-9ade-4653a01c2afa3.jpg
</resim>
<kategori_no>123</kategori_no>
</Table>
<Table diffgr:id="Table4" msdata:rowOrder="3">
<id>7</id>
<kategori_adi>Yazılım & Tasarım</kategori_adi>
<resim>
kategoriresim/966bad7b-7f0b-4ded-8759-9f19bbc894b2.jpg
</resim>
<kategori_no>1234</kategori_no>
</Table>
<Table diffgr:id="Table5" msdata:rowOrder="4">
<id>8</id>
<kategori_adi>Kişisel & Blog</kategori_adi>
<resim>
kategoriresim/7b8cc2d2-6d07-4ea4-92b6-c99316eb2b04.jpg
</resim>
<kategori_no>214</kategori_no>
</Table>
Actually I want to populate listview from this but i can't access values anywhere.
Aucun commentaire:
Enregistrer un commentaire