Skip to Content
avatar image
Former Member

Fiori for iOS - Service Root URL not found?

Hi all,

Step by step I am moving forward in creating the first application.
I just found another strange error which is driving me crazy.

Following this tutorial I am checking the usage of the KeyChain to store user credentials and application connection id: everything works fine (I see registrations coming out correctly in the Mobile Services cockpit) but - while checking the registration - I am always getting a 404 return code for the "serviceRoot" url (see step 3 of the tutorial).

The serviceRoot URL converts to a direct link to the Application ID, which seems to be a non-existent resource:

hcpms-trialusername.hanatrial.ondemand.com/applicationid

I checked also by faking a request with Postman and I am getting the same results, always 404.

Am I doing something wrong? Which is the default "serviceRoot" url for a given Application Id?

On the contrary, the registration URL works perfectly fine.

Thanks for any hint,

Roberto.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 03, 2017 at 09:42 AM

    Hello Roberto,

    what is the name of the destination you are using for the backend connectivity? If it did not get the same name than it was used for the AppID, the request will fail like in your case. The serviceRoot URL must be https://hcpms-trialusername.hanatrial.ondeman.com/name_of_destination.

    You can check the backend URL for your app in the new mobile service cockpit going to your native app and switching to tab "APIs".

    Regards,
    Florian

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Florian,
      What made me going "off-road" was the new version of the Mobile Services Cockpit.

      Now that we can also choose Cloud Platform destinations (and not only create new ones in Mobile Destinations), the backend service name was not equal to the application id anymore.

      In my case, the application was com.xx.yy.Demo while the backend destination was "K62".

      So obviously, requests were merely failing.

      I managed to find a workaround in any case (see my other answer) but it is far away from a best practice :)

      I did some cleanup in the cockpit and I am now trying again!

      Thanks for the tip!

      Roberto.

  • avatar image
    Former Member
    May 03, 2017 at 09:36 AM

    Update:

    After a deeper digging, I also found out that even sample Applications generate with the SDK Assistant are not able to connect to the Service Endpoint. Even login requests end in a 404 error.

    I don't know if this is happening only to me, but I had a deep look to the documentation and here's how I "solved" this issue.

    To register a new Application Connection Id, the endpoint should be formed like this:

    hcpms-<accountId>.<hcpLandscape>/odata/applications/latest/<applicationId>/Connections

    And HTTP headers must be provided for "Authorization", "Content-Type" and "Accept" (the latters both set to JSON). Note that this is a POST request.

    To check whether an Application Connection Id is still valid, the endpoint should be formed like this:

    hcpms-<accountId>.<hcpLandscape>/odata/applications/latest/<applicationId>/Connections('<applicationConnectionid>')

    And HTTP headers must be provided for "Authorization" and "X-SMP-APPCID". Note that this is a GET request.

    This endpoint should respond with Application capabilities based on the registration id (ApplicationConnectionId) provided: if the ApplicationConnectionId is not valid or it has expired, we get a 404 error.

    Afterwards, to fetch OData entitites and get data, we must first get the Backend Endpoint by calling:

    hcpms-<accountId>.<hcpLandscape>/odata/applications/latest/<applicationId>/Endpoints (again, provide Headers for "Authentication" and "Accept" and set the request to GET)

    Now, with the Endpoint, we can call

    hcpms-<accountId>.<hcpLandscape>/<Endpoint>/<EntitySet>

    To receive the data payload.

    I am not sure that this is the correct approach, but it works as expected and was the only way in which I was able to get connected, registered and getting data.

    Maybe someone can either confirm or point me in the correct direction ( @robin.vanhethof? :) )

    Cheers,

    Roberto.

    Add comment
    10|10000 characters needed characters exceeded

  • May 09, 2017 at 08:18 AM

    Roberto,

    I think the cause of this confusion might be the mixup between endpoints/connections/destinations and applicationids. When you create an application in the Mobile Services Cockpit, the first backend you define will per default have the applicationId used as the destination name. In the very recent upgrade to the Cockpit we unified naming here and at least in the UI should everywhere now speak of 'Destinations'.

    If you configure the destination with 'Rewrite URL' mode, the destination/connection name will be used to expose this backend. If you chose 'Rewrite URL on Back End' mode, the URL will be exposed like the paths look like on the backend (as a transparent proxy). This is explained in more detail at https://help.hana.ondemand.com/hana_cloud_platform_mobile_services/frameset.htm?a189cba40b27413890edc350ef615b08.html.

    You can also see the exposed URLs in the new Cockpit when you select your Application and then switch to the 'APIs' tab. Accessing these should never give you a 404 - if you're missing to send the X-SMP-APPID header and/or don't have a valid session, you should receive an HTTP 403.

    Thanks
    Andreas

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you for the clarification and for pointing out the link to the documentation Andreas!

      In fact, everything is much more clear to me now and I finally got my application up and running without any issue.

      Thanks again,

      Roberto.