MBOFacade Offline ODATA service for SMP 3.0 SP11 MBO server
Purpose
SAP SMP 3.0 MBO server did not have the capability to offer ODATA services until now, starting with SMP 3.0 SP11 the SMP server now has a web service called MBOFacade. We will look in to the configuration and setup and then consume MBO data directly from the Cache database.
Required Software
- SMP 3.0 sp11or higher
- Admin permissions
- Deployed an MBO object to the Cache database.
Assumption
- Operating System Admin permissions
- Deployed MBO object to the Cache database.
- SMP 3.0 SDK for creating MBO modles.
Issue
Development needs to consume off line ODATA from the MBO cache database for their end users.
Solution
Staring with SMP 3.0 SP11 development has added a new feature call MBOFacade Web Services. This will allow an off line ODATA call using a rest client with the proper URL and prefix. On line ODATA calls are not supported only off line.
Table of content
Section one We will walk you thru creating the SMP101 MBO and the steps to deploy.
Section two We will create the URL and connect to the MBOFacade web services on the MBO server.
Section three We will look at the additional features and restriction of MBOFacade Web Server.
Section one Create SMP101 MBO and deploying. You have the option to consume the current MBO models that are already in the database or you can create new ones.
Demo:
Open the SMP workspace
- File new mobile Application Project
- Call the project smp101
- Open a connection to the sample database
- Open the folder Tables
- Scroll down to customer
- Drag the customers table over to the mobile application diagram window
- A pop up will appear just click ok
- Next scroll down to sales_orders and drag sales_order to the mobile application diagram window.
At this point your project should look like Figure 1.
Figure 1.
Next on the right hand side you will see mobile application diagram options.
as seen in Figure 2.
Figure 2.
Select the Relationship and drag it to the mobile application diagram window.
The dialog window will pop up select the id from customer and then select the id from sales_order to create a relationship between the two MBO’s
Figure 3 Your screen should look like this.
Click finish now you are done creating your MBO.
The next step is we now need to deploy the MBO to the SMP server.
Before deploying on the left hand side go to cache group
Open the folder and right click on the Default >Default go to properties and change to schedule and set it to 10 min
Figure 4.
Click OK
Now we are ready to deploy the MBO to the SMP server.
On your project right click and select Deploy.
Figure 5.
Click Next and the Deployment wizard will start.
Figure 6.
Make sure you have slected Update then click Next to continue.
Figure 7
Make sure all the tables are selected then click Next.
.
Figure 8. We can click Next to continue.
Figure 9.
If you are not connected to the SMP server select the connect button, if are already connect simply select the Next button to continue.
Figure 10.
The above menu is showing us what MBO that are available our SMP101 should already be listed
as our target for deployment.
Figure 11.
On this screen in Figure 11 we need to select the database connection. This is important as this is the location where the data is going to be pulled from in this test select from the pull down MySampleDatabase If the sample database is not listed select new and then MySampleDatabase connection will be in the list just select it see figure11. Then click Finish.
Figure 12.
The wizard will start the deploying process this may take a few min.
Once the deployment is finished you can see the MBO in the Control Center and it you go to the Enterprise Explorer and look at the SMP servers Domain you will see the MBO listed there as well
Figure 13.
If you recall we set the cache for the MBO to schedule and set it to 10 min. The reason why is if we go to the control center and we look and the cache for the two MBO we will see the CDB has data from the Sample database as we see in Figure 13.
We have created and deployed the MBO and we also now have data for our MBO. This will conclude the setup of the SMP server and MBO.
This concludes section one.
Section two Create the URL and connect to the MBOFacade web services on the MBO server.
The Next step is to query the SMP server with an ODATA request to retrieve data from our MBO.
We need to know the name of the MBO and MBO version and what domain the MBO is in as well as the port number for the HTTP we will also need to know what the web servers name is. The breakdown: NAME: smp101 Version: 1.0 Domain: default Address: localhost Port Number: 8000 Web Service Name: MBOFacade Colum names: Customer and Sales_order
The above information is very important because this is used to create the ODATA URL to the SMP server. The format for the URL http[s]://supserver:port/mbofacade/{domainName}/{packageName}/{packageVersion}
Putting all of our information in to a URL.
http://localhost:8000/mbofacade/default/smp101/1.0/Customer?/sales_order Copy your URL in to a chrome browser.
You will get a popup dialog box asking for user name and password
Figure 14.
User supAdmin and the Password you have for SMP admin account.
How well did we do here are we getting anu results from our query?
Figure 15
As we can see we are now pulling data from the Cache Database (CDB).
Here are some examples of some valid URL’s that could be used.
http://localhost:8000/mbofacade/default/smp101/1.0/Customer?/sales_order http://localhost:8000/mbofacade/default/smp101/1.0/Customer?
You will also note that there is no configuration steps needed on the SMP MBO server as the web server services for MBOFacade are enabled by default. This gives you the option to be able to consume your current MBO models that are already defined in the CDB database.
Section three Restrictions and further details about MBOFacade.
MBOFacade web services only supports OFF line ODATA. Mapping from MBO to OData Services
Unsupported features in MBO Facade
CUD operations with visible parameters Online Search Personalization Parameters Etag System query options: $orderby $top $skip $filter $format $select $inlinecount
Data Type mapping MBO to MBOFacade
X-MBO-FACADE header
The "X-MBO-FACADE:true" custom header must be specified in ODataOfflineStoreOptions. Without this custom header, the client requests will be identified as accessing MBOFacade OData service, and SMP server cannot pass necessary information to MBOFacade OData service for identifying client and synchronization.
Application Connection
When consuming MBOFacde ODdata service through SMP using Offline SDK, the Application Connection ID registered in SMP will be passed to MBOFacade, and will be automatically registered in SUP too. Then, customer can manage the same application connection with same ID on both SMP and SUP.
Synchronization Parameter
If a MBO entity has synchronization parameters, they will be exposed in a subscription Entity in MboFacade service. The name of subscription entity is "<MBOEntityName>Subscription", such as CustomerSubscription. Device application can operation synchronization parameters by creating /updating/deleting instances in the subscription entity.
Other Operation
Other operations defined in MBO entity are exposed as operation entities, and the name of operation entity is "<MBOEntityName><OperationName>Operation".
Device application can execute other operation by creating an instance for the operation entity, and flush to server. When creating the instance of operation entity on server side, the defined other operation in MBO entity will be executed.
NOTE: Device application has to manually delete the operation Entity's instance after the operation is executed successfully. If not manually deleting it, it will be permanently stored in local database.
Relationship
The relationship between MBO entities are simply mapped to the association between OData entities.
When operating entities in relationship, it is highly recommended to execute them using batch operation. Especially when creating instances for multiple entities in relationship, batch operation is only choice.
For example, user wants to create two SalesOrder instances, and each SalesOrder instance includes several OrderItem instances. These create operations can be submitted as one batch operation which include two change sets. Each change set includes the operations for creating one SalesOrder instance and its OrderItem instances.
MBO Package Redeployment
After a MBO package is redeployed, the SUP server must be restarted in order MBOFacade can load latest package information.
Create application
Create a new Application from Admin Cockpit. This can be done for SMP 3.0 ODATA server as well as HCPms.
Define endpoint
Set MboFacade Service root URL as endpoint address. The host name should be "localhost" in order each SMP node in cluster can connect to the MboFacade server on same node. Such as
http://localhost:8000/mbofacade/default/mobileobject/1.0 or
https://localhost:8002/mbofacade/default/mobileobject/1.0
Add Basic or X.509 (Refer to Certificate authentication) SSO mechanism.
Define Security Profile
Create new Security Profile
Add "HTTP/HTTPS Authentication" Authentication Provider with URL pointing to MboFacade Service root URL, if MBO package is not protected by client certificate authentication, SiteMinder authentication or Network Edge Authentication.
Define Offline Application Settings
If some Entities Data are shared by all end users, it is highly recommended to configure prepopulate_offline_db property to SHARED_ONLY and configure is_shared_data to true for the corresponding defining_request.
Certificate Authentication
If Mbo package is using "Certificate Authentication Provider", the "CertificateValidationLoginModule Provider" has to be added in the security configuration in order it can authenticate client certificate retrieved from Two-way HTTPS connection. In this case, the SMP3 maincar's Security Profile needs add a "x.509 User Certificate" Authentication Provider which URL points to MboFacade Service root URL, and uses "X.509" SSO mechanism in Endpoint configuration with a technical client certificate for connecting to SUP mutual SSL port. In SUP, the technical client certificate must be mapped as "SUP Impersonator" role in the package's security configuration.
SiteMinder authentication or other Network Edge authentication
If Mbo package is protected by SiteMinder authentication or other Network Edge authentication, all providers configured in the Security Configuration must be migrated into the Security Profile in SMP3 maincar, in order SMP3 maincar can correctly authenticate user credential. In this case, the SMP3 maincar's Security Profile just needs add a "HTTP/HTTPS Authentication" Authentication Provider which URL points to MboFacade Service root URL, and uses "Basic" SSO mechanism in Endpoint configuration.
Here is what it looks like this is a simple diagram showing the entry point in to the SMP 3.0 MBO server from the ODATA on Premise or HCPms Odata Server.
Figure 16.
Summary
With the introduction of the MboFacade web service embedded in to the SMP MBO server now give the developer the flexibility to perform offline ODATA call to the existing MBO models. This will make it the MBO server available in the cloud or with the SMP 3.0 ODATA on premise server for off line applications. This feature will not be back ported to previous releases and it will not be supported in SMP 2.3. Only OFFLINE ODATA is supported.