4 Replies Latest reply: Feb 4, 2014 7:02 AM by AnnPricks E RSS

    Provlems with UTL_HTTP on Oracle 11 XE

    Jevgenij

      Hey guys. I have one big trouble. I want to send request to web service on Central Bank of Lithuania  (url LB XML Web Services) per utl_hhtp. Oracle is showing error

       

      Error report -

      ORA-06550: line 4, column 22:

      PLS-00201: identifier 'UTL_HTTP' must be declared

      ORA-06550: line 4, column 22:

      PL/SQL: Item ignored

      ORA-06550: line 5, column 22:

      PLS-00201: identifier 'UTL_HTTP' must be declared

       

       

      Though I set privilege on ACL to SYSTEM for all lithuanian web sites:

       

      BEGIN

        DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'cbl.xml',

        description => 'Central Bank of Lithuania ACL',

        principal => 'SYSTEM',

        is_grant => true,

        privilege => 'connect');

       

      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'cbl.xml',

        principal => 'SYSTEM',

        is_grant => true,

        privilege => 'resolve');

       

        DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'cbl.xml',

        host => '*lt');

      END;

      /

      COMMIT;

       

      Here is my code:

       

      DECLARE

       

       

      soap_request   CLOB;

            http_req       UTL_HTTP.REQ;

            http_resp      UTL_HTTP.RESP;

            l_detail       CLOB;

            strData  varchar2(4000);

         BEGIN

              DBMS_OUTPUT.enable;

              soap_request :='<?xml version="1.0" encoding="utf-8"?>'

                    ||'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'

                    ||'<soap:Body>'

                    ||'<getListOfCurrencies xmlns="http://webservices.lb.lt/ExchangeRates" />'

                    ||'</soap:Body>'

                    ||'</soap:Envelope>';    

               http_req := utl_http.begin_request('http://webservices.lb.lt/', '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, 'SOAPAction', '"http://webservices.lb.lt/ExchangeRates/getListOfCurrencies"');

               utl_http.write_text(http_req, soap_request);

               http_resp := UTL_HTTP.get_response (http_req);

              

               utl_http.read_line(http_resp, strData, TRUE);

               dbms_output.put_line(strData);

               utl_http.end_request(http_req);

               END;

       

      I use Oracle 11 XE and Windows Server 2008

       

      Guys, please, help me, cos I few days searched my mistakes, looked at forums and I don't know where is my mistake.