<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: consume data from java api to sapui5 in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098047#M4519833</link>
    <description>&lt;P&gt;Hi &lt;A href="https://answers.sap.com/users/871953/roan20190927.html"&gt;Yuning Roan&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;To make a call to a REST or OData service from a SAPUI5 app you should be using a destination defined in the cockpit to create an abstraction layer for your code (to avoid hard-coding any end-points). To make a rest or odata call you can use the JSONModel or ODataModel, like it is described below: &lt;/P&gt;&lt;P&gt;&lt;A href="https://sapui5.hana.ondemand.com/1.34.7/docs/guide/44062441f3bd4c67a4f665ae362d1109.html"&gt;https://sapui5.hana.ondemand.com/1.34.7/docs/guide/44062441f3bd4c67a4f665ae362d1109.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Notice that you have to define the destination created in the cockpit inside your neo-app.json and manifest.json (this is described on the link above).&lt;/P&gt;&lt;P&gt;The below blog describes how to use the odata model. But for REST services the JSON model can be used in a similar way. &lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2017/03/13/how-to-consume-an-odata-service-with-openui5-sapui5/"&gt;https://blogs.sap.com/2017/03/13/how-to-consume-an-odata-service-with-openui5-sapui5/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Furthermore, an API usually is protected by an API Key in which you could request authentication via OAuth method. In such case, you shouldn't make a call directly from browser a based application such as sapui5. The reason is that you will incur in exposing the API Key on the browser. So, anyone that has access to the source code of the application will be able to see the API Key unprotected.&lt;/P&gt;&lt;P&gt;The solution is to make the API call via a protected Java Application that implements an OData or REST service or even use the OAuth2SAMLAuthentication in a destination for your sapui5 app.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Ivan&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2019 18:18:44 GMT</pubDate>
    <dc:creator>Ivan-Mirisola</dc:creator>
    <dc:date>2019-11-13T18:18:44Z</dc:date>
    <item>
      <title>consume data from java api to sapui5</title>
      <link>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaq-p/12098046</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I have built a java API(deployed on SAP Cloud Platform) on and want to display the acquired JSON data to sapui5.&lt;BR /&gt;Is there any way that I can call the java API for example, via URL?&lt;BR /&gt;&lt;BR /&gt;Or is it necessary to use OData service?&lt;BR /&gt;If the answer is latter, could you guide me how it works or provide some documents for beginner.&lt;BR /&gt;I have read the blog &lt;A href="https://blogs.sap.com/2016/02/08/odata-everything-that-you-need-to-know-part-1/"&gt;&lt;/A&gt;&lt;A href="https://blogs.sap.com/2016/02/08/odata-everything-that-you-need-to-know-part-1/" target="test_blank"&gt;https://blogs.sap.com/2016/02/08/odata-everything-that-you-need-to-know-part-1/&lt;/A&gt;&lt;BR /&gt;but I would like to know what would be the relationship among sapui5, java api and OData service.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;I have also read the post below which is similar to my questions but could not figure out how the problem is solved.&lt;A href="https://answers.sap.com/questions/10953428/consume-java-api-from-a-sapui5-application.html"&gt;https://answers.sap.com/questions/10953428/consume-java-api-from-a-sapui5-application.html&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;Any help would be appreciate.&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;&lt;BR /&gt;Roan&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 01:54:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaq-p/12098046</guid>
      <dc:creator>former_member57886</dc:creator>
      <dc:date>2019-11-13T01:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: consume data from java api to sapui5</title>
      <link>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098047#M4519833</link>
      <description>&lt;P&gt;Hi &lt;A href="https://answers.sap.com/users/871953/roan20190927.html"&gt;Yuning Roan&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;To make a call to a REST or OData service from a SAPUI5 app you should be using a destination defined in the cockpit to create an abstraction layer for your code (to avoid hard-coding any end-points). To make a rest or odata call you can use the JSONModel or ODataModel, like it is described below: &lt;/P&gt;&lt;P&gt;&lt;A href="https://sapui5.hana.ondemand.com/1.34.7/docs/guide/44062441f3bd4c67a4f665ae362d1109.html"&gt;https://sapui5.hana.ondemand.com/1.34.7/docs/guide/44062441f3bd4c67a4f665ae362d1109.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Notice that you have to define the destination created in the cockpit inside your neo-app.json and manifest.json (this is described on the link above).&lt;/P&gt;&lt;P&gt;The below blog describes how to use the odata model. But for REST services the JSON model can be used in a similar way. &lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2017/03/13/how-to-consume-an-odata-service-with-openui5-sapui5/"&gt;https://blogs.sap.com/2017/03/13/how-to-consume-an-odata-service-with-openui5-sapui5/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Furthermore, an API usually is protected by an API Key in which you could request authentication via OAuth method. In such case, you shouldn't make a call directly from browser a based application such as sapui5. The reason is that you will incur in exposing the API Key on the browser. So, anyone that has access to the source code of the application will be able to see the API Key unprotected.&lt;/P&gt;&lt;P&gt;The solution is to make the API call via a protected Java Application that implements an OData or REST service or even use the OAuth2SAMLAuthentication in a destination for your sapui5 app.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Ivan&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 18:18:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098047#M4519833</guid>
      <dc:creator>Ivan-Mirisola</dc:creator>
      <dc:date>2019-11-13T18:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: consume data from java api to sapui5</title>
      <link>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098048#M4519834</link>
      <description>&lt;P&gt;Hi Ivan,
&lt;BR /&gt;&lt;BR /&gt;Thank you for the clear instruction.
&lt;BR /&gt;&lt;BR /&gt;Here are some more detailed background of what I am trying to achieve.
&lt;BR /&gt;SAPUI5: connect to JavaAPI deployed on SCP as Java Application and display the data to UI.
&lt;BR /&gt;JavaAPI: call SFSF OData API using HTTP Methods and filter the data as JSON to be displayed.
&lt;BR /&gt;&lt;BR /&gt;Now I got some other questions after reading the references you provided.
&lt;BR /&gt;As for the CORS issues, the first reference(&lt;A href="https://sapui5.hana.ondemand.com/1.34.7/docs/guide/44062441f3bd4c67a4f665ae362d1109.html"&gt;https://sapui5.hana.ondemand.com/1.34.7/docs/guide/44062441f3bd4c67a4f665ae362d1109.html&lt;/A&gt;) provided a solution:
Use a helper service from the same domain of our app as a proxy to call the real remote service. &lt;BR /&gt;And providing Northwind Destination as an example. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Am I able to set the Java Application domain as Destination?
&lt;/STRONG&gt;&lt;BR /&gt;If yes, I tried to set one but failed.(as below)
Could you please guide me to the correct setting.&lt;BR /&gt;If no, what would be another solution.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1744683-destination-setting.png" /&gt;&lt;BR /&gt;&lt;BR /&gt;neo.json&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;{
    "routes": [
	{
	  "path": "/destinations/javaApi",
	  "target": {
          "type": "destination",
          "name": "javaApi"
        },
          "description": "javaApi"
	}
    ]
}
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;manifest.json&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"dataSources": {
	"javaApi": {
		"uri": "/destinations/javaApi/",
		"type": "JSON"
			}
		}
}
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I have  tried to set CORS response headers in java api(remote system) and use jQuery ajax to get the JSON data. This successfully display data on SAPUI5. However, in this way I have only coming out setting absolute URL and encountering hard-coding issue you mentioned. So I am wondering if there is a better solution.&lt;BR /&gt;&lt;BR /&gt;Please let me know if I have misunderstood anything.&lt;BR /&gt;I really appreciate your kindly help.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Roan&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 02:51:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098048#M4519834</guid>
      <dc:creator>former_member57886</dc:creator>
      <dc:date>2019-11-14T02:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: consume data from java api to sapui5</title>
      <link>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098049#M4519835</link>
      <description>&lt;P&gt;Hi &lt;A href="https://answers.sap.com/users/871953/roan20190927.html"&gt;Yuning Roan&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Yes you can. Every app on SCP requires to be authentication. So, you need to use the destination with ApptoApp authentication.&lt;/P&gt;&lt;P&gt;You then have to create and use the JSON model in your SAPUI5 to call the destination.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Ivan&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 17:30:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098049#M4519835</guid>
      <dc:creator>Ivan-Mirisola</dc:creator>
      <dc:date>2019-11-18T17:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: consume data from java api to sapui5</title>
      <link>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098050#M4519836</link>
      <description>&lt;P&gt;Hi Yuning Roan, &lt;/P&gt;&lt;P&gt;could you please tell that java API is on internet or is it on premise API you are trying to consume to SAP UI5?&lt;/P&gt;&lt;P&gt;if Java API is on internet then it should not be difficult.&lt;/P&gt;&lt;P&gt;but if you are trying to consume On premise API to SAP UI5 then you need Cloud connector to expose the service first. for more details you can refer this blog.&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2019/11/15/rest-service-using-sap-cloud-connector-with-sap-cloud-platform/"&gt;rest-service-using-sap-cloud-connector-with-sap-cloud-platform/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankit Gupta&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 05:50:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098050#M4519836</guid>
      <dc:creator>ankit12</dc:creator>
      <dc:date>2019-11-19T05:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: consume data from java api to sapui5</title>
      <link>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098051#M4519837</link>
      <description>&lt;P&gt;Hi Ankit Gupta,&lt;BR /&gt;&lt;BR /&gt;Thank you for the instruction.&lt;BR /&gt;My java API is on the Internet.&lt;BR /&gt;However, I might consume on premise API  one day in the future so thank you for the information.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Yuning Roan&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 00:13:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098051#M4519837</guid>
      <dc:creator>former_member57886</dc:creator>
      <dc:date>2019-11-26T00:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: consume data from java api to sapui5</title>
      <link>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098052#M4519838</link>
      <description>&lt;P&gt;Hi Ivan,&lt;BR /&gt;&lt;BR /&gt;Let's say i need to get data from a public API but i don't need to expose the whole URL directly on javascript code in my app and also for security purposes because i won't use SCP, just on premise and the custom app into Fiori launchpad.&lt;BR /&gt;&lt;BR /&gt;In this case, is it possible to configure into neo-app.json and manifest.json and use it without SCP?&lt;BR /&gt;&lt;BR /&gt;BR,&lt;BR /&gt;&lt;BR /&gt;Maurício&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 23:02:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/consume-data-from-java-api-to-sapui5/qaa-p/12098052#M4519838</guid>
      <dc:creator>former_member273190</dc:creator>
      <dc:date>2020-04-29T23:02:40Z</dc:date>
    </item>
  </channel>
</rss>

