Click here to Skip to main content
Click here to Skip to main content

Step by Step Method to Access Webservice from Android

By , 24 Sep 2010
 

System Requirements

The sections below describe the system and software requirements for developing Android applications using the Android SDK.

Supported Operating Systems

  • Windows XP (32-bit) or Vista (32- or 64-bit)
  • Mac OS X 10.5.8 or later (x86 only)
  • Linux (tested on Linux Ubuntu Hardy Heron)

Supported Development Environments

Eclipse IDE

  • Eclipse 3.4 (Ganymede) or 3.5 (Galileo)

Caution: There are known issues with the ADT plugin running with Eclipse 3.6. Please stay on 3.5 until further notice.

  • Eclipse JDT plugin (included in most Eclipse IDE packages)
  • If you need to install or update Eclipse, you can download it from http://www.eclipse.org/downloads/.

    Several types of Eclipse packages are available for each platform. For developing Android applications, we recommend that you install one of these packages:

  • Eclipse IDE for Java EE Developers
  • Eclipse IDE for Java Developers
  • Eclipse for RCP/Plug-in Developers
  • Eclipse Classic (versions 3.5.1 and higher)
  • JDK 5 or JDK 6 (JRE alone is not sufficient)
  • Android Development Tools plugin (optional)
  • Not compatible with Gnu Compiler for Java (gcj)

Hardware Requirements

The Android SDK requires disk storage for all of the components that you choose to install. The table below provides a rough idea of the disk-space requirements to expect, based on the components that you plan to use.

Component type

Approximate size

Comments

SDK Tools

50 MB

Required.

Android platform (each)

150 MB

At least one platform is required.

SDK Add-on (each)

100 MB

Optional.

USB Driver for Windows

10 MB

Optional. For Windows only.

Samples (per platform)

10M

Optional.

Offline documentation

250 MB

Optional.

Note that the disk-space requirements above are in addition to those of the Eclipse IDE, JDK, or other prerequisite tools that you may need to install on your development computer.

Installing the ADT Plugin for Eclipse

  1. Start Eclipse, then select Help > Install New Software.
  2. In the Available Software dialog, click Add....
  3. In the Add Site dialog that appears, enter a name for the remote site (for example, "Android Plugin") in the "Name" field.

In the "Location" field, enter this URL:

https://dl-ssl.google.com/android/eclipse/

Note: If you have trouble acquiring the plugin, you can try using "http" in the URL, instead of "https" (https is preferred for security reasons).

Click OK.

  1. Back in the Available Software view, you should now see "Developer Tools" added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next.
  2. In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. Click Next to read and accept the license agreement and install any dependencies, then click Finish.
  3. Restart Eclipse.

Configuring the ADT Plugin

Once you've successfully downloaded ADT as described above, the next step is to modify your ADT preferences in Eclipse to point to the Android SDK directory:

  1. Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).
  2. Select Android from the left panel.
  3. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.

Click Apply, then OK.

Creating an Android Project

The ADT plugin provides a New Project Wizard that you can use to quickly create a new Android project (or a project from existing code). To create a new project:

  1. Select File > New > Project.
  2. Select Android > Android Project, and click Next.
  3. Select the contents for the project:
    • Enter 'AndroidWSAccess'. This will be the name of the folder where your project is created.
    • Under Contents, select Create new project in workspace. Select your project workspace location.
    • Under Target, select an Android target to be used as the project's Build Target. The Build Target specifies which Android platform you'd like your application built against.

      Unless you know that you'll be using new APIs introduced in the latest SDK, you should select a target with the lowest platform version possible.

      Note: You can change your the Build Target for your project at any time: Right-click the project in the Package Explorer, select Properties, select Android and then check the desired Project Target.

    • Under Properties, fill in all necessary fields.
      • Enter an Application name as 'AndroidWSAccess'. This is the human-readable title for your application — the name that will appear on the Android device.
      • Enter a Package name as 'com.test.android'. This is the package namespace (following the same rules as for packages in the Java programming language) where all your source code will reside.
      • Select Create Activity (optional, of course, but common) and enter a name (give 'FirstAppUI') for your main Activity class.
      • Enter a Min SDK Version. This is an integer that indicates the minimum API Level required to properly run your application. Entering this here automatically sets the minSdkVersion attribute in the <uses-sdk> of your Android Manifest file. If you're unsure of the appropriate API Level to use, copy the API Level listed for the Build Target you selected in the Target tab.
  4. Click Finish.

