Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1EF6218C18 for ; Thu, 8 Oct 2015 17:06:48 +0000 (UTC) Received: (qmail 34760 invoked by uid 500); 8 Oct 2015 17:06:43 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 34699 invoked by uid 500); 8 Oct 2015 17:06:42 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 34688 invoked by uid 99); 8 Oct 2015 17:06:42 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Oct 2015 17:06:42 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 520531A0846 for ; Thu, 8 Oct 2015 17:06:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1 X-Spam-Level: * X-Spam-Status: No, score=1 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id WXpyD8f6Ibvu for ; Thu, 8 Oct 2015 17:06:38 +0000 (UTC) Received: from h1611079.stratoserver.net (h1611079.stratoserver.net [81.169.162.220]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 3A98D23268 for ; Thu, 8 Oct 2015 17:06:37 +0000 (UTC) Received: from [192.168.178.20] (dslb-178-009-250-156.178.009.pools.vodafone-ip.de [178.9.250.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by h1611079.stratoserver.net (Postfix) with ESMTPSA id 3D67B4948016 for ; Thu, 8 Oct 2015 19:06:28 +0200 (CEST) Subject: Re: Apache Giving HTTP 505 Error While Contacting it through Oracle database To: users@tomcat.apache.org References: From: Felix Schumacher Message-ID: <5616A292.1000900@internetallee.de> Date: Thu, 8 Oct 2015 19:06:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Am 08.10.2015 um 10:38 schrieb Ankur Gupta: > This is my SMS sending procedure where mobile number and body of msg is > passed. > > Then concatenating all these values a URL is formed . > > URL hit to apache server where .jsp page is made to send SMS via third > vendor. > > This apache server is just a mediator between database and third vendor > > Problem is that when the same URL is accessed through browser then page > runs but when same thing is accessed by the procedure then > *DBMS_OUTPUT.PUT_LINE*('HTTP response status CODE: ' || resp.status_code); > gives ‘505’ error and UTL_HTTP.READ_TEXT(resp,v_msg,null); > > Gives end of body reached. So you are basically asking, how to connect from your pl/sql procedure within oracle to tomcat via a proxy? I have never done such a thing, but I would look at a few things. Do the requests reach tomcat at all? If so, are there any errors logged? Can you find the requests in your proxy logs? And since http status 505 points to a http-version mismatch, I would try to omit it from BEGIN_REQUEST (defaults to null). Regards, Felix > > > > Ex of url :- > http://10.xxx.xx.xx:xxxx/examples/trysms.jsp?mobileNumber=99xxxxxxxx&message=HELLO > > WORLD > > > > CREATE OR REPLACE Procedure CHANNELG.SMS_headers_V1 > > ( > > mob in varchar2, > > msgg in varchar2 > > ) > > AS > > req UTL_HTTP.REQ; > > resp UTL_HTTP.RESP; > > name varchar2(256); > > value varchar2(5000); > > value1 varchar2(1024); > > v_msg varchar2(32767); > > output_table *DBMS_OUTPUT.CHARARR*; > > num_lines number := 500; > > URL varchar2(500):='http://10.xxx.xx.xx:xxxx > /examples/xxxx.jsp?mobileNumber='||mob||'&message='||msgg; > > l_clob clob; > > id number; > > BEGIN > > select nvl(max(ID),0)+1 into id from SMS_STATUS; > > insert into SMS_STATUS(ID,MOBILE_NUMBER,SENT_STATUS) values(id,mob,'Y' > ); > > *DBMS_LOB.CREATETEMPORARY*(l_clob,false); > > UTL_HTTP.SET_PROXY('http://10.xxx.xx.xx:xxxx); > > req := UTL_HTTP.BEGIN_REQUEST(URL,'POST','HTTP/1.1'); > > > *--UTL_HTTP.SET_HEADER(req,'Content-Type','text/html;charset=ISO-8859-1');* > > UTL_HTTP.SET_HEADER(req,'User-Agent', 'Mozilla/4.76'); > > UTL_HTTP.SET_HEADER(req,'Content-Length','0'); > > resp:= UTL_HTTP.GET_RESPONSE(req); > > *DBMS_OUTPUT.PUT_LINE*('HTTP response status CODE: ' || resp.status_code > ); > > *DBMS_OUTPUT.PUT_LINE*('HTTP RESPONSE reason Pharse: ' || resp. > reason_phrase); > > for i in 1..UTL_HTTP.GET_HEADER_COUNT(resp) > > LOOP > > UTL_HTTP.GET_HEADER(resp,i,name,value); > > *DBMS_OUTPUT.PUT_LINE*(name || ':' || value); > > END LOOP; > > UTL_HTTP.READ_TEXT(resp,v_msg,null); > > *DBMS_OUTPUT.PUT_LINE*('v_msg-' || v_msg); > > *DBMS_LOB.WRITEAPPEND*(l_clob,length(v_msg),v_msg); > > *DBMS_OUTPUT.GET_LINES*(output_table,num_lines); > > DELETE FROM CLOB_TEST; > > insert into clob_test values(l_clob); > > select regexp_substr(substr(data,108,35),'[^,]+',1,3) INTO value1 from > clob_test; > > update SMS_STATUS set DELIVERY_STATUS= value1 where ID=id and mobile_number > = mob ; > > *--DBMS_OUTPUT.PUT_LINE('LENGTH OF MSG ' || length(v_msg));* > > *--value1 := UTL_HTTP.REQUEST(URL);* > > *--DBMS_OUTPUT.PUT_LINE('value' || value1);* > > UTL_HTTP.END_RESPONSE(resp); > > END; > > / > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org