Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Differences Between UTL_HTTP on 10g and XE11g

PaulGall123Oct 29 2014 — edited Oct 29 2014

Hello,

I am currently trying to consume a webservice from one of our providers and I am running into a problem. The PL/SQL to consume the webservice is:

FUNCTION do_interlink_login

RETURN VARCHAR2

IS

  --

  lv_token_key              VARCHAR2(256 CHAR);

  lv_certificate            VARCHAR2(256 CHAR);

  lv_respond                VARCHAR2(31500);

  lv_db_name                VARCHAR2(32 CHAR);

  lv_action                 VARCHAR2(256 CHAR) := 'action=login';

  lv_http_req               utl_http.req;

  lv_http_resp              utl_http.resp;

  --

BEGIN

  --

  lv_certificate := get_db_certificate;

  utl_http.set_wallet('file:D:\oracle_wallet\', 'WalletPasswd123'); 

  --Make a connection to the webserver and start the request.

  lv_http_req := utl_http.begin_request(

      url => 'https://api.interlinkexpress.com/user/?action=login'     

    , method => 'POST'

    , http_version => 'HTTP/1.1'

  );

  --Authenticate yourself

  utl_http.set_authentication(lv_http_req

    , gv_interlink_user

    , gv_interlink_pass

  );

  --Now setup the rest of the http headers.

  utl_http.set_header(lv_http_req, 'Accept', 'application/json');  

  utl_http.set_header(lv_http_req, 'Content-Type', 'application/json');

  utl_http.set_header(lv_http_req, 'Content-Length', 0);

  utl_http.set_header(lv_http_req, 'GEOClient', 'account/1901548'); 

  utl_http.set_header(lv_http_req, 'Cache-Control', 'no-cache');

  --We will write the URL parameters

  --utl_http.write_text(lv_http_req, lv_action);

  --Get the response from the server

  lv_http_resp:= utl_http.get_response(lv_http_req);

  DBMS_OUTPUT.PUT_LINE('HTTP response status code: ' || lv_http_resp.status_code);

  DBMS_OUTPUT.PUT_LINE('HTTP response reason phrase: ' || lv_http_resp.reason_phrase);

  --Get the actual response from interlink

  utl_http.read_text(lv_http_resp, lv_respond);

  --Now we will close the http call.

  utl_http.end_response(lv_http_resp);

  INSERT INTO FM_DEBUG(OPERATION, OP_DATE, DEBUG_CLOB)

  VALUES('Getting the login token from interlink', SYSDATE, lv_respond);

  COMMIT;

  RETURN lv_respond;

  --

END do_interlink_login;

When I run this code on my local XE 11g database I get the response I am expecting as I get a json object returned from the webservice but when I execute the same code on our 10g test instance I am always getting the http response of 404, page not found.

The Oracle Wallets on each database contain the same ssl certificates and the only difference that I did on the XE instance is I created an ACL. I have pinged the webserver from our 10g database server and it always return a reply.

I am at a bit of a loss on this one and I hoping somebody might have had the same issue on this or the same experience.

Cheers,

Paul.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 26 2014
Added on Oct 29 2014
0 comments
603 views