Tip: You can also start the New Project Wizard from the New icon in the toolbar.

Once you complete the New Project Wizard, ADT creates the following folders and files in your new project:

src/
Includes your stub Activity Java file. All other Java files for your application go here.
<Android Version>/ (e.g., Android 2.2/)

Includes the android.jar file that your application will build against. This is determined by the build target that you have chosen in the New Project Wizard.

gen/

This contains the Java files generated by ADT, such as your R.java file and interfaces created from AIDL files.

assets/
This is empty. You can use it to store raw asset files.
res/
A folder for your application resources, such as drawable files, layout files, string values, etc.
AndroidManifest.xml
The Android Manifest for your project.
default.properties
This file contains project settings, such as the build target. This file is integral to the project, as such, it should be maintained in a Source Revision Control system. It should never be edited manually — to edit project properties, right-click the project folder and select "Properties".

Creating an AVD

An Android Virtual Device (AVD) is a device configuration for the emulator that allows you to model real world devices. In order to run an instance of the emulator, you must create an AVD.

To create an AVD from Eclipse:

  1. Select Window > Android SDK and AVD Manager, or click the Android SDK and AVD Manager icon in the Eclipse toolbar.
  2. In the Virtual Devices panel, you'll see a list of existing AVDs. Click New to create a new AVD.
  3. Fill in the details for the AVD.

    Give it a name, a platform target, an SD card size, and a skin (HVGA is default).

    Note: Be sure to define a target for your AVD that satisfies your application's Build Target (the AVD platform target must have an API Level equal to or greater than the API Level that your application compiles against).

  4. Click Create AVD.

Your AVD is now ready and you can either close the SDK and AVD Manager, create more AVDs, or launch an emulator with the AVD by selecting a device and clicking Start.

Code your FirstAppUI.java class like below:

package com.test.android;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;

public class FirstAppUI extends Activity {

	
	private static final String NAMESPACE = "com.service.ServiceImpl";
	private static final String URL = 
		"http://192.168.202.124:9000/AndroidWS/wsdl/ServiceImpl.wsdl";	
	private static final String SOAP_ACTION = "ServiceImpl";
	private static final String METHOD_NAME = "message";
	
	private static final String[] sampleACTV = new String[] {
	"android", "iphone", "blackberry"
	};

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		ArrayAdapter<String> arrAdapter = new ArrayAdapter<String>
		(this, android.R.layout.simple_dropdown_item_1line, sampleACTV);

		AutoCompleteTextView ACTV = (AutoCompleteTextView)findViewById
						(R.id.AutoCompleteTextView01);
		ACTV.setAdapter(arrAdapter);

		SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 		
		SoapSerializationEnvelope envelope = 
			new SoapSerializationEnvelope(SoapEnvelope.VER11); 

		envelope.setOutputSoapObject(request);
		HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

