cancel
Showing results for 
Search instead for 
Did you mean: 

Error accessing OData Service after Migration of project from WebIDE to Business Application Studio

haykma
Participant
0 Kudos

Hi Community,

we want to migrate our fiori applications from SAP CP Neo, developed in WebIDE, to SAP CloudFoundry (CF) and Business Application Studio (BAS).

For that in i followed the instructions "Migrating HTML5 Applications from SAP Cloud Platform Neo to the Cloud Foundry Environment" in help.sap.com. This guide shows in different steps how to migrate an HTML5 app (which of course all our Fiori apps are) to SAP CF.

The only thing i changed is, that our source app in Neo does not need authentication (because authentication is implementend in the used OData Services).

After migration i'm able to start the app in BAS, BUT it does not run correctly because it is not able to access the OData-Service. I only get the following error:

I removed the leading "/" in requesturi of datasource part in manifest.json as descripted in the instruction guide (i of course also tried to not remove the leading "/").

The used destination itself works. I tested it by creating a new project from template and in the step of the wizzard where to choose a service of a destination, all services where selectable.

My Workspace looks like this, where "md" is my html module, containing the webapp folder. So the folder "md" contains my imported WebIDE project (here i already deleted neo-app.json which is not used in BAS)

Here is my file xs-app.json from my hmtl5-module directory:

{
    "welcomeFile": "/index.html",
    "authenticationMethod": "none",
    "logout": {
        "logoutEndpoint": "/do/logout"
    },
    "routes": [
        {
            "source": "^(.*)$",
            "target": "$1",
            "service": "html5-apps-repo-rt",
            "authenticationType": "none"
        },
        {
            "source": "^/sap/opu/odata(.*)$",
            "destination": "<mydestination>",
            "target": "$1"
        }
    ]
}

where <mydestination> is replaced with the name of my real destination.

My mta.yaml looks like this:

_schema-version: "3.2"
ID: personnelfile
version: 0.0.1
modules:
- name: personnelfile-destination-content
  type: com.sap.application.content
  requires:
  - name: my_destination_service
    parameters:
      content-target: true
  - name: personnelfile_html_repo_host
    parameters:
      service-key:
        name: personnelfile_html_repo_host-key
  build-parameters:
    no-source: true
- name: personnelfile_ui_deployer
  type: com.sap.application.content
  path: .
  requires:
  - name: personnelfile_html_repo_host
    parameters:
      content-target: true
  build-parameters:
    build-result: resources
    requires:
    - artifacts:
      - md-content.zip
      name: md
      target-path: resources/
- name: md
  type: html5
  path: md
  build-parameters:
    builder: custom
    commands:
    - npm run build
    supported-platforms: []
resources:
- name: my_destination_service
  type: org.cloudfoundry.managed-service
  parameters:
    service-plan: lite
    service: destination
    path: config.json
- name: my_connectivity_service
  type: org.cloudfoundry.managed-service
  parameters:
    service-plan: lite
    service: connectivity
- name: personnelfile_html_repo_host
  type: org.cloudfoundry.managed-service
  parameters:
    service: html5-apps-repo
    service-name: personnelfile-html5-app-host-service
    service-plan: app-host
build-parameters:
  before-all:
  - builder: custom
    commands:
    - npm install



As descripted in mta.yaml the destination configuration is in config.json which looks like this:

{
    "init_data": {
        "subaccount": {
            "existing_destinations_policy": "update",
            "destinations": [
                {
                    "Name": "<mydestination>",
                    "WebIDEEnabled": "true",
                    "sap-client": "100",
                    "WebIDEUsage": "odata_abap,dev_abap,ui5_execute_abap",
                    "WebIDESystem": "<mysid>",
                    "Authentication": "PrincipalPropagation",
                    "ProxyType": "OnPremise",
                    "Type": "HTTP",
                    "URL": "http://<myvirthost>:<port>"
                }
            ]
        }
    }
}

where again <mydestination>,<mysid>,<myvirthost> are replaced my real values.

Does anyone know what i maybee missed or what could be wrong or has an idea what to try?

That would be great.

Kind regards
Matthias

Accepted Solutions (1)

Accepted Solutions (1)

haykma
Participant
0 Kudos

Hi Community,

found the solution by myself.

I didn't know the exact syntax and meaning of the file "xs-app.json" so far during migration. But i found out, that the order of the route entries is important, not the type. So the app is not looking for a fitting entry with an destination attribute. It looks for the first fitting route and takes that entry. In my case the entry for the app-router gets fits all routes by its regular expression, so that the destination route never comes to its fitting destination entry.
I swapped the entries and it worked.

Kind regards
Matthias

Answers (1)

Answers (1)

WouterLemaire
Active Contributor
0 Kudos

You say a newly generated project works fine? What if you copy only the webapp folder tonthis newly created project? Would that work?

Another stupid question, just want to make sure, have you bound the app to the destination service when you run it?

haykma
Participant
0 Kudos


Hi Wouter,

yes. I have bound the app to the destination service in runtime configuration.

kind regards