Digital Assistant and Mobile

Get Involved. Join the Conversation.

Topic

    Krish K K
    Custom API
    Topic posted January 23, 2017 by Krish K KRed Ribbon: 250+ Points, last edited February 1, 2017 
    117 Views, 3 Comments
    Title:
    Custom API
    Summary:
    Custom API
    Content:

    Hello Experts,

    I am trying to use to expose the RestAPI for mobile application.

    I have created a connector with external Rest API which is deployed on JCS instance with an IP address format which is not secured for example : http://12.11.11.11/rest/service/accounts/   this we have included in connectors as a external API and also created an custom API.

    During testing it works fine with custom API and connectors using test end point but when we use the base URL and try to access on browser or postman client we get the below error

    GET https://xxxx.com/mobile/custom/TestConnectAPI/  401 (Authorization Required)

    in Custom API --security we have used anonymous option.

    Let me know what could be an issue?.

    Thanks

    Krish

    Comment

     

    • Chris Muir

      Assuming you are using HTTP basic authentication when making the call, when making external calls to Custom APIs that are marked as anonymous, you must still supply two HTTP headers:

      oracle-mobile-backend-id: <id from MBE settings page>

      Authorization: Basic <anonymous key from MBE settings page>

      As example:

      oracle-mobile-backend-id: 6e23de65-0326-483d-a520-ad1489415b1f

      Authorization: Basic RlVTSU9OQVBQTElFRF9NT0JJTEVERVZfTU9CSUxFX0FOT05ZTU9VU19BUFBJRDpTLmZrZ2g3cXlhdGU0Yg

      As such with the "Authorization" HTTP basic header for anonymous calls, MCS Custom APIs aren't truly "anonymous".  Rather they still require an anonymous user that MCS provides you on the MBE settings page.

      You can actually see this in the API test page within when you send a request anonymously.  Switch to the "Request" tab to see these two headers and what was sent.

      Thanks,

      CM.

    • Krish K K

      Thanks Chris,

      That helped and I am able to access.

      But I am facing other thing now we are accessing REST API which is exposed from APEX and which is using trial instance and it's not secured the RestAPI is in the format of https://x.x.x.x/ords/eapdb12/test/test1n/testdata (not domain name) and when I try to invoke the same in MCS Connector I get the below error  using MCS test end points ...

      Tried changing the secure origin allow in policies properties to allow but still not working..

      Is this because the above mentioned Rest API is not secured?.

        "o:errorDetails": [

          {

            "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",

            "title": "java.net.ProtocolException",

            "detail": "Unrecognized response from SSL proxy: 'HTTP/1.0 403 DefaultErrorTemplate'"

          }

      Thanks

      Krish

    • Chris Muir

      Hi Krish

      To be honest I'm not sure if the fact you're using an IP address rather than a domain name is the problem or a red herring.  Let's assume it's a red herring.

      What I do know:

      Relating to MCS vs ORDS connectivity, there is currently an issue where MCS's REST connectors rejects the ORDS HTTPS/TLS <v1.2 certificates for non-public/secured services.  MCS strictly wants v1.2 certificates which ORDS cannot currently supply.  You will find the following exception thrown in the MCS logs when you try to exercise the REST connector:

      Java.io.IOException: Connection closed, EOF detected

      at weblogic.socket.JSSEFilterImpl.handleUnwrapResults(JSSEFilterImpl.java:637)

      at weblogic.socket.JSSEFilterImpl.unwrapAndHandleResults(JSSEFilterImpl.java:515)

      at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:96)

      at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:75)

      at weblogic.socket.JSSESocket.startHandshake(JSSESocket.java:219)

      ...etc..

      The workaround for this is to turn HTTPS *off* on ORDS, or, make the services public, so MCS connects to ORDS via vanilla HTTP (non-secured) rather than HTTPS.  This can be done via the following steps:

      An upcoming version of MCS will allow MCS to be more flexible on the what HTTPS/TLS certificates versions MCS can accept.

      Regards,


      CM.