Forum Stats

  • 3,780,752 Users
  • 2,254,432 Discussions
  • 7,879,434 Comments

Discussions

Calling an external REST API via an ADF REST DataControl

Timo Hahn
Timo Hahn Senior Principal Technical Consultant - Oracle ACE DirectorMember, Moderator Posts: 37,768 Red Diamond
edited Apr 3, 2017 8:18AM in Java Cloud Service

Hi,

I'm using JDev 12.2.1.2.0 and created a small sample which uses an external REST service (e.g. api.spotify.com) to get some data from the service. A REST DataControl in then build from this REST service. Running the application on the integrated wls and/or a stand alone WLS 12.2.1.2 returns the right data. When I run the application on the JCS instance  the REST calls are not working. All I get in hte logs is

Exception in invoking HTTP method GET from Rest data control. Cause: javax.ws.rs.ProcessingException: java.net.ConnectException: Tried all: 3 addresses, but could not connect over HTTPS to server: api.spotify.com port: 443

It looks like calling an external REST service is not allowed. The whole REST call looke like

https://api.spotify.com/v1/search?q=sorry&type=track

and work perfectly, meaning that it return data.

Is there any configuration needed on the JCS?

Timo

Update: I tried some other things and got another piece of information. I logged into the server as OPC user and used curl to get to the address and got

pastedImage_0.png

Not even a root the url is reachable. So it look like accessing external urls is blocked somehow. Doing the same from the DBCS works without a problem. Using the same curl command I get the right JSON response.

Manish Kapur-Oracle

Best Answer

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,768 Red Diamond
    edited Apr 3, 2017 8:17AM Accepted Answer

    OK, I found a solution, however I'm not sure if this is the best way to handle this.

    First you have to create a 'Security List' Which you name e.g. outbound_wlsms_https_traffic which denies incoming packages and allows outgoing packages

    pastedImage_0.png

    Next a 'Security Rule' can be created like

    pastedImage_1.png

    with source set as the managed server and destination the new security list.

    After that hte access to the external REST API works.

    Timo

    Manish Kapur-Oracle

Answers

  • Manish Kapur-Oracle
    Manish Kapur-Oracle Member Posts: 73 Employee
    edited Mar 30, 2017 7:40PM

    Hi Timo, This sounds like an issue with access rules configuration. Can you check the access rules? Here are the docs for reference.

    Timo Hahn
  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,768 Red Diamond
    edited Mar 31, 2017 3:09AM

    Well, that's what I thought too, but looking at the rules and the doc I can't write a rule with destination PUBLIC_INTERNET as this destination isn't available.

    OTD — The Oracle Traffic Director load balancer VMsWLS_ADMIN_SERVER — The WebLogic Server Administration Server VMWLS_MANAGED_SERVER — The WebLogic Server Managed Server VMs

    These are the available destinations. So, if it's a rule problem, how should the rule be written?

    By the way, why can the DBCS access REST resources in the public internet?

    The rules defined for DBCS are looking the same way as they are defined for JCS.

    Timo

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,768 Red Diamond
    edited Apr 3, 2017 8:17AM Accepted Answer

    OK, I found a solution, however I'm not sure if this is the best way to handle this.

    First you have to create a 'Security List' Which you name e.g. outbound_wlsms_https_traffic which denies incoming packages and allows outgoing packages

    pastedImage_0.png

    Next a 'Security Rule' can be created like

    pastedImage_1.png

    with source set as the managed server and destination the new security list.

    After that hte access to the external REST API works.

    Timo

    Manish Kapur-Oracle
This discussion has been closed.