1 Reply Latest reply: Apr 8, 2013 10:48 AM by InoL RSS

    ACL Request failed when connecting to a webservice on Oracle test DB

    if*432782*e2
      I have the below function get_soap_request
      when I try to run it

      select to_clob(get_soap_request) from dual

      I get the below error.
      ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1130 ORA-24247: network access denied by access control list (ACL)

      I am using the oracle hosted workspaace.

      Will appreciate it anyone could help.


      Thanks,
      OLU

      ========================================================================================
      create or replace function get_soap_request return XMLType IS
      soap_request VARCHAR2(30000);
      soap_respond CLOB;
      http_req utl_http.req;
      http_resp utl_http.resp;
      resp XMLType;
      soap_err exception;
      v_code VARCHAR2(200);
      v_msg VARCHAR2(1800);
      v_len number;
      v_txt Varchar2(32767);
      BEGIN
      --UTL_HTTP.SET_PROXY(p_proxy);
      -- Define the SOAP request according the the definition of the web service being called
      soap_request:= '<?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soap.api.controller.web.payjar.com/" xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <SOAP-ENV:Header>
      <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken wsu:Id="UsernameToken-9" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <wsse:Username>Staging Integration Store 1</wsse:Username>
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">78cXrW1W</wsse:Password>
      </wsse:UsernameToken>
      </wsse:Security>
      </SOAP-ENV:Header>
      <SOAP-ENV:Body>
      <ns1:setTransaction>
      <Api>ONE_ZERO</Api>
      <Safekey>{45D5C765-16D2-45A4-8C41-8D6F84042F8C}</Safekey>
      <TransactionType>PAYMENT</TransactionType>
      <AdditionalInformation>
      <cancelUrl>https://www.payu.co.za/integration/demo/developer/payu-redirect-payment-page/cancel-page.php</cancelUrl>
      <merchantReference>1365058029</merchantReference>
      <returnUrl>https://www.payu.co.za/integration/demo/developer/payu-redirect-payment-page/send-getTransaction-via-soap.php</returnUrl>
      <supportedPaymentMethods>CREDITCARD</supportedPaymentMethods>
      </AdditionalInformation>
      <Customer>
      <email>john.doe@example.com</email>
      <firstName>John</firstName>
      <lastName>Doe</lastName>
      <merchantUserId>1365058029</merchantUserId>
      <mobile>27123456789</mobile>
      </Customer>
      <Basket>
      <amountInCents>2238</amountInCents>
      <currencyCode>ZAR</currencyCode>
      <description>Test Store Order: 1365058029</description>
      </Basket>
      </ns1:setTransaction>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>';


      http_req:= utl_http.begin_request
      ( 'http://staging.payu.co.za/service/PayUAPI'
      , 'POST'
      , 'HTTP/1.1'
      );
      utl_http.set_header(http_req, 'Content-Type', 'text/xml');
      utl_http.set_header(http_req, 'Content-Length', length(soap_request));
      utl_http.set_header(http_req, 'Download', ''); -- header requirements of particular web service
      utl_http.write_text(http_req, soap_request);
      http_resp:= utl_http.get_response(http_req);
      utl_http.get_header_by_name(http_resp, 'Content-Length', v_len, 1); -- Obtain the length of the response
      FOR i in 1..CEIL(v_len/32767) -- obtain response in 32K blocks just in case it is greater than 32K
      LOOP
      utl_http.read_text(http_resp, v_txt, case when i < CEIL(v_len/32767) then 32767 else mod(v_len,32767) end);
      soap_respond := soap_respond || v_txt; -- build up CLOB
      END LOOP;
      utl_http.end_response(http_resp);
      resp := XMLType.createXML(soap_respond); -- Convert CLOB to XMLTYPE

      return resp;
      END;
      ===========================================================================================