목차
Supported Operating Systems
Supported Development Environments
Eclipse IDE
Hardware Requirements
Installing the ADT Plugin for Eclipse
Configuring the ADT Plugin
Creating an Android Project
Creating an AVD
데이터 베이스 MySQL 튜토리얼 Access Webservice from Android

Access Webservice from Android

Jun 07, 2016 pm 03:42 PM
access android from webservice

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:
    • 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, selectProperties, 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 mainActivity 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 theminSdkVersion attribute in the <uses-sdk></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 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.
<em><android version></android></em>/ (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.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. 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<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();
		}
	}
}

</string></string>
로그인 후 복사
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"></autocompletetextview>  

 </linearlayout>
로그인 후 복사
Insert Internet access permission to your mobile application inAndroidManifest.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"></action>
                <category android:name="android.intent.category.LAUNCHER"></category>
            </intent-filter>
        </activity>
    </application>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-sdk android:minsdkversion="8"></uses-sdk>

</manifest> 
로그인 후 복사
ServiceImpl.wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<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)-->
 <types>
  <schema elementformdefault="qualified" targetnamespace="http://service.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="message">
    <complextype></complextype>
   </element>
   <element name="messageResponse">
    <complextype>
     <sequence>
      <element name="messageReturn" type="xsd:string"></element>
     </sequence>
    </complextype>
   </element>
  </schema>
 </types>

   <message name="messageResponse">
      <part element="impl:messageResponse" name="parameters">
      </part>
   </message>
   <message name="messageRequest">
      <part element="impl:message" name="parameters">
      </part>
   </message>
   <porttype name="ServiceImpl">
      <operation name="message">
         <input message="impl:messageRequest" name="messageRequest">
         <output message="impl:messageResponse" name="messageResponse">
       </output>
      </operation>
   </porttype>
   <binding name="ServiceImplSoapBinding" type="impl:ServiceImpl">
      <binding><br>
<p>This is from : http://www.codeproject.com/Articles/112381/Step-by-Step-Method-to-Access-Webservice-from-Andr</p>
<p>推荐:http://www.c-sharpcorner.com/UploadFile/88b6e5/how-to-call-web-service-in-android-using-soap/<br>
</p>

<p><span><br>
</span></p>


</binding></binding></definitions>
로그인 후 복사
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

C#에서 멀티 스레딩의 이점은 무엇입니까? C#에서 멀티 스레딩의 이점은 무엇입니까? Apr 03, 2025 pm 02:51 PM

멀티 스레딩의 장점은 특히 많은 양의 데이터를 처리하거나 시간이 많이 걸리는 작업을 수행하기 위해 성능 및 리소스 활용도를 향상시킬 수 있다는 것입니다. 이를 통해 여러 작업을 동시에 수행하여 효율성을 향상시킬 수 있습니다. 그러나 너무 많은 스레드가 성능 저하로 이어질 수 있으므로 CPU 코어 수와 작업 특성에 따라 스레드 수를 신중하게 선택해야합니다. 또한 다중 스레드 프로그래밍에는 교착 상태 및 레이스 조건과 같은 과제가 포함되며 동기화 메커니즘을 사용하여 해결해야하며 동시 프로그래밍에 대한 확실한 지식, 장단점을 측정하고주의해서 사용해야합니다.

SQL IF 문을 사용하는 방법 SQL IF 문을 사용하는 방법 Apr 09, 2025 pm 06:12 PM

SQL IF 명령문은 구문을 다음과 같이 조건부로 실행하는 데 사용됩니다. if (조건) 그런 다음 {state} else {state} end if;. 조건은 유효한 SQL 표현식 일 수 있으며 조건이 참이면 당시 조항을 실행하십시오. 조건이 false 인 경우 else 절을 ​​실행하십시오. 명세서를 중첩 할 수있는 경우 더 복잡한 조건부 점검이 가능합니다.

MySQL에 루트로 로그인 할 수 없습니다 MySQL에 루트로 로그인 할 수 없습니다 Apr 08, 2025 pm 04:54 PM

