Hi All,

Creating Web Service based MBO

This blog explains how we can create a simple SUP based hybrid application which is connected to web service (backend).

Tools used in developing this application are:

SUP version : 2.2 SP04

Android Emulator: 2.2 version

Note: A similar document is already available in SCN but that app was built on SUP old version 2.0 and as we all know that there have been few changes in SUP 2.2 SP04 as compared to SUP 2.0. So here i have pointed all the new changes with the same app.

Steps:

1. Establish a backend connection to web service in mobile sdk workspace.

  • Right click web service under Enterprise Explorer
  • Give some name i.e. currConv, click on “Next
  • Select From URL option in web service Connection details screen and provide this URL

http://www.currencyserver.de/webservice/currencyserverwebservice.asmx?WSDL

 

1.PNG

2. Right click on currConv and select Connect

2.PNG

3. Create a new project. File>New>Mobile Application Project. Give some name i.e. CurrencyProject.

4. Its time to create Mobile Business object (MBO). Drag and drop Mobile Business Object to the Mobile Application diagram screen under palette.

  • Give some name i.e. CurrMBO
  • Select desired connection profile (currConv)
  • For this current sample application, we are using “GetCurrencyValue” method which has source currency, target currency and a provider agency as import parameters and the exchange rate as export parameter.
  • In next step, provide some test data e.g.
    • Provider : AVERAGE
    • Source Currency : USD
    • Target Currency: INR
  • Finish it

3.PNG

  • You can right click to the MBO and preview what value you will be getting in the output result

          4.PNG

5. Since we are developing this application as type online so we have to set cache policy as “Online

    • Right click Default Cache group in CurrencyProject>Properties>Policies>select Online
    • Select CurrMBO in Confirm changes window


6. As soon as step 5 is completed, we can see one error under problems tab says


     Mobile Business Objects ‘CurrMBO’ with online cache policy must have at least one load argument with ‘Propagate To’ attribute set.


  • To overcome this issue, we have to create attributes in the mbo and have to do ‘Propagate To‘ mapping
  • Right click MBO>Attributes>Attributes Mapping
  • Add 3 new attributes


     5.PNG


  • New Attributes:
    • srcCurrency (stirng(5), Not Nuallable, Primary key)
    • TrgtCurrency (stirng(5), Not Nuallable, Primary key)
    • Prvdr (stirng(10), Not Nuallable, Primary key)

    

     6.PNG


  • Open Load Arguments tab,
    • Map corresponding “Propagate To” value against each argument respectively
    • As you map it, an online object query will be regenerated

     76.PNG

7. Deploy MBO to SUP server

  • Make sure to create a new connection under server Connection mapping window.  

8.PNG

A Simple SUP Hybrid App to access Web Service: Part II

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply