Skip to content

maxep/NanoKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NanoKit

CI Status l Release Issues

A light Web Service client framework targeting Android platform.

##Note NanoKit is initially a fork of nano.

Nano (and related projects: mxjc, mwsc & pico) has been developed by bulldog2011 but stayed as is from 2013. As it is very well designed and implemented, I decided to fork it and upgrade it.

##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.1 release.

  2. Include the whole source of Nano into your project.

  3. Maven reference:

    	<dependency>
    	  <groupId>com.leansoft</groupId>
    	  <artifactId>nano-kit</artifactId>
    	  <version>0.7.1</version>
    	</dependency>
    	
    	<repository>
    	  <id>maxep-releases</id>
    	  <url>https://raw.github.com/maxep/mvn-repo/releases</url>
    	</repository>
  4. Gradle reference:

    	dependencies {
    		compile 'com.leansoft:nano-kit:0.7.1'
    	}
    
    	repositories {
    		maven {
    			url "https://raw.github.com/maxep/mvn-repo/releases"
    		}
    	}

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 Types Objective-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

Version Date Description
0.7.0 April 14, 2013 Initial release supporting SOAP/XML Web Service.
0.7.1 April 16, 2015 Upgrade to Android-15

##Compatibility NanoKit has been verified with Android 4.0.3(API 15).

##Current Limitation

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

License

NanoKit is available under the Apache v2.0 license. See the LICENSE file for more info.

About

A light Android web serivce client framework.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages