最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501
当前位置: 首页 - 科技 - 知识百科 - 正文

AccessWebservicefromAndroid

来源:懂视网 责编:小采 时间:2020-11-09 15:30:55
文档

AccessWebservicefromAndroid

AccessWebservicefromAndroid: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)
推荐度:
导读AccessWebservicefromAndroid: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)

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)

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 fromhttp://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 arein 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, clickAdd....
    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. ClickNext to read and accept the license agreement and install any dependencies, then clickFinish.
    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, clickBrowse... 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:
    4. Enter 'AndroidWSAccess'. This will be the name of the folder where your project is created.
    5. Under Contents, select Create new project in workspace. Select your project workspace location.
    6. 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, selectProperties, select Android and then check the desired Project Target.

    7. Under Properties, fill in all necessary fields.
    8. Enter an Application name as 'AndroidWSAccess'. This is the human-readable title for your application — the name that will appear on the Android device.
    9. 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.
    10. Select Create Activity (optional, of course, but common) and enter a name (give 'FirstAppUI') for your mainActivity class.
    11. 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 theminSdkVersion attribute in the 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.
    12. Click Finish.

    Tip: You can also start the New Project Wizard from theNew 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./ (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 yourR.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.xmlThe Android Manifest for your project.default.propertiesThis 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. ClickNew 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 clickingStart.

    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 arrAdapter = new ArrayAdapter
    	(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:
     
     
    
     
    
     
    Insert Internet access permission to your mobile application inAndroidManifest.xml file as:
    
    
     
     
     
     
     
     
     
     
     
     
    
     
    ServiceImpl.wsdl:
    
    
    
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    This is from : http://www.codeproject.com/Articles/112381/Step-by-Step-Method-to-Access-Webservice-from-Andr

    推荐:http://www.c-sharpcorner.com/UploadFile/88b6e5/how-to-call-web-service-in-android-using-soap/


    声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文档

    AccessWebservicefromAndroid

    AccessWebservicefromAndroid: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)
    推荐度:
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top