Skip to content

ODataOnlineCore Getting Started guide

Library for consuming OData version 4.0 services.

Step 1: Create a new Android project in Android Studio

Step 2: Setup project dependencies

I.) The required dependencies * SupportabilityFacade.aar * ClientLog.aar * HttpConversation.aar * HttpConvAuthFlows.aar * ODataOnlineCore.aar

II.) Copy required dependencies Copy the required dependencies from SMP SDK installer to the libs folder(Application/app/libs).

III.) Add dependencies to the internal build.gradle (app/build.gradle) The dependencies have to be added to the project in the build.gradle file. The new installer contains Android Archive Libraries (aar files), you have to add these libraries to the dependencies section: compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar')

IV.) Add flatDir to repositories The flatDir have to be added to repositories without this the application will not find the required dependencies. You have to add the repositories to the internal build.gradle(app/build.gradle):

repositories {
   flatDir {
        dirs 'libs'

Step 3: Create proxy classes for your OData service

  • Have Java JDK or JRE installed on your machine and global variable JAVA_HOME set
  • Choose an OData service you want to use and download the metadata, giving it a name that can identify this service, but try to make it short. Recommended directory: ODataOnlineCore proxy generator location/bin/.
  • For proxy class generation you need two scripts to run. xs-proxy.bat metadata.xml proxy_output_file.xs -package package_name -service YourService xsc proxy_output_file.xs -java -smp3 -android The first parameter of xs-proxy script is your newly downloaded metadata

Step 4: Assemble your project

Open your Android Studio project what you have created and add the generated sources(by your script) to the project. Navigate to the location where your ODataOnlineCore proxy generator is located/genfiles/android and copy the sources to the Android Project/app/src/main/java Add the genrated source files to src/main/java. Now your project should compile.

Step 5: Write some code

//add android context for ODataOnlineCore sdkLogger

// Create HttpConversationManager and configure it according no authentication method.
HttpConversationManager conversationManager =new HttpConversationManager( getContext( ) );
//Create online provider
OnlineODataProvider provider = new OnlineODataProvider(SERVICE_NAME, SERVICE_URL);
SDKHttpHandler sdkHttpHandler = new SDKHttpHandler(getContext(), conversationManager);
// Create service
//YourService is the same service that you used during the proxy generation
YourService yourService = new YourService(provider);

//After this point your service can be used
//Proxy generation generate these classes for each collection in metadata
YourCollection collection = yourService.getYourCollection();

You can also find examples within the ODataOnlineCore proxy class generator bundle under the examples directory.