0 Replies Latest reply on Nov 22, 2018 11:12 AM by juliojgs

    Howto call a rest webservice with oauth2 from plsql 11g (I'm getting ORA-29259)

    juliojgs

      Hi!

      This is oracle 11.2.0.4.0

      Upgraded apex to 18.2.0.00.12

      Hi!

      I want to call a webservice from plsql (I'm quite new to this WS things)

      It's an azure api , swagger, whatever.

      The ws owners gave me an http url, tenantID, secret, userid and scope

       

      I can connect with the browser, and authorize with the userid , secret and scope.

       

      Then I try to replicate that from plsql, with this code:

       

      1. begin 
      2.     apex_web_service.oauth_authenticate( 
      3.         p_token_url     => 'https://********.azurewebsites.net/connect/token'
      4.         p_client_id     => '***'
      5.         p_client_secret => '4************************t'
      6.         p_wallet_path   => 'file:/oracle/product/11.2.0/dbhome_1/network/admin/mywallet'); 
      7. end

       

      But I'm getting an error ORA-29259

       

      Any idea on how to debug this?

       

      I tried from the command line from the same database server, with curl:

      curl -X POST -d 'grant_type=client_credentials&client_secret=4*******t&client_id=***' https://*******server.azurewebsites.net/connect/token

       

      And I got a response with the token, but from plsql I get this errors:

      ORA-29273: fallo de la solicitud HTTP

      ORA-06512: en "SYS.UTL_HTTP", línea 1130

      ORA-29259: se ha alcanzado el fin de entrada

      ORA-06512: en línea 38

      29273. 00000 -  "HTTP request failed"

      *Cause:    The UTL_HTTP package failed to execute the HTTP request.

      *Action:   Use get_detailed_sqlerrm to check the detailed error message.

                 Fix the error and retry the HTTP request.