Skip to Content

Data in Offline Application fails to appear on Android Emulator using HAT setup on SAP WebIDE

Hi Experts,

I have setup local build environment as follows to enable offline mobile applications on SAP Web IDE.

1. Downloaded latest SMP SDK 14 and SMP SDK 13 PL06

2. Java 1.8

3. Node.js 5.4.1

4. Cordova 6.1.1 (as per SAP's recommendation)

5. Plugman

6. Kapsel cli

7. Apache ANT 1.9.7

8. SAP Hybrid App Toolkit (SAP_HAT_local_1_22_2)

9. Android SDK Android SDK Tools, Android SDK Platform-tools,Android Build -tools, Android 6.0, 5.1.1 and 4.4.2(SDK Platform, ARM EABI v7a System Image, Intel x86 Atom System Image)

With all the above setup, HAT setup works and HAT connector is up and running on http://localhost:9010.

After this, offline master detail application is created on webide with Northwind oData service and hybrid app configurations are done in Project Settings

worker.png build-options.png plugins.png

Application is deployed on HAT toolkit and it adds kapsel logon and odata plugins during build phase.

In this case, HCPms logon screen does not appear whenever application is run on Android Emulator. emulator.png

The same HCPms logon screen appears when cordova and cordova android version is upgraded manually to 6.3.1 and 5.2.2 and emulator gets registered on HCPms with same application id added in Hybrid app configurations and HCPms application. But after logon, no data comes from Northwind service and emulator shows below error:-

emulator-error.png

I am not sure if this error is due to mismatch Cordova and Cordova-android versions or some configurations are missed out. Because SMP 3 SDK 14 with SAP_HAT_local-1.22.2 version by default takes Cordova 6.1.1.

With this setup, Kapsel plugins accept Cordova version 6.3.1 and same gets reflected in plugin.xml file.( C:\SAP\MobileSDK3\KapselSDK\plugins\logon\plugin.xml)

<name>Logon</name> 
<engines> 
<engine
name="cordova" version=">=6.3.1" /> 
<engine name="cordova-android" version=">=5.2.2"
/> 
<engine name="cordova-ios" version=">=4.2.1"
/> 
</engines>

HCPms application configuration is done as-

hcpms-application-config.png

device-registeration.png

Please provide your expert help as I am not able to proceed ahead as this url when tested in REST client too gives HTTP 404 error.

hcpmsadmin-pXXXXXXXX7trial.dispatcher.hanatrial.ondemand.com:443/com.woker.app/$metadata

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Jan 06, 2017 at 03:04 PM

    Try changing the Rewrite Mode to Rewrite URL. You may want to also try changing the back end url to the service base url. The location of V2 is different...

    http://services.odata.org/(S(kz4kogric1r4ko4kqjfaenjn))/V2/OData/OData.svc/

    Regards,

    Jamie

    SAP - Technology RIG

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 06, 2017 at 04:50 PM

    Hi Jamie,

    Thanks for your reply.

    Changed the Rewrite Mode to just "Rewrite URL" in HCPms application helped in getting away with HTTP 404 error. But the problem now is data is not coming in emulator although logs and REST client returns response status 200.

    I will surely try with actual gateway service url and check if that works as expected. Also for V2 odata northwind service url, we normlly get different url for read write northwind service. This is what I just got on fresh hit on browser; http://services.odata.org/V2/(S(qtzu04wplxqvj2g2tdddp2gh))/OData/OData.svc/

    #2.0#2017-01-06 04:53:19 PM#DEBUG#Offline####1483701799207002#bb504325-b492-4bfd-97c7-432ee2f4e15d##MobilinkAppcidFilter:doFilter########132#####Completed MobiLink adapter request. APPCID: e362fc5d-f712-4524-82ef-af4239df960a , requestURI: /MobiLink/ServletAsync, requestMethod: POST, responseStatus: 400 time since handoff(ms): 1# #2.0#2017-01-06 04:53:19 PM#WARNING#Offline####1483701799207003#bb504325-b492-4bfd-97c7-432ee2f4e15d##MobilinkAppcidFilter:doFilter########132#####Completed MobiLink adapter request. Response code is >= 400. APPCID: e362fc5d-f712-4524-82ef-af4239df960a , requestURI: /MobiLink/ServletAsync, method POST, status 400 time since handoff(ms): 1# #2.0#2017-01-06 04:53:19 PM#DEBUG#Offline####1483701799207001#bb504325-b492-4bfd-97c7-432ee2f4e15d##MobilinkAppcidFilter:doFilter########132#####Forwarding request to MobiLink adapter. APPCID: e362fc5d-f712-4524-82ef-af4239df960a , requestURI: /MobiLink/ServletAsync, requestMethod: POST# #2.0#2017-01-06 04:53:18

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 09, 2017 at 02:14 PM

    If you open the service url

    http://services.odata.org/V2/(S(qtzu04wplxqvj2g2tdddp2gh))/OData/OData.svc/

    check the value of the xml:base, the V2 will be in a different location. Use this for the back end url.

    Regards,

    Jamie

    SAP - Technology RIG

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 09, 2017 at 03:33 PM

    Hi Jamie,

    I just tried with "http://services.odata.org/(S(mkapmibcorqvz2ehks5tar4r))/V2/OData/OData.svc/ " backend URL in HCPms but data is still not coming in android emulator. testlog2.txt (emulator log file)

    Here are the logs generated in HCPms logs and traces:-

    2.0#2017-01-05 08:14:45 PM#ERROR#RequestResponse#404##Offline#1483627485509003#131edca9-c800-4916-8b56-52af8986a45d#com.worker.app#com.sap.mobile.platform.server.mobilink.MLSMPLogger:error########366#####Delta refresh for an Offline OData client failed.# #2.0#2017-01-05 08:14:45 PM#ERROR#RequestResponse#404##Offline#1483627485509004#131edca9-c800-4916-8b56-52af8986a45d#com.worker.app#com.sap.mobile.platform.server.mobilink.MLSMPLogger:error########366#####[-100025] An error occurred while communicating with the OData server to retrieve the result of request "https://hcpms-p1XXXXXXXtrial.hanatrial.ondemand.com:443/com.worker.app/$metadata". Error caused by: [-100010] Retrieve metadata failed because the OData server returned HTTP code, 404, with message: The requested resource does not exist.#


    Contents of metadata.xml file generated in webapp\localservice folder

    <edmx:Edmx
        xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
        <edmx:DataServices
            xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0">
            <Schema
                xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
                xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
                xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="ODataDemo">
                <EntityType Name="Product">
                    <Key>
                        <PropertyRef Name="ID"/>
                    </Key>
                    <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
                    <Property Name="Name" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="false"/>
                    <Property Name="Description" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="text" m:FC_KeepInContent="false"/>
                    <Property Name="ReleaseDate" Type="Edm.DateTime" Nullable="false"/>
                    <Property Name="DiscontinuedDate" Type="Edm.DateTime" Nullable="true"/>
                    <Property Name="Rating" Type="Edm.Int32" Nullable="false"/>
                    <Property Name="Price" Type="Edm.Decimal" Nullable="false"/>
                    <NavigationProperty Name="Category" Relationship="ODataDemo.Product_Category_Category_Products" FromRole="Product_Category" ToRole="Category_Products"/>
                    <NavigationProperty Name="Supplier" Relationship="ODataDemo.Product_Supplier_Supplier_Products" FromRole="Product_Supplier" ToRole="Supplier_Products"/>
                </EntityType>
                <EntityType Name="Category">
                    <Key>
                        <PropertyRef Name="ID"/>
                    </Key>
                    <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
                    <Property Name="Name" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="true"/>
                    <NavigationProperty Name="Products" Relationship="ODataDemo.Product_Category_Category_Products" FromRole="Category_Products" ToRole="Product_Category"/>
                </EntityType>
                <EntityType Name="Supplier">
                    <Key>
                        <PropertyRef Name="ID"/>
                    </Key>
                    <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
                    <Property Name="Name" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="true"/>
                    <Property Name="Address" Type="ODataDemo.Address" Nullable="false"/>
                    <Property Name="Concurrency" Type="Edm.Int32" Nullable="false" ConcurrencyMode="Fixed"/>
                    <NavigationProperty Name="Products" Relationship="ODataDemo.Product_Supplier_Supplier_Products" FromRole="Supplier_Products" ToRole="Product_Supplier"/>
                </EntityType>
                <ComplexType Name="Address">
                    <Property Name="Street" Type="Edm.String" Nullable="true"/>
                    <Property Name="City" Type="Edm.String" Nullable="true"/>
                    <Property Name="State" Type="Edm.String" Nullable="true"/>
                    <Property Name="ZipCode" Type="Edm.String" Nullable="true"/>
                    <Property Name="Country" Type="Edm.String" Nullable="true"/>
                </ComplexType>
                <Association Name="Product_Category_Category_Products">
                    <End Role="Product_Category" Type="ODataDemo.Product" Multiplicity="*"/>
                    <End Role="Category_Products" Type="ODataDemo.Category" Multiplicity="0..1"/>
                </Association>
                <Association Name="Product_Supplier_Supplier_Products">
                    <End Role="Product_Supplier" Type="ODataDemo.Product" Multiplicity="*"/>
                    <End Role="Supplier_Products" Type="ODataDemo.Supplier" Multiplicity="0..1"/>
                </Association>
                <EntityContainer Name="DemoService" m:IsDefaultEntityContainer="true">
                    <EntitySet Name="Products" EntityType="ODataDemo.Product"/>
                    <EntitySet Name="Categories" EntityType="ODataDemo.Category"/>
                    <EntitySet Name="Suppliers" EntityType="ODataDemo.Supplier"/>
                    <AssociationSet Name="Products_Category_Categories" Association="ODataDemo.Product_Category_Category_Products">
                        <End Role="Product_Category" EntitySet="Products"/>
                        <End Role="Category_Products" EntitySet="Categories"/>
                    </AssociationSet>
                    <AssociationSet Name="Products_Supplier_Suppliers" Association="ODataDemo.Product_Supplier_Supplier_Products">
                        <End Role="Product_Supplier" EntitySet="Products"/>
                        <End Role="Supplier_Products" EntitySet="Suppliers"/>
                    </AssociationSet>
                    <FunctionImport Name="GetProductsByRating" EntitySet="Products" ReturnType="Collection(ODataDemo.Product)" m:HttpMethod="GET">
                        <Parameter Name="rating" Type="Edm.Int32" Mode="In"/>
                    </FunctionImport>
                </EntityContainer>
            </Schema>
        </edmx:DataServices>
    </edmx:Edmx>


    Add comment
    10|10000 characters needed characters exceeded

  • Jan 09, 2017 at 06:39 PM

    Did you delete and redeploy the app after making the change?

    Regards,

    Jamie

    SAP - Technology RIG

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 10, 2017 at 11:54 AM

    Hi Jamie,

    Yes I had deleted old app first and run the solution again on emulator, still data is not populated from northwind odata service.

    Please suggest what other changes are required to make it work.

    Also, observed following warning in logs which says No offline configuration found for endpoint 2cfaf7b8-c0c7-4a91-a3cf-4fcda083542b::com.worker.app::com.worker.app. Default settings will be used.#

    #2.0#2017-01-10 11:41:14 AM#WARNING#Offline####1484028674647003#8cb07036-8cd6-4259-9898-3342e7fded75##MobilinkAppcidFilter:doFilter########657#####Completed MobiLink adapter request. Response code is >= 400. APPCID: d96989b9-2366-43b0-81be-ad86bb722b04 , requestURI: /MobiLink/ServletAsync, method POST, status 400 time since handoff(ms): 0# #2.0#2017-01-10 11:41:14 AM#DEBUG#Offline####1484028674647001#8cb07036-8cd6-4259-9898-3342e7fded75##MobilinkAppcidFilter:doFilter########657#####Forwarding request to MobiLink adapter. APPCID: d96989b9-2366-43b0-81be-ad86bb722b04 , requestURI: /MobiLink/ServletAsync, requestMethod: POST# #2.0#2017-01-10 11:41:14 AM#DEBUG#Offline####1484028674300002#7825af0b-032b-4ec3-bd87-98ce20f2bbaa##MobilinkAppcidFilter:doFilter########666#####Completed MobiLink adapter request. APPCID: d96989b9-2366-43b0-81be-ad86bb722b04 , requestURI: /MobiLink/ServletAsync, requestMethod: POST, responseStatus: 200 time since handoff(ms): 1# #2.0#2017-01-10 11:41:14 AM#DEBUG#Offline####1484028674300001#7825af0b-032b-4ec3-bd87-98ce20f2bbaa##MobilinkAppcidFilter:doFilter########666#####Forwarding request to MobiLink adapter. APPCID: d96989b9-2366-43b0-81be-ad86bb722b04 , requestURI: /MobiLink/ServletAsync, requestMethod: POST# #2.0#2017-01-10 11:41:14 AM#DEBUG#Offline####1484028674057002#d2aad292-9d9b-4794-9506-cce8806e2acd##MobilinkAppcidFilter:doFilter########666#####Completed MobiLink adapter request. APPCID: d96989b9-2366-43b0-81be-ad86bb722b04 , requestURI: /MobiLink/ServletAsync, requestMethod: GET, responseStatus: 200 time since handoff(ms): 0# #2.0#2017-01-10 11:41:14 AM#DEBUG#Offline####1484028674057001#d2aad292-9d9b-4794-9506-cce8806e2acd##MobilinkAppcidFilter:doFilter########666#####Forwarding request to MobiLink adapter. APPCID: d96989b9-2366-43b0-81be-ad86bb722b04 , requestURI: /MobiLink/ServletAsync, requestMethod: GET# #2.0#2017-01-10 11:41:13 AM#INFO#Proxy####1484028673126003#33193688-9389-4501-903b-97bd524fdca0#com.worker.app#DirectProxy:fireRequest########431#####Finished sending request to back end http://services.odata.org/(S(mkapmibcorqvz2ehks5tar4r))/V2/OData/OData.svc/Products?$expand=Supplier in 206 ms. HTTP status from the back end is 200.# #2.0#2017-01-10 11:41:13 AM#WARNING#Offline####1484028673126002#33193688-9389-4501-903b-97bd524fdca0#com.worker.app#MLSMPLogger:warnEventLog########431#####No offline configuration found for endpoint 2cfaf7b8-c0c7-4a91-a3cf-4fcda083542b::com.worker.app::com.worker.app. Default settings will be used.# #2.0#2017-01-10 11:41:13 AM#INFO#Proxy####1484028673126001#33193688-9389-4501-903b-97bd524fdca0#com.worker.app#DirectProxy:fireRequest########431#####Finished sending request to back end http://services.odata.org/(S(mkapmibcorqvz2ehks5tar4r))/V2/OData/OData.svc/$metadata? in 251 ms. HTTP status from the back end is 200.# #2.0#2017-01-10 11:41:13 AM#DEBUG#Offline####1484028673357002#30b7c7c4-c3f4-46aa-a6e2-cb1e648789e4##MobilinkAppcidFilter:doFilter########673#####Completed MobiLink adapter request. APPCID: d96989b9-2366-43b0-81be-ad86bb722b04 , requestURI: /MobiLink/ServletAsync, requestMethod: GET, responseStatus: 200 time since handoff(ms): 0#

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Guys,

      I am also facing same issue for me store opens fine but after applying httpclient for offline OData requests, the requests fails with http 504 status code as error code and logs says below

      #2.0#2017-05-16 05:57:02 PM#WARNING#RequestResponse#504##Offline#1494937621141120#bc27cb4a-9f80-4eda-8a56-24a751a94503##com.sap.mobile.platform.server.mobilink.MLSMPLogger:warn#mob_dev#######370#####[-100025] An error occurred while communicating with the OData server to retrieve the result of request "https://mobile-caeeb5389.ap1.hana.ondemand.com:443/(AppID)/$metadata". Error caused by: [-100010] Retrieve metadata failed because the OData server returned HTTP code, 504, with message: null#

      Not sure what is going wrong.

      Any help will be appreciated.

      Best Regards

      Fenil