Root로 MySQL에 로그인 할 수없는 주된 이유는 권한 문제, 구성 파일 오류, 암호 일관성이 없음, 소켓 파일 문제 또는 방화벽 차단입니다. 솔루션에는 다음이 포함됩니다. 구성 파일의 BAND-ADDRESS 매개 변수가 올바르게 구성되어 있는지 확인하십시오. 루트 사용자 권한이 수정 또는 삭제되어 재설정되었는지 확인하십시오. 케이스 및 특수 문자를 포함하여 비밀번호가 정확한지 확인하십시오. 소켓 파일 권한 설정 및 경로를 확인하십시오. 방화벽이 MySQL 서버에 연결되는지 확인하십시오.

노드 환경에서 403 오류를 반환하는 타사 인터페이스를 피하는 방법은 무엇입니까? 노드 환경에서 403 오류를 반환하는 타사 인터페이스를 피하는 방법은 무엇입니까? Apr 01, 2025 pm 02:03 PM

노드 환경에서 403 오류를 반환하는 타사 인터페이스를 피하는 방법. node.js를 사용하여 타사 웹 사이트 인터페이스를 호출 할 때 때때로 403 오류를 반환하는 문제가 발생합니다. � ...

도메인의 Vue Axios로 인한 '네트워크 오류'를 해결하는 방법 도메인의 Vue Axios로 인한 '네트워크 오류'를 해결하는 방법 Apr 07, 2025 pm 10:27 PM

Vue Axios의 크로스 도메인 문제를 해결하는 방법 : Cors 플러그인을 사용하여 Websocket을 사용하여 JSONP를 사용하여 Axios 프록시를 사용하여 서버 측의 CORS 헤더 구성

Apache의 Zend를 구성하는 방법 Apache의 Zend를 구성하는 방법 Apr 13, 2025 pm 12:57 PM

Apache에서 Zend를 구성하는 방법은 무엇입니까? Apache 웹 서버에서 Zend 프레임 워크를 구성하는 단계는 다음과 같습니다. Zend 프레임 워크를 설치하고 웹 서버 디렉토리로 추출하십시오. .htaccess 파일을 만듭니다. Zend 응용 프로그램 디렉토리를 작성하고 Index.php 파일을 추가하십시오. Zend 응용 프로그램 (application.ini)을 구성하십시오. Apache 웹 서버를 다시 시작하십시오.

웹 사이트 성과를 향상시키기 위해 Debian Apache Logs를 사용하는 방법 웹 사이트 성과를 향상시키기 위해 Debian Apache Logs를 사용하는 방법 Apr 12, 2025 pm 11:36 PM

이 기사는 데비안 시스템에서 Apache Logs를 분석하여 웹 사이트 성능을 향상시키는 방법을 설명합니다. 1. 로그 분석 기본 사항 Apache Log는 IP 주소, 타임 스탬프, 요청 URL, HTTP 메소드 및 응답 코드를 포함한 모든 HTTP 요청의 자세한 정보를 기록합니다. 데비안 시스템 에서이 로그는 일반적으로 /var/log/apache2/access.log 및 /var/log/apache2/error.log 디렉토리에 있습니다. 로그 구조를 이해하는 것은 효과적인 분석의 첫 번째 단계입니다. 2. 로그 분석 도구 다양한 도구를 사용하여 Apache 로그를 분석 할 수 있습니다.

Apache Server 란 무엇입니까? Apache 서버는 무엇입니까? Apache Server 란 무엇입니까? Apache 서버는 무엇입니까? Apr 13, 2025 am 11:57 AM

Apache Server는 브라우저와 웹 사이트 서버 간의 브리지 역할을하는 강력한 웹 서버 소프트웨어입니다. 1. HTTP 요청을 처리하고 요청에 따라 웹 페이지 컨텐츠를 반환합니다. 2. 모듈 식 디자인은 SSL 암호화 지원 및 동적 웹 페이지와 같은 확장 된 기능을 허용합니다. 3. 보안 취약점을 피하고 고성능 웹 애플리케이션을 구축하기 위해 보안 취약점을 피하고 스레드 카운트 및 타임 아웃 시간과 같은 성능 매개 변수를 최적화하기 위해 구성 파일 (예 : 가상 호스트 구성)을 신중하게 설정해야합니다.

See all articles