Skip to Content
0

Migrating App from WEB IDE to Eclipse - OData Connection

May 25, 2017 at 09:08 PM

338

avatar image
Former Member

Hi experts,

I have an application that works fine on WEB IDE with a Destination configured in SAP Cloud Platform.

I want to extend my app in Eclipse, so I migrated the application.

I am trying to connect to an OData Service in an Abap System.

The new destinations look like this: manifest.json

When I run the application in eclipse the result is the following:

How is the configuration of the connection to the abap system for consumption of the service in eclipse (authentication)?

It is possible to configure the authentication in the file manifest.json ?

Is there another setup for the correct consumption of the service?



If you can help me with this I would appreciate it.

Regards.

manifestjson.png (11.4 kB)
error.png (9.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

saurabh vakil May 26, 2017 at 07:09 AM
0

Have you checked by deploying the project from Eclipse to the ABAP repository and then running it on the ABAP Server? Before deploying the project you will have to adjust the uri in the dataSource section of the manifest.json file to /sap/opu/odata/sap/<SERVICEURL>.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello saurabh vakil,

Thanks for your help, what I want right now is extend the application in Eclipse and deploy it in HCP.

For reasons of agility I decided to develop it in WEB IDE, but I need to take advantage of some features of java.I want to know if there is a way to configure a destination in Eclipse by providing the full url of the Abap server without modifying the code.
Regards.
0

The concept of destination is relevant only for SAP Cloud Platform when you develop your application in Web IDE. When using Eclipse for development you have to either test locally by disabling web security in Chrome browser or decalre the service URL as /proxy/http/<host>:<port>/sap/opu/odata/sap/<SERVICENAME> in the manifest.json file.

However if you have the option to deploy on the ABAP repository and then test it the the URL jst needs to start with /sap/opu/......

0
avatar image
Former Member May 28, 2017 at 06:40 AM
0

You can write proxy/http/yourservername/servicename in manifest.json. Also you can either set credentials while calling the odata service in code or you can provide in the servicename in GW.

Regards,

Dhruv

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello Dhruv Shah,

Thanks for your help, any examples of how to do this?

Regards.

0
Steve Guo
May 28, 2017 at 11:01 AM
0

In web IDE. The code here is the relative url you used in you abap server.

The url should be " /sap/.....", no "http", I guess you changed it.....

But the url is not accessible when you are testing your app in webide.

In webide we has a neo-app.json, the file defines a mapping rule for urls. It map the /sap... url to the real one according information you provided in "destination" in your hcp cockpit.

So everything works fine, if you create the odata service and odata model using wizard of webide.

And that's one reason why webide better than eclipse.

Currently we have also a local version of webide, you can install it on your laptop.

You can download and check the documents here.

https://tools.hana.ondemand.com/#sapui5

Currently there is no any reason of study sapui5 in eclipse, except for open old projects built by eclipse.(Open it in webide also involves some change)

If you insist to use it in eclipse.

First you need to check weather your code is running locally or running on abap server.

When running on abap server, it's ok. But when you running locally your url is http://localhost......, and you can not invoke services from other domain according to the same-origin policy.

So you need to build a proxy in eclipse, to cheat the browser you are calling something from localhost......

And you should write some if else code, to makesure when you running on local, you invoke service through the proxy.

Here is an instruction for that

https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/2d3f5fb63a2f4090942375df80abc39f.html

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello Steve Guo,

Thanks for your help, yes, as you say, I have changed the url "/sap/...." for "http".

For reasons of agility I decided to develop the application in WEB IDE, but I need to take advantage of some features of java. I want to know if there is a way to configure a destination in Eclipse by providing the full url of the Abap server without modifying the code.

When I try to run the application in eclipse the problem is apparently in authentication.

It is possible to configure the user credentials (abap server) without modifying the code?

Or, Is it necessary to start a new java project in eclipse?

Note: "the project must be deployed in hcp"

Regards.

0

Hello, Juan

There is no way to add destination in eclipse.

And it's not recommend to combine your java code and html5 code for hcp development.

For your want to deploy it on HCP.

You need to develop your java application in eclipse and expose your service as OData or rest, you can use apache lingo, or OData4j as the framework for generating odata service.

After the deployment of your java application, you can create the destination in HCP to set your java application as the backend.

After that , you can start developing your HTML5 application in WebIDE, and connect the backend service via destinations in your HCP cockpit.

After the development, you can deploy your sapui5 application as HTML5 application in your HCP, using deploy menu.

0