Skip to content

evgenynacu/nano

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##DISCLAIMER

This library is still under construction. Beta testers are more than welcome.

Nano

A light Web Service client framework targeting Android platform

##Feature Highlight

  1. Support WSDL driven development, code generator tool is provided to auto-genearte strongly typed proxy from WSDL.
  2. Support SOAP 1.1/1.2 and XML based web service.
  3. Support automatic SOAP/XML to Java object binding, performance is comparable to Android native XML parser.
  4. Built on popular and mature loopj async http client library for Android.
  5. Has been verified with industrial grade Web Service like Amazon ECommerce Web Serivce and eBay Finding/Shopping/Trading Web Service.
  6. Support asynchronous service invocation, flexible HTTP/SOAP header setting, timeout setting, encoding setting, logging, etc.
  7. Light-weight, the library jar is less than 150K, no external dependencies on Android platform.
  8. Besides Web Service, can also be used as a standalone XML and JSON binding framework.

The Big Picture

The Big Picture

##How to Use You have a few options:

  1. Direct jar reference
    Download latest 0.7.0 release

  2. Include the whole source of Nano into your project

  3. Maven reference

	<dependency>
	  <groupId>com.leansoft</groupId>
	  <artifactId>nano</artifactId>
	  <version>0.7.0</version>
	</dependency>
	
	<repository>
	  <id>github.release.repo</id>
	  <url>https://raw.github.com/bulldog2011/bulldog-repo/master/repo/releases/</url>
	</repository>

After including Nano into your project, please make sure to add following user permissions in the AndroidManifest.xml file for network access:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

##WSDL Driven Development Flow

  1. Generate Java proxy from WSDL
  2. Create new Android project, add Nano runtime and generated proxy into your project
  3. Implement appliction logic and UI, call proxy to invoke web service as needed.

##Example Usage After the service proxy is generated from wsdl, service invocation through Nano runtime is extremely simple:

	// Get shared client
	NumberConversionSoapType_SOAPClient client = NumberConversionServiceClient.getSharedClient();
	client.setDebug(true); // enable soap message logging
	
	// build request
	NumberToWords request = new NumberToWords();
	try {
		String number = ((EditText)findViewById(R.id.numerInputText)).getText().toString();
		request.ubiNum = new BigInteger(number);
	} catch (NumberFormatException ex) {
		Toast.makeText(MainActivity.this, "Invalid integer number", Toast.LENGTH_LONG).show();
		return;
	}
	
	client.numberToWords(request, new SOAPServiceCallback<NumberToWordsResponse>() {

		@Override
		public void onSuccess(NumberToWordsResponse responseObject) { // success
			Toast.makeText(MainActivity.this, responseObject.numberToWordsResult, Toast.LENGTH_LONG).show();
		}

		@Override
		public void onFailure(Throwable error, String errorMessage) { // http or parsing error
			Toast.makeText(MainActivity.this, errorMessage, Toast.LENGTH_LONG).show();
		}

		@Override
		public void onSOAPFault(Object soapFault) { // soap fault
			Fault fault = (Fault)soapFault;
			Toast.makeText(MainActivity.this, fault.faultstring, Toast.LENGTH_LONG).show();
		}
		
	});

Web Service Sample List

All samples are in the sample folder, following samples are included:

##Docs for Web Service

  1. WSDL Driven Development on Android - the Big Picture
  2. Nano Tutorial 1 - a Number Conversion Sample
  3. Nano Tutorial 2 - a BarCode Generator Sample
  4. Nano Tutorial 3 - Hello eBay Finding Service
  5. Nano Tutorial 4 - Hello eBay Shopping Service
  6. Nano Tutorial 5 - Hello Amazon Product Advertising API

##Docs for Binding

  1. Nano Hello World
  2. Nano List Handling
  3. Nano Compare to JAXB
  4. Scheam driven data binding with Nano and mxjc
  5. Xml Parser and Nano Benchmark on Android
  6. Nano on Android Tutorial 1
  7. A full movie search Android application using Nano binding
  8. Schema Driven Web Serivce Client Development on Android, Part 1 : Hello eBay Finding
  9. Schema Driven Web Serivce Client Development on Android, Part 2 : eBay Search App

##Mapping between XML Schema Types and Java Types

XML Schema Data TypesObjective-C Data Types
xsd:base64Binary byte[]
xsd:boolean boolean
xsd:byte byte
xsd:date java.util.Date
xsd:dateTime java.util.Date
xsd:decimal java.math.BigDecimal
xsd:double double
xsd:duration com.leansoft.nano.custom.types.Duration
xsd:float float
xsd:g java.util.Date
xsd:hexBinary byte[]
xsd:int int
xsd:integer java.lang.BigInteger
xsd:long long
xsd:NOTATION javax.xml.namespace.QName
xsd:Qname javax.xml.namespace.QName
xsd:short short
xsd:string java.lang.String
xsd:time java.util.Date
xsd:unsignedByte short
xsd:unsignedInt long
xsd:unsignedShort int

Version History

0.7.0 - April 14, 2013 repository

  • Initial release supporting SOAP/XML Web Service.

##Compatibility Nano has been verified with Android 2.2(API 8) and 2.3.6(API 10), Nano should work without problem on Android 2.2 and above although this hasn't been verified formally.

##Current Limitation

  1. Only Document/Literal style Web Service is support, RPC style Web Serivice is not supported.
  2. SOAP attachment is not supported

###Copyright and License Copyright 2012 LeanSoft, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

A light Android web serivce client framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published