connecting android app to mysql trough web service using soap -


i creating app places order. , have created web service is:

using system; using system.collections.generic; using system.linq; using system.web; using system.web.services;  namespace myservice {     /// <summary>     /// summary description service1     /// </summary>     [webservice(namespace = "http://tempuri.org/")]     [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)]     [system.componentmodel.toolboxitem(false)]     // allow web service called script, using asp.net ajax, uncomment following line.      // [system.web.script.services.scriptservice]     public class service1 : system.web.services.webservice     {          [webmethod]         public string helloworld()         {             return "hello world";         }         [webmethod]         public void order()         {             string fname, lname, email, shippingno, city, product, price;          }     } } 

but don't know how enter values in web methods

this mainactivity.java:

package com.example.orderform;   import org.ksoap2.serialization.propertyinfo; import org.ksoap2.serialization.soapobject;   import android.app.activity; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.view.view.onclicklistener;   public class mainactivity extends activity {       private final string namespace = "http://tempuri.org";     private final string url = "http://10.0.2.2/websd/service1.asmx";     private final string soap_action = "http://tempuri.org/helloworld";     private final string method_name = "helloworld";     private string tag = "pgguru";     private static string fname;     private static string lname;     private static string email;     private static string shippingno;     private static string city;     private static string product;     private static string price;     textview show;     edittext e1, e2, e3, e4, e5, e6, e7;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          e1 = (edittext) findviewbyid(r.id.edittext1);         e2 = (edittext) findviewbyid(r.id.edittext2);         e3 = (edittext) findviewbyid(r.id.edittext3);         e4 = (edittext) findviewbyid(r.id.edittext4);         e5 = (edittext) findviewbyid(r.id.edittext5);         e6 = (edittext) findviewbyid(r.id.edittext6);         e7 = (edittext) findviewbyid(r.id.edittext7);         button b1= (button) findviewbyid(r.id.button1);          b1.setonclicklistener(new onclicklistener() {              public void onclick(view v) {                 // todo auto-generated method stub                  asynccallws task = new asynccallws();                  //call execute                   task.execute();             }         });     }     public void adddata(){          soapobject request = new soapobject(namespace, method_name);         //property holds input parameters         propertyinfo a1 = new propertyinfo();         //set name         a1.setname("first name");         //set value         a1.setvalue(e1);         //set datatype         a1.settype(string.class);         //add property request object         request.addproperty(a1);      }     private class asynccallws extends asynctask<string, void, void> {         @override         protected void doinbackground(string... params) {             log.i(tag, "doinbackground");             helloworld();             return null;         }          @override         protected void onpostexecute(void result) {             log.i(tag, "onpostexecute");          }          @override         protected void onpreexecute() {             log.i(tag, "onpreexecute");          }          @override         protected void onprogressupdate(void... values) {             log.i(tag, "onprogressupdate");         }      }         @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. action bar         // automatically handle clicks on home/up button, long         // specify parent activity in androidmanifest.xml.         int id = item.getitemid();         if (id == r.id.action_settings) {             return true;         }         return super.onoptionsitemselected(item);     } } 

and layout

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >      <tablelayout         android:layout_width="match_parent"         android:layout_height="wrap_content" >          <tablerow             android:id="@+id/tablerow1"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >              <textview                 android:id="@+id/textview1"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="first name" />              <edittext                 android:id="@+id/edittext1"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:ems="10"                 android:inputtype="textpersonname" >                  <requestfocus />             </edittext>          </tablerow>          <tablerow             android:id="@+id/tablerow2"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >         </tablerow>          <tablerow             android:id="@+id/tablerow3"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >              <textview                 android:id="@+id/textview2"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="last name" />              <edittext                 android:id="@+id/edittext2"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:ems="10"                 android:inputtype="textpersonname" />          </tablerow>          <tablerow             android:id="@+id/tablerow4"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >              <textview                 android:id="@+id/textview3"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="email" />              <edittext                 android:id="@+id/edittext3"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:ems="10"                 android:inputtype="textemailaddress" />          </tablerow>          <tablerow             android:id="@+id/tablerow5"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >              <textview                 android:id="@+id/textview4"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="shipping no" />              <edittext                 android:id="@+id/edittext4"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:ems="10"                 android:inputtype="number" />          </tablerow>          <tablerow             android:id="@+id/tablerow6"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >              <textview                 android:id="@+id/textview5"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="city" />              <edittext                 android:id="@+id/edittext5"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:ems="10" />          </tablerow>      </tablelayout>      <spinner         android:id="@+id/spinner1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:entries="@array/state_arrays"         android:gravity="center"         android:prompt="@string/state_prompt" />      <tablelayout         android:layout_width="match_parent"         android:layout_height="wrap_content" >          <tablerow             android:id="@+id/tablerow7"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >          <textview                 android:id="@+id/textview6"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="product" />              <edittext                 android:id="@+id/edittext6"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:ems="10"                 android:inputtype="text" >                  <requestfocus />                     </edittext>         </tablerow>          <tablerow             android:id="@+id/tablerow8"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >              <textview                 android:id="@+id/textview7"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="price" />              <edittext                 android:id="@+id/edittext7"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:ems="10"                 android:inputtype="number" >                  <requestfocus />                     </edittext>                       </tablerow>          <tablerow             android:id="@+id/tablerow9"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:gravity="center" >              <button                 android:id="@+id/button1"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="submit" />          </tablerow>          <tablerow             android:id="@+id/tablerow10"             android:layout_width="wrap_content"             android:layout_height="wrap_content" >         </tablerow>     </tablelayout>  </linearlayout> 

and manifest:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.orderform"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk         android:minsdkversion="15"         android:targetsdkversion="17" />      <application         android:allowbackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme" >         <activity             android:name=".mainactivity"             android:label="@string/app_name" >             <intent-filter>                 <action android:name="android.intent.action.main" />                  <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>     </application>  </manifest> 

i want know how data go webservice , database. me or send me best tutorial link. waiting thanks!


Popular posts from this blog