Documente Academic
Documente Profesional
Documente Cultură
Actions
SMP Developer Center
Login to follow, like, comment, share and
Tutorial: Creating an OData service based on SAP bookmark content.
Table of Contents
1 Introduction
2 What is Integration Gateway?
3 End-to-End Scenario Overview
4 Prerequisites
postpost
5 Scenario Setup
5.1 Data Sources
5.2 Preparing the Apache Derby Database
5.3 Setting up Eclipse with the SAP Mobile Platform Tools
5.4 Creating the OData Model
5.5 Assigning Data Sources to Entity Sets
5.5.1 ODC (SAP Gateway) Data Source
Filter Blog
5.5.2 JDBC Data Source
5.5.3 JPA Data Source By author:
5.5.4 SOAP Data Source ---
5.5.5 Defining the Response Mapping for the SOAP web service By date:
5.6 Generating and deploying the service on the SMP server ---
6 Setting up SAP Mobile Platform 3.0
By tag:
6.1 Security Profile
6.2 Adding the HTTPS certificate to the SMP key store
developer ios mobile mobiledevcenter mobility
native odata sap_mobile_platform sap_mobile_platform_3
6.2.1 Retrieving the certificate from the SAP Gateway Service Consumption System (ES1)
6.2.2 Adding the HTTPS certificate to the SMP key store using Portecle
sap_mobility sapmentor sup sybase
sybase_unwired_platform syclo
6.3 Destinations
6.3.1 OData Channel (ODC) Data Source
6.3.2 Java Persistency API (JPA) Data Source
Recent Posts
6.3.3 Java Data Base Connector (JDBC) Data Source
7 Configuring the Services in SMP HCPms: curl command will help you in managing
Hybrid app versions
7.1 Registering the ZGWSAMPLE_SRV service
Integration Gateway: Understanding REST data source
7.2 Assigning Destinations to Entity Sets [16]: using HashMap as response format
8 Testing the service Download and Upload application settings from Mobile
8.1 Setting up Advanced REST Client in Google Chrome Platform
8.2 Retrieving information from your service Integration Gateway: Understanding REST data source
8.3 Retrieving the CSRF-Token [15]: $orderby
8.4 Creating a Sales Order Header Integration Gateway: Understanding REST data source
[14]: $skip
9 Troubleshooting
Weak ephemeral Diffie-Hellman public key
9.1 Proxy Issues
Different rewrite modes require different service root
9.1.1 SMP system wide proxy used for the SOAP destination URLs in SMP and HCPms
9.1.2 Proxy Settings for ODC destination Media Support in Native OData SDK ( iOS)
10 Further Information Handling Partial Results with the OData SDK (Android)
Note (October 21, 2014): I updated the blog to reflect changes in the Eclipse modeling environment. You now need to Registering Kapsel/Hybrid SAPUI5 Android App &
use the SAP Mobile Platform tools instead of the Gateway Productivity Accelerator (GWPA). Consuming OData via SMP3.0 Using Cordova SQLLite
Plugin(WebSQL DB)
1 Introduction
converted by Web2PDFConvert.com
1 Introduction
On May 15th, 2014 the SAP Mobile Platform 3.0 became generally available to the public. While it contains many great Incoming Links
features, I would like to show you in this blog how it is possible to leverage the Integration Gateway component inside Integration Gateway: REST data source, overview
the Mobile Platform. of Blogs
Integration Gateway: Understanding REST data
2 What is Integration Gateway? source [13]: $top
First, I would like to point you to some resources available to explain what Integration Gateway can do: Integration Getting Started with Kapsel - Appendix J -- Hybrid
Apps in SAP Mobile Platform 2.3 vs 3.0 (SP09+)
Gateway is a technology component that provides design-time tools and the associated run-time for modeling,
composing and provisioning OData services. These can be based on one or more APIs from various SAP and non- Re: Error while calling the entity set in SMP 3.0
SP07(via IGW)
SAP data sources.
The data sources supported as of today are SOAP (Simple Object Access Protocol), JPA (Java Persistence API) and Re: Error while calling the entity set in SMP 3.0
SP07(via IGW)
JDBC (Java Database Connectivity) to access non-SAP data sources as well as OData Channel (ODC) for accessing
OData services provisioned via SAP Gateway. OData Service issue - Not returning multiple
records
For a brief overview, you might want to have a look at this Youtube video.
4 Prerequisites
For recreating this scenario you will need administrative access to an (developer) installation of SAP Mobile Platform
3.0 SP03 (In the rest of this blog I will refer to it as SMP3). If you have the authorizations, you can download the SMP3
installation files from the SAP Software Download Center.
Furthermore you need to register to access the SAP Gateway Service Consumption System.
5 Scenario Setup
5.1 Data Sources
As mentioned before, we are going to use SOAP, JPA, JDBC and ODC data sources for this tutorial. The SOAP and
ODC services will be provided by us. Your developer installation of SMP3 comes with an Apache Derby database. We
are going to create a new table in this database which will serve as our JDBC data source. Furthermore, the SMP3
comes preinstalled with a Java Persistency API version of the EPM model. The products stored in this model will
serve as our JPA data source.
5.2 Preparing the Apache Derby Database
Your SMP3 installation comes with an Apache Derby database. We now would like to create a new table called
DELIVERYTYPES in this database. You can do so by using SquirrelSQL and you can find detailed setup instractions
in this blog.
Once you are connected to the Derby database, click on the tab calles “SQL” and paste the following SQL statements
in the command line:
create table deliverytypes (deliverytype varchar (3), description varchar (50));
insert into deliverytypes values ('OVN', 'Overnight');
insert into deliverytypes values ('2ND', '2nd Business Day');
insert into deliverytypes values ('GRD', 'Ground (5-7 Business Days)');
select * from deliverytypes;
Click on the first line and then click on the “execute” (running man) button in order to create a new database table
called DELIVERYTYPES with three entries. Using the SELECT command, you can verify that the entries have been
created successfully.
converted by Web2PDFConvert.com
5.3 Setting up Eclipse with the SAP Mobile Platform Tools
For this scenario, you will need to download the SAP Mobile Platform Tools. You can find all the installation
instructions at https://tools.hana.ondemand.com/#gateway
Now you will need to set up the connection to the Integration Gateway component on the SMP. To do so, please go to:
Window > Preferences > OData Development > Integration Gateway
Click on the “Test Connection” button to verify that your connection to the SMP server is working.
5.4 Creating the OData Model
Next, you will create an empty Service Implementation Project:
File > New > Others > SAP Mobile Platform > SAP Mobile Platform OData Implementation Project:
Specify the project name "IGW_EPM_Demo" and select “Create OData file manually” and finish the wizard:
Now you will create the OData model. You can do so by right clicking on model > New > Other > OData Development
> OData Model and selecting the entry OData service Metadata File. Provide the model name ODataModel:
Attached to this document you can find the file ODataModel.xml. Save this file to your computer and select it in the
wizard as follows:
converted by Web2PDFConvert.com
Please save the resulting model and then your ODataModel should look like this:
Then you will need to select the data source for each entity set in your OData Model. So please repeat this
step for every entity set in your OData model:
converted by Web2PDFConvert.com
5.5.1 ODC (SAP Gateway) Data Source
The data for the entity sets SalesOrderCollectionand SalesOrderLineItemCollectionshould come from the NetWeaver
backend provided by us. Therefore we select the data source ODC for these:
converted by Web2PDFConvert.com
5.5.2 JDBC Data Source
The DELIVERYTYPES entity set should be served by a JDBC data source.
Finally, the entity set Stocks should be served with data from a SOAP web service:
The SOAP endpoint is provided on the ES1 development system:
Endpoint: https://sapes1.sapdevcenter.com:443/sap/bc/srt/rfc/sap/z_sepm_gws_stock_get/520/service/binding
Namespace: urn:sap-com:document:sap:soap:functions:mc-style
Operation: SepmGwsStockGet
PortType: Z_SEPM_GWS_STOCK_GET
5.5.5 Defining the Response Mapping for the SOAP web service
In this step you will need to map the result from the SOAP web service to the Stocks entity set. To do so, expand the
Stocks node and select “Define Response Mapping” from the context menu:
converted by Web2PDFConvert.com
Attached to this blog entry, you can find the file StocksES1.wsdl (Note: Please rename the file from
StocksES1.wsdl.xml to StocksES1.wsdl. It is not allowed to attach files in the WSDL format to this blog.). Save this file
to your hard drive and then select this file in the wizard:
converted by Web2PDFConvert.com
Fill out the values in the popup as follows:
You should now receive the confirmation, that the deployment has been completed for IGW_EPM_Demo.
6.2.1 Retrieving the certificate from the SAP Gateway Service Consumption System
(ES1)
Using your browser, please navigate to the following URL:
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/
You will be asked for your username and password for the SAP Gateway Service Consumption System (ES1). In
Google Chrome (in Windows) you now need to click on the green padlock icon > Connection > Certificate Information:
In the Certificate popup please select the tab “details” and click on the “copy to file” button. Follow the wizard using the
standard values and export the file with the filename SAPES1.cer.
6.2.2 Adding the HTTPS certificate to the SMP key store using Portecle
You need to have access to the directory where the SMP server is running. You then need to download the open
converted by Web2PDFConvert.com
source tool Portecle: http://sourceforge.net/projects/portecle/files/latest/download
Unzip the file you just downloaded and open a command window / terminal in the unpacked folder. (In Windows you
can do so by holding the shift key and right clicking into the folder with the portecle files.)
Run the protecle application by running the command java –jar portecle.jar. Click on File > Open Keystore File and
navigate to the configuration folder on your SMP3 server. Open the file smp_keystore.jks. In my case this is
C:\SAP\MobilePlatform3\Server\configuration\smp_keystore.jks. The default password to open the truststore file is
s3pAdmin, but can be set to a different value during the installation process.
Click on Tools > Import Trusted Certificateand select the file SAPES1.cer you saved to your hard drive in the previous
step. You will see the following warning, but this is ok:
You will now see the certificate details and will be asked if you want to trust this certificate. If you choose to accespt
this, please enter the alias name SAPES1 for the new certificate:
Now you should receive the successful confirmation message and should see that a new certificate has been added
to your SMP trust store.
The certificate for the ES1 system has been issued by “Starfield Repository”. So please go to the following site
(https://certs.starfieldtech.com/anonymous/repository.pki) and download the certificate sf-class2-root.cer. Please
follow the same steps as above to import the certificate to the SMP trust store.
To finish please click on the save button and then you can close Portecle. Please restart your server now for this
change to take effect.
6.3 Destinations
Now you need to head over to the Gateway Cockpit of your SMP server: https://localhost:8083/gateway/cockpit (Again,
you will need to exchange the <localhost> with your server URL.) Navigate to the tab called Destinations. You will now
create a destination for each backend system we want to use for our data sources.
6.3.1 OData Channel (ODC) Data Source
Click on “Create New Destination” and fill in the following data:
Destination Name: ES1
Destination Type: HTTP
Destination URL: https://sapes1.sapdevcenter.com:443/sap/iwbep?sap-client=520
Username: <your ES1 username>
Password: <your ES1 password>
TrustStore File: smp_keystore.jks
Truststore Password: <your SMP keystore password> (default s3pAdmin)
You need to provide the TrustStore file and password, because here the certificate for the ES1 server is stored to
establish a trusted connection between your SMP server and the ES1 system.
converted by Web2PDFConvert.com
6.3.2 Java Persistency API (JPA) Data Source
Click on “Create New Destination” and fill in the following data:
Destination Name: JPA
Destination Type: JPA
Persistence Unit: com.sap.espm.model
Username: gomobile
Password: secret
converted by Web2PDFConvert.com
In my case, I used the following payload data for the POST request:
01. <entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
02. <id>https://localhost:8081/gateway/odata/sap/IGW_EPM_Demo;v=1/SalesOrderCollection('0500000003')</id
03. <title type="text">SalesOrderCollection</title>
04. <updated>2014-06-06T16:41:24.454+02:00</updated>
05. <category term="ZGWSAMPLE_SRV.SalesOrder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"
06. <link href="SalesOrderCollection('0500000003')" rel="edit" title="SalesOrder" />
07. <content type="application/xml">
08. <m:properties>
09. <d:SoId>0500000003</d:SoId>
10. <d:CurrencyCode>EUR</d:CurrencyCode>
11. <d:BuyerName>Asia High tech</d:BuyerName>
12. <d:BuyerId>0100000006</d:BuyerId>
13. <d:Note>EPM DG: SO ID 0500000003 Deliver as fast as possible</d:Note>
14. <d:ChangedByBp />
15. <d:CreatedByBp />
16. <d:ChangedAt>2014-05-13T05:00:00.000</d:ChangedAt>
17. <d:ChangedBy>0000000033</d:ChangedBy>
18. <d:CreatedAt>2014-05-13T05:00:00.000</d:CreatedAt>
19. <d:CreatedBy>0000000033</d:CreatedBy>
20. <d:GrossAmount>1405.39</d:GrossAmount>
21. <d:GrossAmountExt>1405.39</d:GrossAmountExt>
22. <d:NetAmount>1181.0</d:NetAmount>
23. <d:NetAmountExt>1181.0</d:NetAmountExt>
24. <d:TaxAmount>224.39</d:TaxAmount>
25. <d:TaxAmountExt>224.39</d:TaxAmountExt>
26. <d:LifecycleStatus>N</d:LifecycleStatus>
27. <d:BillingStatus />
28. <d:DeliveryStatus />
29. </m:properties>
30. </content>
31. </entry>
Once you sent the request, the server will reply with the status code “201 Created” and you will be able to find
the data of the newly created sales order header in the response body.
9 Troubleshooting
9.1 Proxy Issues
In case you are in a corporate network, you might run into some proxy issues when SMP is trying to access the ES1
devcenter system. In this case, you have to set up a proxy server on SMP file system level:
9.1.1 SMP system wide proxy used for the SOAP destination
Go to your SMP server directory and open the file “props.ini”. In my case it is located in C:\SAP\MobilePlatform3\Server.
In the file you can find some parameters for setting your system proxy. In our scenario this proxy will be used by the
SOAP destination. Enter your proxy and port as follows:
-Dhttp.proxyHost=proxy.wdf.sap.corp
-Dhttp.proxyPort=8080
-Dhttps.proxyHost=proxy.wdf.sap.corp
-Dhttps.proxyPort=8080
After setting the system proxy, please save the props.ini file and restart your SMP server.
10 Further Information
10.1 Documentation & SAP Notes
· http://service.sap.com/sap/support/notes/1830710 - Gateway Productivity Accelerators Release Note &
Constraints
· http://service.sap.com/sap/support/notes/1931374 - Integration Gateway for SAP Mobile Platform 3.0 - Known
converted by Web2PDFConvert.com
· http://service.sap.com/sap/support/notes/1931374 - Integration Gateway for SAP Mobile Platform 3.0 - Known
Constraints
· More information on SMP 3.0, including Integration Gateway is available here: http://help.sap.com/mobile-platform/
· Specific info on SMP 3.0 SP03 is available here: http://help.sap.com/smp303svr/
ODataModel.xml(5.7 K)
StocksES1.wsdl.xml(13.7 K)
(9 ratings)
Share 37 1 Like 7
43 Comments
Bjoern Woppmann Jun 23, 2014 3:44 PM (in response to jian wu)
converted by Web2PDFConvert.com
Hi Jian,
the JPA model must be active on the SAP Mobile Platform Server. The JPA JAR must be
packaged as a P2 feature in a P2 update site and enabled as a custom feature on the
server. For more information on enabling custom features on the SAP Mobile Platform
server, see the help pages for SMP3:
SAP Mobile Platform 3.0 SAP Mobile Platform > Server Administrator > Server
Administration > Managing SAP Mobile Platform Server Features
Kind regards
Björn
Like (0)
converted by Web2PDFConvert.com
Kindly Suggests,
Regards,
Sumit
Like (0)
Carlos Roggan Aug 13, 2014 4:44 PM (in response to jian wu)
Hi Jian,
the server is based on OSGi, so the deployables have to be OSGi-bundles.
I've tried to give an overview here: Getting started with GWPA: OSGi Introduction
You'll find also detailed descriptions on creating a bundle and feature and update site
(which was mentioned by Bjoern) in the follow-up exercises:
Getting started with GWPA: OSGi Introduction Exercise 1
Getting started with GWPA: OSGi Introduction Exercise 2
Regarding your existing JPA-project, you can try to convert it to a bundle in Eclipse, using
the context menu on your project, then choose "configure -> convert to Plug-in Project"
This will e.g. add the manifest file to your project and then you can export it as Plugin (==
Bundle) via context menu on your project, then choose "Export -> Plug-In Development ->
Deployable Plug-ins and fragments"
(just in case that this doesn't work for you, you can also create a new bundle manually in
Eclipse (see the descriptions above) and then copy your JPA-jar into it, like a library, and
take care to export the library from your bundle)
Once you have your JPA-project exported as jar-file (which is a bundle, as it contains the
manifest, etc), you can deploy it to SMP
This can be done in 2 ways:
1. put the bundle into a feature, then create an updatesite for the feature. Then go to SMP
and from command line, install the feature into SMP (using p2-commands)
You can find info about it in the above linked documents
2. simply copy the jar file into the pickup folder of SMP
Then check in SMP, if the bundle has been activated (find the command in the links above)
Regarding the JPA-Project and deployment, you may find useful information in Jens
Glanders tutorial:
SAP HANA Cloud Application Development Scenario End-to-End Tutorial
Hope you'll find this helpful!
Cheers,
Carlos
Like (2)
converted by Web2PDFConvert.com
Bjoern Woppmann
I am trying to create OData modeling for ODC data source as per given xml file. I have followed above
steps for configuration in gateway cockpit and set the proxies accordingly after importing the
certificate.
When i run this URL, getting below message:
http://localhost:8080/gateway/odata/sap/Bjoern_ODC;v=1/SalesOrderCollection
Like (0)
Bjoern Woppmann Jul 14, 2014 10:36 AM (in response to jitendra kansal)
Hi Jitendra,
could it be, that you have not registered the service ZGWSAMPLE_SRV coming from the
ES1 system? That would be one possible explanation for the error you are experiencing.
The steps necessary are described in step 7.1 in my blog above.
Kind regards
Björn
Like (2)
jitendra kansal Jul 18, 2014 10:23 AM (in response to Bjoern Woppmann)
Bjoern Woppmann
Thanks. It worked after registering the service.
Rgrds,
JK
Like (1)
Bjoern Woppmann Jul 30, 2014 4:18 PM (in response to saurabh shrivastava)
Hi Saurabh,
I am guessing this happens when you are calling the Stocks entity set. Is this correct?
Do you maybe need to set up a proxy server to connect to the internet as described in step
9.1.1.?
Best regards
Björn
Like (0)
saurabh shrivastava Jul 30, 2014 4:40 PM (in response to Bjoern Woppmann)
converted by Web2PDFConvert.com
Hi Bjoren,
Thanks for the reply but i am using my soap url coming from SAP system. when i
try to check for entity set (collection) i am getting this error.
jitendra kansal Jul 30, 2014 5:53 PM (in response to saurabh shrivastava)
saurabh shrivastava
Are you accessing SOAP URL through a proxy server? Please check it in
browser.
Rgrds,
JK
Like (0)
Regards, Anil
P.S : Oaky...Looks like my GW doesn't have below addon !!!
SAP_GWFND 740 >= SP 02
Like (1)
jitendra kansal Jul 30, 2014 6:14 PM (in response to Anilkumar Vippagunta)
Anilkumar Vippagunta
I can confirm about the URL has to be configure it should be like as you mentioned. e.g.
https://sapes1.sapdevcenter.com/sap/iwbep?sap-client=520
converted by Web2PDFConvert.com
Like (1)
jitendra kansal Jul 31, 2014 2:05 PM (in response to saurabh shrivastava)
saurabh shrivastava
Request you to raise a new thread for your problem. If possible, share screenshots to
understand your issue better.
SMP Developer Center
Rgrds,
JK
Like (1)
hi Bjoern Woppmann
can you guide me where can i find the below screen in Eclipse Juno?
Regard
Ali
Like (0)
jitendra kansal Aug 10, 2014 5:22 PM (in response to Ali Naveed)
ali naveed
Above attached screenshot is nothing but when you provide connection details for any
SOAP WS operation.
You should read this blog for detailed explanation.
Rgrds,
JK
Like (0)
Bjoern Woppmann Aug 12, 2014 1:38 PM (in response to Ali Naveed)
converted by Web2PDFConvert.com
Dear Ali,
please refer to step 5.5 and then select your desired entity set and then the SOAP radio
button. In the next screen you will find the screen you asked about.
Kind regards
Bjoern
Like (1)
Like (0)
converted by Web2PDFConvert.com
Hi Devraj,
can you kindly send me your project file, so that I can have a look at it? You can upload it
here: SAP Mobile Documents
Could you please also state the version of your SAP Mobile Platform tools (the eclipse
plugin) and which SMP release you are using?
Thanks and kind regards
Björn
Like (0)
Rakshit Doshi Feb 23, 2015 10:00 AM (in response to Bjoern Woppmann)
Dear Bjoern,
Can you please stress upon how to configure SSO for the IGW. Currently in the
destination we are hardcoding the user and password so it always calls the
backend service with the same user which is used. Can you please share the
steps on how to configure the destination for SSO?
Thanks,
Rakshit Doshi
Like (0)
Bjoern Woppmann Feb 23, 2015 2:50 PM (in response to Rakshit Doshi)
Hi Rakshit,
I will look into if I can publish a blog on this topic - but at this moment I
cannot promise it. Have you looked at the SAP documentation on the
topic?
Creating a Destination on Gateway Management Cockpit - Data
Integration using Integration Gateway - SAP Library
Kind regards
Björn
Like (0)
Bjoern Woppmann Feb 24, 2015 9:51 AM (in response to Rakshit Doshi)
Hi Rakshit,
I just found blog from my colleagues that explains how to do user
propagation with SSO. Please have a look at it here:
http://scn.sap.com/community/developer-center/mobility-
platform/blog/2015/01/07/soap-authentication--user-
propagation-from-smp-to-igw
Regards
Björn
Like (0)
Rakshit Doshi Feb 27, 2015 4:44 PM (in response to Bjoern Woppmann)
Dear Bjoern,
I figured it out using the reference link.
A little bit was missing which i fixed and got it working
http://scn.sap.com/community/developer-center/mobility-
platform/blog/2015/02/27/how-to-configure-sso-for-smp-30-for-
bep
Thanks,
Rakshit Doshi
Like (0)
converted by Web2PDFConvert.com
Hi Bjoern,
This blog is a very much useful for end to end process.Thank you very much for this blog.
I have tried to implement it. I am getting the below error while reading the service.
1. I am doing it for importing odata service in the eclipse (ODC).
2. I have imported my service in the eclipse and registered it with the SMP.
3. While reading the Metadata from the Gateway Cockpit , I am able to get the result.
4. But while reading the particular entity set i am getting the below error.
Like (0)
Carlos Roggan Jun 15, 2015 1:35 PM (in response to Michael Segal)
Hi Michael, maybe this consideration helps:
The csrf-token is required by SMP and you need to specify it. But it isn't per se valid for the
connected backend.
Like (0)
Michael Segal Jun 16, 2015 10:34 AM (in response to Carlos Roggan)
Thank you Carlos for fast reply. I tried to send Post request without csrf-token-
Unfortunately it still failed. I think the problem in SMP backend configurations
Like (0)
jitendra kansal Jun 16, 2015 10:56 AM (in response to Michael Segal)
converted by Web2PDFConvert.com
Michael Segal
Please raise a new thread at SMP Developer Center in case you are
facing issues related to SMP. Provide steps you have followed and
screenshots (if possible) along with reference of the doc/blog you have
referred.
Regards,
JK
Like (0)
Michael Appleby Jun 16, 2015 3:57 PM (in response to jitendra kansal)
To expand on what Jitendra requested, please create a new
Discussion marked as a Question. You will receive more help
than by commenting on a document which may only have the
author responding.
Regards, Mike (Moderator)
SAP Technology RIG
Like (0)
converted by Web2PDFConvert.com