This discussion is archived
13 Replies Latest reply: Jan 14, 2013 8:51 PM by BillyVerreynne RSS

HTTP Error

user13653962 Newbie
Currently Being Moderated
SQL> show user
USER is "SYS"
SQL> declare
  2      vRequest      Utl_Http.req;
  3  begin
  4      vRequest := Utl_Http.begin_request(url=>'https://www.esendex.com',method=>'POST');
  5  end;
  6  /
declare
*
ERROR at line 1:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1029
ORA-12545: Connect failed because target host or object does not exist
ORA-06512: at line 4
Both package and procedure exist there.When i open this package at SQL Developer , i found the procedure in package specifiaction but do not find in Package body.

Heti

Edited by: user13653962 on 13/01/2013 17:01
  • 1. Re: HTTP Error
    damorgan Oracle ACE Director
    Currently Being Moderated
    And your Oracle version is?
    SELECT * FROM v$version;
    ... very relevant. Also try the demo here and report whether it works for you:
    http://www.morganslibrary.org/reference/pkgs/utl_http.html#http2
  • 2. Re: HTTP Error
    user13653962 Newbie
    Currently Being Moderated
    SQL> select * from v$version
      2  /
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    SQL> set serveroutput on
    SQL> 
    SQL> DECLARE
      2   req   utl_http.req;
      3   resp  utl_http.resp;
      4   value VARCHAR2(1024);
      5  BEGIN
      6    req := utl_http.begin_request('http://www.morganslibrary.org');
      7    utl_http.set_header(req, 'User-Agent', 'Mozilla/4.0');
      8    resp := utl_http.get_response(req);
      9    LOOP
     10      utl_http.read_line(resp, value, TRUE);
     11      dbms_output.put_line(value);
     12    END LOOP;
     13    utl_http.end_response(resp);
     14  EXCEPTION
     15    WHEN utl_http.end_of_body THEN
     16      utl_http.end_response(resp);
     17  END;
     18  /
    DECLARE
    *
    ERROR at line 1:
    ORA-12535: TNS:operation timed out
    ORA-06512: at "SYS.UTL_HTTP", line 1027
    ORA-06512: at line 6
  • 3. Re: HTTP Error
    damorgan Oracle ACE Director
    Currently Being Moderated
    Try this from your operating system command line in a terminal window.
    tracert www.morganslibrary.org
    post the results.
  • 4. Re: HTTP Error
    BillyVerreynne Oracle ACE
    Currently Being Moderated
    user13653962 wrote:

    vRequest := Utl_Http.begin_request(url=>'https://www.esendex.com',method=>'POST');

    ORA-12545: Connect failed because target host or object does not exist
    The error says that hostname www.esendex.com cannot resolve into an IPv4 address, or that this IP is not accessible.

    This db server platform running the code, needs Internet access. Typically this will be done via a proxy.

    If the db platform is directly connected to the Internet (not always the best of ideas due to security), then the local firewall must allow 80/tcp and 443/tcp outgoing connections, and the local IP stack must be configured for a DNS server able to resolve Internet hosts name.

    Also keep in mind that https requires you to download and add the target web server's certificate to an Oracle Wallet, and this wallet be opened for that https connection.
  • 5. Re: HTTP Error
    user13653962 Newbie
    Currently Being Moderated
    C:\Users\d681916>tracert www.morganslibrary.org
    Unable to resolve target system name www.morganslibrary.org.
  • 6. Re: HTTP Error
    user13653962 Newbie
    Currently Being Moderated
    This db server platform running the code, needs Internet access. Typically this will be done via a proxy.

    Also keep in mind that https requires you to download and add the target web server's certificate to an Oracle Wallet, and this wallet be opened for that https connection.

    how can i do it via proxy , should i ask to my network admin , if yes then what should i prove him to access this proxy cause they may ask why do i need it.

    I havent got yours 2nd point , i reckon it is something which i do not need if i get resolution of proxy server.

    Edited by: user13653962 on 13/01/2013 20:47
  • 7. Re: HTTP Error
    BillyVerreynne Oracle ACE
    Currently Being Moderated
    user13653962 wrote:

    how can i do it via proxy , should i ask to my network admin , if yes then what should i prove him to access this proxy cause they may ask why do i need it.
    Yes. Your netadmin should be able to provide you with web proxy access to the Internet. In that case, you use the proxy setting of UTL_HTTP to access Internet web servers via the web proxy.

    Sample code in {message:id=1925297} shows how to use a proxy via UTL_HTTP (with username and password, and without).
    I havent got yours 2nd point , i reckon it is something which i do not need if i get resolution of proxy server.
    The point is that server IPs are usually statically assigned. And that the DNS server configuration for hostname resolution (changing a hostname into a usable IPv4 address), may only be configured for the Intranet only.

    This means the server can resolve local hostnames (of your mail server, LDAP server, etc) to an IP address. But may not be able to resolve an Internet hostname to an IP address. In which case that server's configuration (the file +/etc/resolv.conf+ on Linux/Unix servers) needs to be updated and a DNS server added that provides Internet hostname resolution.

    But you reckon right - this is not needed for a proxy. With a proxy server configured, the local web browser (<i>UTL_HTTP</i> in your case) contacts the proxy server and passes the URL (HTTP GET/POST/PUT/etc command) to it. The proxy does the hostname resolution bit and contacts that Internet web server - after which it passes the response of that back to your web browser.
  • 8. Re: HTTP Error
    user13653962 Newbie
    Currently Being Moderated
    strange when i execute the same package using my home internet it worked..
  • 9. Re: HTTP Error
    BillyVerreynne Oracle ACE
    Currently Being Moderated
    user13653962 wrote:
    strange when i execute the same package using my home internet it worked..
    Nothing strange about it. You likely have an ADSL router of sorts?

    It establishes the ISP connection - and route your web requests to the Internet. It also handles Internet hostname resolution for your home LAN - using the DNS servers of your ISP. When it established its connection with your ISP, it received that, and other configuration data, needed for it to act as a router.
  • 10. Re: HTTP Error
    user13653962 Newbie
    Currently Being Moderated
    Thanks Billy..You have made my day , one last quick question , is there any free web services , i am sneding sms through Essendex 10 days free trial web services, i am lucky i have got a chance to get yours proper guidance , this testing commissioned by me as an initiative and before embarking this project on live i wana sure how much its gonna cost to us and what are the benefits we can get in return.If there is no any free web services then from where i can get list price of web services , isnt there any way to fake out the web services :).

    Edited by: user13653962 on 14/01/2013 15:19
  • 11. Re: HTTP Error
    damorgan Oracle ACE Director
    Currently Being Moderated
    It appears you have a network connectivity issue ... get your network admins involved.
  • 12. Re: HTTP Error
    user13653962 Newbie
    Currently Being Moderated
    thanks daniel , in the truest sense it is an issue of only network connectivity like proxy authentication , if it resolved then i do not require any web services to send sms through database?
  • 13. Re: HTTP Error
    BillyVerreynne Oracle ACE
    Currently Being Moderated
    user13653962 wrote:
    one last quick question , is there any free web services , i am sneding sms through Essendex 10 days free trial web services,
    Have never used web services for sending SMS - and if I did, I'm not in your part of the world and local web services will be of no use to you. We use standard TCP for sending SMS. But then we also work for a telecoms company that has its own mobile network. :-)

    I suggest contacting a specific mobile network company directly and enquiring about a SMS service. Companies that resells that as a web service charge extra for their profit margins.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points