		try {
			androidHttpTransport.call(SOAP_ACTION, envelope);
			SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
			ACTV.setHint("Received :" + resultsRequestSOAP.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}  

Insert AutoCompleteTextView to your res>layout >main.xml as:

<?xml version="1.0" encoding="utf-8"?>  
<LinearLayout android:id="@+id/LinearLayout01"
     android:layout_width="fill_parent"     
     android:layout_height="fill_parent"     
     xmlns:android="http://schemas.android.com/apk/res/android">  

     <AutoCompleteTextView     
         android:id="@+id/AutoCompleteTextView01"         
         android:layout_width="wrap_content"         
         android:layout_height="wrap_content"         
         android:hint="This is Hint"         
         android:width="240px" />  

 </LinearLayout>

Insert Internet access permission to your mobile application in AndroidManifest.xml file as:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.test.android"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".FirstAppUI"
                  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>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-sdk android:minSdkVersion="8" />

</manifest> 

ServiceImpl.wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace=http://service.com 
	xmlns:apachesoap=http://xml.apache.org/xml-soap 
	xmlns:impl="http://service.com" xmlns:intf=http://service.com 
	xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/ 
	xmlns:wsdlsoap=http://schemas.xmlsoap.org/wsdl/soap/ 
	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" 
      targetNamespace="http://service.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="message">
    <complexType/>
   </element>
   <element name="messageResponse">
    <complexType>
     <sequence>
      <element name="messageReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>

   <wsdl:message name="messageResponse">
      <wsdl:part element="impl:messageResponse" name="parameters">
      </wsdl:part>
   </wsdl:message>
   <wsdl:message name="messageRequest">
      <wsdl:part element="impl:message" name="parameters">
      </wsdl:part>
   </wsdl:message>
   <wsdl:portType name="ServiceImpl">
      <wsdl:operation name="message">
         <wsdl:input message="impl:messageRequest" name="messageRequest">
       </wsdl:input>
         <wsdl:output message="impl:messageResponse" name="messageResponse">
       </wsdl:output>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="ServiceImplSoapBinding" type="impl:ServiceImpl">
      <wsdlsoap:binding style="document" 
	transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="message">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="messageRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="messageResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="ServiceImplService">
      <wsdl:port binding="impl:ServiceImplSoapBinding" name="ServiceImpl">
         <wsdlsoap:address location=
		"http://localhost:9000/AndroidWS/services/ServiceImpl"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

Thanks!

History

  • 24th September, 2010: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Mihira Prasanna
Software Developer Synapsys Ltd, DFCC Bank, Sri Lanka
Sri Lanka Sri Lanka
Member
Researching innovation of software technology.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionUnfortunately stopped workingmemberMember 993657823 Mar '13 - 8:57 
Mine also the same case...Its saying "Unfortunately stopped working"
Can anyone plz help me out!!!!!
QuestionUnfortunately Stopped Working with this code?memberShahbazkhanmd17 Feb '13 - 2:20 
I tried with this code but its saying "Unfortunately stopped working".
I am using AVD emulator.
Mohammed Shahbaz Khan.

Questioncall web service got e=null exceptionmembersonichanxiao19 Jul '12 - 22:21 
My code is same as yours. But at line:
httpTransport.call(SOAP_ACTION, envelope);
, it causes exception, it jumps to the catch exception. I found the exception variable e has value null. The same code works fine on a normal Java project. I have give permission in manifest file already.
Questionandroid Webservice error font UTF8memberdaitranthanhhoa18 Jun '12 - 18:52 
I have result error font UTF8
How does this problem resolve?
GeneralMy vote of 1memberHai-Binh LE27 May '12 - 23:05 
A bad tutorial...
QuestionServiceImpl.wsdlmemberYarakam Bharathi23 May '12 - 21:37 
Where to add ServiceImpl.wsdl
QuestionI have a web service url rather than a wsdl file.How can i acces thatmemberkiranmatrixlee22 Apr '12 - 0:28 
i have this url /poscodeservernew/PostCodeService.asmx
and it have a helloworld method.Then how can i give values to this function and return values?
GeneralMy vote of 1memberkeret18 Mar '12 - 6:35 
Why do you write an article if all you can do is copypaste some unrelated staff from some developers site and undocumented code?
QuestionWhere to add ServiceImpl.wsdl in android app, help!memberrufj28 Dec '11 - 2:30 
Cry | :((
nothing can hold me back from my strong will when i want to it

GeneralMy vote of 5memberMember 82962467 Dec '11 - 11:00 
very clear
QuestionGetting ClassCastException or org.xmlpull.v1.XmlPullParserExceptionmemberharshawardhan.sd15 Nov '11 - 1:58 
Hi,
 
Thanks for the code, it really works.
But I am getting two exceptions on different ksoap2 jars :
1) When I used
Quote:
ksoap2-android-assembly-2.4-jar-with-dependencies.jar
I am getting error on line :
androidHttpTransport.call(SOAP_ACTION, envelope);
as follows:
11-15 17:21:17.926: WARN/System.err(502): org.xmlpull.v1.XmlPullParserException: expected: END_TAG {http://schemas.xmlsoap.org/soap/envelope/}Body (position:END_TAG </{http://schemas.xmlsoap.org/soap/envelope/}soap:Fault>@1:320 in java.io.InputStreamReader@44e98fa8) 
 
2) When I used
Quote:
ksoap2-android-assembly-2.5.7-jar-with-dependencies.jar
I got the exception on line :
SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
as follows :
11-15 18:31:19.234: WARN/System.err(2205): java.lang.ClassCastException: org.ksoap2.SoapFault
.
 
Please help me to get the proper jar or the way by which I can overcome this error.
AnswerRe: Getting ClassCastException or org.xmlpull.v1.XmlPullParserExceptionmemberraja.abz11 Sep '12 - 22:57 
Hi,
 
I am also getting the same error on line :
 
androidHttpTransport.call(SOAP_ACTION, envelope);
 
as follows:
 
org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG @4:81 in java.io.InputStreamReader@4052e620)
 

have u resolved those issues..?
 

Regards,
Raja M
GeneralMy vote of 1memberMichael Ulmann19 Oct '11 - 16:56 
SOAP is a bad bad choice for mobile apps use REST instead!
GeneralMy vote of 5memberazizsurani4 Oct '11 - 21:16 
sir where to add ServiceImpl.wsdl in android app
GeneralMy vote of 5membermsameera24 Sep '11 - 6:14 
Excellent Work, i got lots of knowledge,Thnx
GeneralMy vote of 3memberlijo011@yahoo.com6 Sep '11 - 18:58 
simple one
QuestionKSOAP_ACTION and NAMESPACE valuememberHoai_Nguyen28 Aug '11 - 3:26 
Hi,
 
Could you please explain to me how you take the values for two parameters KSOAP_ACTION and NAMESPACE, based on the WSDL file? I don't understand how you came up with these values in the tutorial. Frown | :(
 
Besides, I need to connect to this WSDL site, to test the login function. But I can't define the parameters for ksoap package (i.e. KSOAP_ACTION, NAMESPACE, ... )
 
I know the METHOD and URL values, but don't know the others. So, can anyone help to explain to me what the other values are? Many thanks.
AnswerRe: KSOAP_ACTION and NAMESPACE valuememberHoai_Nguyen28 Aug '11 - 3:34 
Sorry, I missed the WSDL page. Here it is: http://220.245.81.216:8090/AutoBookEJB/UserService/UserBean?wsdl[^]
Questionjar file locationmemberanjalikulkarni24 Aug '11 - 2:44 
i have downloaded the jar from the location that you have given.
but not able to put on appropriate path
Generalsend image captured from cameramembersharan kumar14 Jun '11 - 0:18 
Hi,
I want to upload a image to web service (.net)
Please help in sending the data.
GeneralRe: send image captured from cameramemberozharugold4 Sep '11 - 16:19 
you have to encode the image to base64 string on the mobile device and decoded on the web service
http://www.dailycoding.com/Posts/convert_image_to_base64_string_and_base64_string_to_image.aspx
GeneralWSTL locationmemberMember 78875395 May '11 - 1:27 
Hi friend you didn't mention where to place the WSTL file...... please help meConfused | :confused:
GeneralRe: WSTL locationmemberluiz.srodrigues27 Jul '11 - 0:05 
Where I put place the WSTL file in my project? How I do?
GeneralConnect to SQL SERVER DBmemberAdawi5 Apr '11 - 1:55 
I have search overall the internet to find a way to connect my android application to SQL server database that hosted on external server, but I am not found any answer.
 
all talking about web services,
 
do you have any Idea ??
 

thanks
 
Adawi
GeneralRe: Connect to SQL SERVER DBmemberMihira Prasanna28 Apr '11 - 22:57 
Hi Adawi,
 
I have no good idea about your problem.
But you can just try like a web application accessing external sql server without a web service.
You have to open the port for access data to the mobile app (open port for access data)
 
Thanks,
Mihira
GeneralRe: Connect to SQL SERVER DBmemberMihira Prasanna28 Apr '11 - 23:26 

See this article



http://downloadandroid.info/2010/05/how-to-connect-to-mysql-database/[^]
GeneralRe: Connect to SQL SERVER DBmemberMihira Prasanna27 Jul '11 - 0:41 
Hi Adawi,
 
JSON is the best and simple way to connect your android application to database.
Just create a API module service to return json objects to read from android.
Cheers....
 
Mihira
Questionthx a lot man, you were the only one who helped me with this. However PLZ i need your help in serialization of complex type for ksoap2memberchadic16 Mar '11 - 8:25 
First of all thx a lot, if it wasn't for you i wouldn't have know how to call the web service using ksoap2! however i am having a problem in sending complex type parameters...
i have a wsdl which has a method "invokeservice" :
 
<message name="invokeService">
<part name="serviceName" type="xsd:string"/>
<part name="documents" type="tns:uriList"/>
<part name="literalDocs" type="ns1:stringArray"/>
<part name="connID" type="xsd:long"/>
<part name="gateParams" type="tns:gateRuntimeParameterArray"/>
<part name="userCtx" type="tns:userContext"/>
</message>
 

for the property "gateParams" which is of type "gateRuntimeParameterArray" , you have :
 
<xs:complexType name="gateRuntimeParameterArray" final="#all">
<xs:sequence>
<xs:element name="item" type="tns:gateRuntimeParameter" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
</xs:sequence>
</xs:complexType>
 

this "item" of type "gateRuntimeParameter" has :
 
<xs:complexType name="gateRuntimeParameter">
<xs:sequence>
<xs:element name="booleanValue" type="xs:boolean" minOccurs="0"/>
<xs:element name="corpusValue" type="xs:anyType" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="defaultValueString" type="xs:string" minOccurs="0"/>
<xs:element name="doubleValue" type="xs:double" minOccurs="0"/>
<xs:element name="intValue" type="xs:int" minOccurs="0"/>
<xs:element name="label" type="xs:string" minOccurs="0"/>
<xs:element name="optional" type="xs:boolean"/>
<xs:element name="PRName" type="xs:string" minOccurs="0"/>
<xs:element name="paramName" type="xs:string" minOccurs="0"/>
<xs:element name="pipelineName" type="xs:string" minOccurs="0"/>
<xs:element name="stringValue" type="xs:string" minOccurs="0"/>
<xs:element name="type" type="xs:string" minOccurs="0"/>
<xs:element name="urlValue" type="xs:anyURI" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
 

i created classes gateRuntimeParameter.java and "gateRuntimeParameterArray.java" which implement kvmserializable.
public class gateRuntimeParameterArray implements KvmSerializable{
 
public gateRuntimeParameter[] item ;//= new gateRuntimeParameter[1];
//public List<gateRuntimeParameter> item = new ArrayList<gateRuntimeParameter>();
public void setItemArray(int index,gateRuntimeParameter value)
{
System.out.println("Filling array of gate params at "+index+" with value: "+value.prName);
item[index] = value;
//item.add(value);
System.out.println("Filling is done ! "+item[index].defaultValueString);
}
@Override
public Object getProperty(int arg0) {
switch (arg0){
case 0:
return item;
default:
return null;
 
}
}
 
@Override
public int getPropertyCount() {

return 1;
}
 
@Override
public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo arg2) {
switch(arg0)
{
case 0:
arg2.type = gateRuntimeParameter.class;
//arg2.type = uriList.getClass();
arg2.name = "item";
break;

default:break;
}

}
 
@Override
public void setProperty(int arg0, Object arg1) {
switch(arg0)
{
case 0:

item = (gateRuntimeParameter[])arg1;
//item = (List<GateRuntimeParameterArray>)arg1;

break;

default:
break;
}

}
 
}
...
AND
...
public class gateRuntimeParameter implements KvmSerializable {
 
//"prName", "paramName", "pipelineName", "stringValue", "type", "urlValue"})
public String defaultValueString;//defaultValueString=10; for example
public String label;//label=Number of search results; for example
public Boolean optional;//optional=true;
public String prName;//PRName=Yahoo PR;
public String paramName;//paramName=limit;
public String pipelineName;//pipelineName=Yahoo Search;
public String type;//type=int;


public Integer intValue;// how many results we want for yahoo PR for example

public Boolean booleanValue ;
public List<Object> corpusValue; //public Corpus corpusValue;
public Double doubleValue;
public String stringValue;
public String urlValue;
 

@Override
public Object getProperty(int arg0) {
switch (arg0){
case 0:
return booleanValue;
case 1:
return corpusValue;
case 2:
return defaultValueString;
case 3:
return doubleValue;
case 4:
return intValue;
case 5:
return label;
case 6:
return optional;
case 7:
return prName;//maybe prName
case 8:
return paramName;
case 9:
return pipelineName;
case 10:
return stringValue;
case 11:
return type;
case 12:
return urlValue;
default:
return null;

}
}
 
@Override
public int getPropertyCount() {
// TODO Auto-generated method stub
return 13;
}
 
@Override
public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo arg2) {
switch(arg0)
{
case 0:
arg2.type = PropertyInfo.BOOLEAN_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "booleanValue";
break;
case 1:
//arg2.type = List.class;//maybe here is the error
arg2.type = PropertyInfo.OBJECT_CLASS;//maybe here is the error

arg2.name = "corpusValue";
break;
case 2:
arg2.type = PropertyInfo.STRING_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "defaultValueString";
break;
case 3:
arg2.type = Double.class;
//arg2.type = uriList.getClass();
arg2.name = "doubleValue";
break;
case 4:
arg2.type = PropertyInfo.INTEGER_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "intValue";
break;
case 5:
arg2.type = PropertyInfo.STRING_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "label";
break;
case 6:
arg2.type = PropertyInfo.BOOLEAN_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "optional";
break;
case 7:
arg2.type = PropertyInfo.STRING_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "PRName";
break;
case 8:
arg2.type = PropertyInfo.STRING_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "paramName";
break;
case 9:
arg2.type = PropertyInfo.STRING_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "pipelineName";
break;
case 10:
arg2.type = PropertyInfo.STRING_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "stringValue";
break;
case 11:
arg2.type = PropertyInfo.STRING_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "type";
break;
case 12:
arg2.type = PropertyInfo.STRING_CLASS;
//arg2.type = uriList.getClass();
arg2.name = "urlValue";
break;


default:break;
}


}
 
@Override
public void setProperty(int arg0, Object arg1) {
switch(arg0)
{
case 0:

booleanValue = (Boolean)arg1;
//Integer.parseInt(arg1.toString());
break;
case 1:
corpusValue = (List<Object>)arg1;

break;
case 2:
defaultValueString = (String)arg1;

break;
case 3:
doubleValue = (Double)arg1;

break;
case 4:
intValue = (Integer)arg1;

break;
case 5:
label = (String)arg1;

break;
case 6:
optional = (Boolean)arg1;

break;
case 7:
prName = (String)arg1;

break;
case 8:
paramName = (String)arg1;

break;
case 9:
pipelineName = (String)arg1;

break;
case 10:
stringValue = (String)arg1;

break;
case 11:
type = (String)arg1;

break;
case 12:
urlValue = (String)arg1;

break;
default:
break;
}


}
 
}
 

and i am doing:
gateRuntimeParameterArray gtParamArr = new gateRuntimeParameterArray();


gateRuntimeParameter gtRTparam = new gateRuntimeParameter();
 
then i fill the gtRTparam ...
 
Then i do:
pi = new PropertyInfo();
pi.setName("gateParams");

pi.setValue(gtParamArr.item);


pi.setType(gateRuntimeParameterArray.class);



sobj.addProperty(pi);
 
and then i add mapping plus marshalling:
soapEnvelope.addMapping(namespace, gateRuntimeParameter.class.getSimpleName(), gateRuntimeParameter.class);
soapEnvelope.addMapping(namespace, gateRuntimeParameterArray.class.getSimpleName(), gateRuntimeParameterArray.class);

Marshal floatMarshal = new MarshalFloat();
floatMarshal.register(soapEnvelope);
 

however I keep getting : Exception : Cannot serialize: [Lcom.example.NLPAndroid.gateRuntimeParamer;@44f05d38
 
i have been trying since 3 days, but can't understand what am i doing wrong ?
i know i wrote a lot but PLZZ i need your help, i have a demo in a week and if this doesnt work i wont be able to show anything Frown | :(
 
thanks a lot
Generalnice article for those who already familiar with the SOAP, please expand with more details of how to test it on localhostmemberdragondad10 Mar '11 - 4:58 
This is a great article for those guys who already familiar with SOAP, but lack the basic knowledge of Android development.
For me, I already knew all the details of the Android development, but not sure how to work it out with SOAP, it will be great if you can spend a little bit more time to expand with more details, and talk about how to test it on localhost, so both the beginner of Android development and SOAP can benefit from the same article.
I should give it a four stars, but for obvious reason, I rank it three stars at this moment, thanks.
GeneralMy vote of 3member_learner9 Mar '11 - 19:43 
nothing aboue how to use ksoap2
QuestionYou need write more about how to use ksoap2-android in the android project ?memberltn61420 Feb '11 - 3:53 
I suggest attach the ksoap2-android package in this article and make a demostration how it would work
QuestionHow to use org.ksoap2 ???memberwinzone20 Dec '10 - 22:38 
Hi,
 
As i used your sample explanation, everything is fine.
But i cannot used org.ksoap2. Eclipse show error.
How to install or put it ???
 
Thank you
winzone

AnswerRe: How to use org.ksoap2 ???memberMihira Prasanna21 Dec '10 - 4:39 
Use this
 
http://code.google.com/p/ksoap2-android/downloads/detail?name=ksoap2-android-assembly-2.4-jar-with-dependencies.jar&can=2&q=[^]
GeneralRe: How to use org.ksoap2 ??? [modified]memberwinzone21 Dec '10 - 14:43 
Thank you...
I found problem of :
Conversion to Dalvik format failed with error 1
tno
modified on Tuesday, December 21, 2010 9:17 PM

GeneralGreat article!memberJose Matos16 Nov '10 - 20:15 
Can you please send me or post here the full source code ?
 
Best regards
 
José Matos
QuestionKnown issues with 3.6?memberJoeSox24 Sep '10 - 3:46 
What are the known issues with ADT plugin for Eclipse 3.6? (I am running fine on Windows 7 x64)

AnswerRe: Known issues with 3.6?memberakbarjinna24 Sep '10 - 12:19 
can u pl send me the full coding of this project sir,,
GeneralRe: Known issues with 3.6?memberJoeSox24 Sep '10 - 17:55 
akbarjinna wrote:
can u pl send me the full coding of this project sir,,

 
Here is a screenshot that 3.6 works.
http://www.codeproject.com/KB/android/cpforandroid/Eclipse3_6-Android.jpg[^]
 
In my article, I describe a work around that I found to get everything installed in 3.6.
http://www.codeproject.com/KB/android/cpforandroid.aspx#Android[^] (#2)

Generalneeds some formatmemberEmilio Garavaglia23 Sep '10 - 22:47 
Your text mixed-up different styles (may be it was previously formatted by a text editor, and some of those formatting is still there).
Remove the ones that don't conform to the site guidelines.
 
Also, the last code block changes the line spacing half a way with no apparent reason.

2 bugs found.
> recompile ...
65534 bugs found.
D'Oh! | :doh:


GeneralRe: needs some formatmemberakbarjinna24 Sep '10 - 12:18 
can u pl send me the full of this project and also send me way of running this project sir....

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 24 Sep 2010
Article Copyright 2010 by Mihira Prasanna
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid