Post HTTP request
Hello world
I'm new with labview webservices and I must realize a communication between a java application and a Web service of labview. The goal is to send a text, and save it with the webservice.
I tried something for the webservice part, it seems that I managed to deploy but I can't extract any text. I join my "post.vi".
To test, I used a form http:
Thanks in advance for any advice you give me
OK, so I finally solve my problem.
If it helps, here is the solution. It seems that the label of entry for httpRequestID only accept "httpRequestID", not 2 or something else. Mistake of beginners, but we are all learning.
To make it work now.
Tags: NI Software
Similar Questions
-
How to send a document in net. HTTP.request as a POST variable?
I have read and reread the doc on the net. HTTP.request and he says I can pass an argument to oRequest, but I failed to pass in the current document, which is what I want to do.
I tried app.activeDocs [0], or the encoding of a string, but if he makes the call with no error, nothing is sent.
ORequest must be a single document, or a variable consisting of name-value pairs? How to send multiple parameters to a POSITION otherwise?
I did very well with the call using GET, but when I tried to send the document as a GET variable, I did nothing either.
I send to an end point of LiveCycle REST so either POST or GET is fine.
Thank you!
Validating the document current is simple * provided * your script runs outside the context of the document (i.e. in the console or a script to the folder level). There is no access to scripts of doc-level for obvious reasons.
For example, put this in the console JS OCCURS the current file to a URL:
Net.HTTP.request ({}
cVerb: 'POST',
cURL: "http://localhost/submit.php."
oRequest: Collab.documentToStream (this);
oHandler: {}
answer: function (msg, uri, err) {}
If (err! = undefined) app.alert (msg);
}
}
});
Your problem talking to a vanilla Web service, is that you can send the RFC1867 delimiters (i.e. the form apply for "multipart/form-data") that the ReadStream object is not a method of concatenation in the JSAPI Acrobat. It's also how you would usually precede other fields in the form, but if you are careful with your codes side server that you can send to save them as GET parameters in cURL. Normally, you'd be polite and passed a context of Type in the table of aHeaders header - it won't matter for the transmission process, but will allow your webservice predict what that heck he was sent.
Your webservice will then read the raw data. PHP for example, you will get nothing in the $_FILES global, but you can grab the PDF by reading all of the input buffer, with the line:
$pdf = file_get_contents() ("php://input");
If this line was in the server script which was the JS code above, the variable $pdf will contain an exact binary copy of the currently opened document.
-
Trying to prevent the firewall to respond to Https requests
Current configuration
-2 x ASA 5505 firewall, running 9.0.4; ASDM 7.1; Active mode / standby
-With the help of Anyconnect v3.0.3054
-VPN using IPSec only; SSL access is disabled.
-Anyconnect manually installed on laptops.
-Web portal Shutdown and the browser not found poster
-Clientless SSL VPN is disabled.
Here's my problem: (this problem is causing my external PCI analysis to failure, it is a failure because the https site use ssl3.0 or TLS 1.0)
1. from an external PC, I open any browser and go to the IP address of my firewall (e.g. https://8.8.8.8)
2. the browser gives a warning about an untrusted certificate.
3. If I click on continue, then the browser tries to go to the Web portal connection but then shows the "Cannot display Page" page
What I'm trying to do is to stop the firewall to respond to HTTPS requests to the address of WAN IP in the firewall; If I do step 1 of my problem, I want the browser timeout due to no response from the firewall.
After reading the manuals of the admin and research on this problem, I hit a wall.
Thank you
VPN IPSec (IKEv2) remote access requires the use of SSL for the creation of the first session. As much as I know there is no way to avoid. You should explain to your listener that this is necessary and that the absence of other services on this interface is a control to compensate for the use of SSL.
Sent by Cisco Support technique iPad App
-
I have tried the code
DECLARE
lv_url VARCHAR2 (1000): = ' http://shenzhoufellowship.org/main2/files/old/SpecialTopics/TheLoveDare.pdf';
lc_return BLOB;
lhttp_url httpuritype.
Varriables - declared to have written the LOB to pdf file-
l_file UTL_FILE. TYPE_DE_FICHIER;
l_buffer RAW (32767).
l_amount directory: = 32767;
l_pos INTEGER: = 1;
l_blob BLOB;
l_blob_len INTEGER.
BEGIN
-create URIs
lhttp_url: = httpuritype.createuri (lv_url);
-get the PDF document
lc_return: = lhttp_url.getblob ();
-Open the destination file.
l_file: = UTL_FILE. FOPEN ('MBO_INPUT_DIR', 'MBD.zip', 'wb');
-Get the total length of the BLOB
l_blob_len: = DBMS_LOB.getlength (lc_return);
-Pieces of the BLOB to read and write to the file
-full up.
While l_pos < l_blob_len LOOP
DBMS_LOB. READ (lc_return, l_amount, l_pos, l_buffer);
UTL_FILE.put_raw (l_file, l_buffer, FALSE);
l_pos: = l_pos + l_amount;
END LOOP;
-Closes the file.
UTL_FILE. FCLOSE (l_file);
EXCEPTION
WHILE OTHERS THEN
-Close the file if something goes wrong.
IF UTL_FILE.IS_OPEN (l_file) THEN
UTL_FILE. FCLOSE (l_file);
END IF;
LIFT;
END;
But make a mistake like:
Error report-
ORA-29273: HTTP request failed
ORA-06512: at "SYS." UTL_HTTP", line 1130
ORA-12535: TNS:operation expired
ORA-06512: at line 37 level
29273 00000 - "the HTTP request failed.
* Cause: The UTL_HTTP package cannot run the HTTP request.
* Action: Use get_detailed_sqlerrm to check the detailed error message.
Correct the error and restart the HTTP request.
Please suggest a solution. Is it possible to download a zip file with the same code?
[oracle@localhost ~]$ sqlplus scott/tiger SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 6 13:59:09 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> --My Database version SQL> ---------------------- SQL> SELECT * FROM v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for Linux: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production SQL> ed Wrote file afiedt.buf 1 DECLARE 2 lv_url VARCHAR2(500) := 'http://shenzhoufellowship.org/main2/files/old/SpecialTopics/TheLoveDare.pdf'; 3 lc_return BLOB; 4 lhttp_url httpuritype; 5 ---Varriables declared for writing the LOB to pdf file -- 6 l_file UTL_FILE.FILE_TYPE; 7 l_buffer RAW(32767); 8 l_amount BINARY_INTEGER := 32767; 9 l_pos INTEGER := 1; 10 l_blob BLOB; 11 l_blob_len INTEGER; 12 BEGIN 13 --create uri 14 lhttp_url := httpuritype.createuri(lv_url); 15 --get the PDF document 16 lc_return := lhttp_url.getblob(); 17 -- Open the destination file. 18 l_file := UTL_FILE.FOPEN('SAUBHIK', 'TheLoveDare.pdf', 'wb'); 19 --Get the total length of the BLOB 20 l_blob_len := DBMS_LOB.getlength(lc_return); 21 -- Read chunks of the BLOB and write them to the file 22 -- until complete. 23 WHILE l_pos < l_blob_len LOOP 24 DBMS_LOB.READ(lc_return, l_amount, l_pos, l_buffer); 25 UTL_FILE.put_raw(l_file, l_buffer, FALSE); 26 l_pos := l_pos + l_amount; 27 END LOOP; 28 -- Close the file. 29 UTL_FILE.FCLOSE(l_file); 30 EXCEPTION 31 WHEN OTHERS THEN 32 -- Close the file if something goes wrong. 33 IF UTL_FILE.IS_OPEN(l_file) THEN 34 UTL_FILE.FCLOSE(l_file); 35 END IF; 36 RAISE; 37* END; 38 / DECLARE * ERROR at line 1: ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1130 ORA-24247: network access denied by access control list (ACL) ORA-06512: at line 36 SQL> conn sys as sysdba Enter password: Connected. SQL> ed Wrote file afiedt.buf 1 BEGIN 2 DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'love.xml', 3 description => 'Love ACL', 4 principal => 'SCOTT', 5 is_grant => true, 6 privilege => 'connect'); 7 DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'love.xml', 8 principal => 'SCOTT', 9 is_grant => true, 10 privilege => 'resolve'); 11 DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'love.xml', 12 host => 'shenzhoufellowship.org'); 13 commit; 14* END; 15 / PL/SQL procedure successfully completed. SQL> conn scott/tiger Connected. SQL> ed Wrote file afiedt.buf 1 DECLARE 2 lv_url VARCHAR2(500) := 'http://shenzhoufellowship.org/main2/files/old/SpecialTopics/TheLoveDare.pdf'; 3 lc_return BLOB; 4 lhttp_url httpuritype; 5 ---Varriables declared for writing the LOB to pdf file -- 6 l_file UTL_FILE.FILE_TYPE; 7 l_buffer RAW(32767); 8 l_amount BINARY_INTEGER := 32767; 9 l_pos INTEGER := 1; 10 l_blob BLOB; 11 l_blob_len INTEGER; 12 BEGIN 13 --create uri 14 lhttp_url := httpuritype.createuri(lv_url); 15 --get the PDF document 16 lc_return := lhttp_url.getblob(); 17 -- Open the destination file. 18 l_file := UTL_FILE.FOPEN('SAUBHIK', 'TheLoveDare.pdf', 'wb'); 19 --Get the total length of the BLOB 20 l_blob_len := DBMS_LOB.getlength(lc_return); 21 -- Read chunks of the BLOB and write them to the file 22 -- until complete. 23 WHILE l_pos < l_blob_len LOOP 24 DBMS_LOB.READ(lc_return, l_amount, l_pos, l_buffer); 25 UTL_FILE.put_raw(l_file, l_buffer, FALSE); 26 l_pos := l_pos + l_amount; 27 END LOOP; 28 -- Close the file. 29 UTL_FILE.FCLOSE(l_file); 30 EXCEPTION 31 WHEN OTHERS THEN 32 -- Close the file if something goes wrong. 33 IF UTL_FILE.IS_OPEN(l_file) THEN 34 UTL_FILE.FCLOSE(l_file); 35 END IF; 36 RAISE; 37* END; 38 / PL/SQL procedure successfully completed. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@localhost ~]$ cd saubhik/ [oracle@localhost saubhik]$ pwd /home/oracle/saubhik [oracle@localhost saubhik]$ ls -l *.pdf -rw-r--r-- 1 oracle oinstall 60055 Apr 6 14:03 TheLoveDare.pdf [oracle@localhost saubhik]$
I love this pdf file. I would like to read this and mean while if you get an error then please post in its entirety and also think that it is an Oracle error or network.
-
Retrieve the XML via an HTTP request
Hello
What would be the most effective way to recover the large XML from Oracle (gr 11, 2) via a HTTP request?
XML is generated during execution in a stored procedure with either XML SQL statements as
or other methods asselect xmlelement("text", 'Hello world') from dual;
I'm sure I'll be using embedded PL/SQL gateway as an HTTP server, and I can easily manage small XMLs that fit into a VARCHAR2 with a following procedure:select DBMS_XMLGEN.GETXML ('select ''Hello world'' text from dual') from dual;
Then I she would recover via http:// < hostname >: < port > / < DAD > /HelloWorldPROCEDURE HelloWorld AS xml xmltype; BEGIN select xmlelement("text", 'Hello world') into xml from dual; owa_util.mime_header('text/xml'); htp.print(xml.getstringval); END;
But I do not know how to handle large (several MB) XMLs.
I couldn't find anything useful within OWA * or HTP packages and splitting of the CLOB in chunks of 32 K seems inefficient and a little ugly to me.
Any suggestions?
With respect,
GoranHi Goran,
See this post for a similar situation, it isn't that bad to see: {message identifier: = 10619251}
Alternatively, you can use Native database Webservice to display the result of the query, and then pull it out via the HTTP protocol.
-
I have an Acrobat only plugin, developed in 2005 VS. Originally with Acrobat 7 SDK, now updated to use Acrobat 9 SDK. The ultimate goal of this feature is to open a PDF file from a web server Agile: If a user string, a URL is created, a request sent to the URL, then pay back the answer. The answer can be either the PDF itself or a string path to the PDF file. I thought it would be easier to use the version of PDF path to simply open the new PDF of the http:// address.
I created a folder level javascript with a call to Net.HTTP.request confidence. I have a script that works when invoked from a menu item added by the folder level javascript file. But when you use this same command in my C++ with AFExecuteThisScript code, I can't get the HTTP response to finish pending in the code for the result.
The Net.HTTP.request and the asynchronous callbacks confuse me, so maybe that's my big problem. I could not Net.HTTP.request to return a value in a service simple javascript right now, I'm trying to use a "global" variable in the JavaScript folder level and two calls. The first call "sets" the global variable, the other "becomes" it. But this seems to be the issue. When I have my code debugging or stop execution, the part of the response of the Net.HTTP.request is never called. But when I left to go beyond this step with error recovery, the answer appears later.
So how kick off of the Net.HTTP.request and be notified when it's over? either in JavaScript or VC ++?
Any help is appreciated. Even if the best option is to stream the file from the web server to a local file and then open the (this is the option that I take in another tool that runs outside of Acrobat).
Here's the code.
Javascript controls at the level of the files (urls truncated for the post)
var THE_PATH = ''; function setTHE_PATH ( gURL ) { console.println('setTHE_PATH Begin'); var params = { cVerb: 'GET', cURL: gURL, oHandler: { response: function( msg, uri, e) { console.println('response method: Setting Path'); THE_PATH = SOAP.stringFromStream( msg ); console.println('<<' + THE_PATH + '>>'); } } }; console.println('URL: ' + params.cURL + '\n oHandler: ' + params.oHandler ); console.println('Path: ' + THE_PATH ); var netResult = trustedNetHTTPrequest(params); console.println('setTHE_PATH End'); return THE_PATH; }; trustedNetHTTPrequest = app.trustedFunction( function ( params ) { console.println('trustedNetHTTPrequest begin'); app.beginPriv(); var netResult = Net.HTTP.request( params ); app.endPriv(); console.println('trustedNetHTTPrequest end'); return netResult; } );
Added MenuItems with JavaScript at the folder level
app.addMenuItem( { cName: "mysetTHE_PATH", cUser: "set THE_PATH", cParent: "Tools", cExec: "setTHE_PATH('http://......&getURL=true');", nPos: 0 } ); app.addMenuItem( { cName: "mygetTHE_PATH", cUser: "get THE_PATH", cParent: "Tools", cExec: "console.println( THE_PATH );", nPos: 0 } );
Here's the JavaScript Console output when you run these two commands:
setTHE_PATH Begin URL: http://......&getURL=true oHandler: [object Object] Path: trustedNetHTTPrequest begin trustedNetHTTPrequest end setTHE_PATH End response method: Setting Path <<https://......DesiredFilename.pdf>>
Here is the function in the plugin C++, with additional measures to prove AFExecuteThisScript works here
sprintf(jsScript, "testVal='%s';event.value = testVal;", strURL.c_str() ); AFExecuteThisScript( aPdDoc, jsScript, &pReturnValue ); // After this, pReturnValue is the passed-in URL, as expected. sprintf(jsScript, "setTHE_PATH('%s');event.value = 'Step 1 Worked!!';", strURL.c_str() ); AFExecuteThisScript( aPdDoc, jsScript, &pReturnValue ); // After this, pReturnValue is 'Step 1 Worked!!', as expected. sprintf(jsScript, "event.value = THE_PATH;", strURL.c_str() ); AFExecuteThisScript( aPdDoc, jsScript, &pReturnValue ); // After this, pReturnValue is NULL
This is the JavaScript Console output when you run the commands using the plugin (mode debugger, to wait after step 1)
setTHE_PATH Begin URL: http://......&getURL=true oHandler: [object Object] Path: trustedNetHTTPrequest begin trustedNetHTTPrequest end setTHE_PATH End
Note that he never gets to the part of the "method of response.
Thank you!
Tim James
You need not limit yourself to the plugin API. The requests HTTP from C/C++ is a fairly common condition, just observe the restrictions in my answer.
-
Hello
Can I make a post HTTP of a document XML directly to the XML DB basically? Or I have to use a servlet as a listener.
Thanks in advance!Here is an example of using a Servlet to handle a PUT option
SQL> spool testcase.log SQL> -- SQL> connect sys/oracle as sysdba Connected. SQL> -- SQL> set define on SQL> set timing on SQL> -- SQL> def USERNAME = SERVLET SQL> -- SQL> def PASSWORD = &USERNAME SQL> -- SQL> -- def XMLDIR = &1 SQL> -- SQL> def USER_TABLESPACE = USERS SQL> -- SQL> def TEMP_TABLESPACE = TEMP SQL> -- SQL> drop user &USERNAME cascade 2 / old 1: drop user &USERNAME cascade new 1: drop user SERVLET cascade User dropped. Elapsed: 00:00:00.29 SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD 2 / old 1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD new 1: grant create any directory, drop any directory, connect, resource, alter session, create view to SERVLET identified by SERVLET Grant succeeded. Elapsed: 00:00:00.03 SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE 2 / old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE new 1: alter user SERVLET default tablespace USERS temporary tablespace TEMP User altered. Elapsed: 00:00:00.01 SQL> /* SQL> ** SQL> ** 11.1.x only SQL> ** SQL> ** call DBMS_XDB.DELETESERVLET(NAME => 'sample') SQL> ** / SQL> ** call DBMS_XDB.DELETESERVLETMAPPING(NAME => 'sample') SQL> ** / SQL> ** call DBMS_XDB.DELETESERVLETSECROLE(SERVNAME => 'sample', ROLENAME => 'anonymousServletRole' ) SQL> ** / SQL> ** call DBMS_XDB.ADDSERVLETMAPPING(PATTERN => '/sys/servlets/&USERNAME/sample/*', NAME => 'sample') SQL> ** / SQL> ** call DBMS_XDB.ADDSERVLET SQL> ** ( SQL> ** NAME => 'sample', SQL> ** LANGUAGE => 'Java', SQL> ** DISPNAME => 'Sample Servlet', SQL> ** DESCRIPT => 'Sample Servlet', SQL> ** SCHEMA => '&USERNAME', SQL> ** CLASS => 'com.oracle.st.xdb.pm.examples.servlets.SampleServlet' SQL> ** ) SQL> ** / SQL> ** call DBMS_XDB.ADDSERVLETSECROLE SQL> ** ( SQL> ** SERVNAME => 'sample', SQL> ** ROLENAME => 'anonymousServletRole', SQL> ** ROLELINK => 'anonymousServletRole' SQL> ** ) SQL> ** / SQL> ** SQL> */ SQL> call xdb_configuration.addServletMapping 2 ( 3 '/sys/servlets/&USERNAME/sample/*', 4 'Sample Servlet', 5 'Sample Servlet', 6 'com.oracle.st.xdb.pm.examples.servlets.SampleServlet', 7 '&USERNAME', 8 'Java', 9 null, 10 xmltype('
11 ) 12 / old 3: '/sys/servlets/&USERNAME/sample/*', new 3: '/sys/servlets/SERVLET/sample/*', old 7: '&USERNAME', new 7: 'SERVLET', Call completed. Elapsed: 00:00:00.09 SQL> connect &USERNAME/&PASSWORD Connected. SQL> -- SQL> VAR JAVA_SOURCE CLOB SQL> VAR JAVA_SOURCE_PATH VARCHAR2(700); SQL> -- SQL> begin 2 :JAVA_SOURCE_PATH := '/public/SampleServlet.java'; 3 :JAVA_SOURCE := 4 'package com.oracle.st.xdb.pm.examples.servlets; 5 6 import java.io.IOException; 7 import java.io.OutputStreamWriter; 8 import java.io.Reader; 9 import java.io.StringReader; 10 import java.io.Writer; 11 import java.sql.DriverManager; 12 import java.sql.PreparedStatement; 13 import java.sql.SQLException; 14 15 import javax.servlet.ServletException; 16 import javax.servlet.http.HttpServlet; 17 import javax.servlet.http.HttpServletRequest; 18 import javax.servlet.http.HttpServletResponse; 19 20 import oracle.jdbc.OracleConnection; 21 import oracle.jdbc.OracleDriver; 22 23 import oracle.jdbc.OraclePreparedStatement; 24 25 import oracle.sql.CLOB; 26 27 import oracle.xdb.XMLType; 28 29 public class SampleServlet extends HttpServlet { 30 31 private OracleConnection dbConnection; 32 33 public SampleServlet() { 34 } 35 36 private void initializeDatabaseConnection() throws SQLException { 37 DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); 38 OracleDriver ora = new OracleDriver(); 39 this.dbConnection = (OracleConnection) ora.defaultConnection(); 40 } 41 42 public void doGet(HttpServletRequest request, HttpServletResponse response) 43 throws ServletException, IOException 44 { 45 try { 46 response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); 47 } 48 catch (Exception e) { 49 System.out.println("SampleServlet.doGet() : Caught Exception."); 50 e.printStackTrace(System.out); 51 System.out.flush(); 52 try { 53 this.dbConnection.rollback(); 54 } 55 catch (SQLException sql) { 56 System.out.println("SampleServlet.doGet() : Rollback Exception."); 57 sql.printStackTrace(System.out); 58 System.out.flush(); 59 } 60 finally { 61 response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 62 e.printStackTrace(System.out); 63 System.out.flush(); 64 } 65 } 66 } 67 68 public Reader doPutImpl(HttpServletRequest request, HttpServletResponse response) 69 throws SQLException, IOException { 70 71 OraclePreparedStatement statement = (OraclePreparedStatement) this.dbConnection.prepareStatement("insert into MY_XML_TABLE values (: 72 XMLType myXML = new XMLType(dbConnection,request.getInputStream()); 73 statement.setObject(1, myXML); 74 statement.execute(); 75 statement.close(); 76 77 String responseText = "anonymousServletRole anonymousServletRole Upload Complete Successfully uploaded document into MY_XML_TABLE 78 StringReader reader = new StringReader(responseText); 79 return reader; 80 } 81 82 83 public void doPut(HttpServletRequest request, HttpServletResponse response) 84 throws ServletException, IOException 85 { 86 try { 87 initializeDatabaseConnection(); 88 Reader responseHTML = doPutImpl(request,response); 89 this.dbConnection.commit(); 90 sendResponse(response,responseHTML); 91 } 92 catch (Exception e) { 93 System.out.println("SampleServlet.doPut() : Caught Exception."); 94 e.printStackTrace(System.out); 95 System.out.flush(); 96 try { 97 this.dbConnection.rollback(); 98 } 99 catch (SQLException sql) { 100 System.out.println("SampleServlet.doPut() : Rollback Exception."); 101 sql.printStackTrace(System.out); 102 System.out.flush(); 103 } 104 finally { 105 response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 106 e.printStackTrace(System.out); 107 System.out.flush(); 108 } 109 } 110 } 111 112 public void doPost(HttpServletRequest request, HttpServletResponse response) 113 throws ServletException, IOException 114 { 115 try { 116 response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); 117 } 118 catch (Exception e) { 119 System.out.println("SampleServlet.doPost() : Caught Exception."); 120 e.printStackTrace(System.out); 121 System.out.flush(); 122 try { 123 this.dbConnection.rollback(); 124 } 125 catch (SQLException sql) { 126 System.out.println("SampleServlet.doPost() : Rollback Exception."); 127 sql.printStackTrace(System.out); 128 System.out.flush(); 129 } 130 finally { 131 response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 132 e.printStackTrace(System.out); 133 System.out.flush(); 134 } 135 } 136 } 137 138 private int sendResponse(HttpServletResponse response, Reader reader) 139 throws IOException { 140 int byteCounter = 0; 141 response.setContentType("text/html"); 142 response.setContentLength(0); 143 Writer writer = new OutputStreamWriter(response.getOutputStream()); 144 char[] buffer = new char[CLOB.MAX_CHUNK_SIZE]; 145 int n; 146 while (-1 != (n = reader.read(buffer))) 147 { 148 byteCounter = byteCounter + n; 149 writer.write(buffer,0,n); 150 } 151 writer.flush(); 152 writer.close(); 153 response.getOutputStream().flush(); 154 response.getOutputStream().write( new byte[] {''\r'',''\n''} ); 155 response.getOutputStream().close(); 156 response.setStatus(HttpServletResponse.SC_OK); 157 return byteCounter; 158 } 159 160 }'; 161 end; 162 / PL/SQL procedure successfully completed. Elapsed: 00:00:00.49 SQL> declare 2 V_RESULT BOOLEAN; 3 begin 4 if (DBMS_XDB.existsResource(:JAVA_SOURCE_PATH)) then 5 DBMS_XDB.deleteResource(:JAVA_SOURCE_PATH); 6 end if; 7 V_RESULT := DBMS_XDB.createResource(:JAVA_SOURCE_PATH,:JAVA_SOURCE); 8 end; 9 / PL/SQL procedure successfully completed. Elapsed: 00:00:00.04 SQL> -- SQL> undef JAVA_SOURCE_PATH SQL> -- SQL> column JAVA_SOURCE_PATH new_value JAVA_SOURCE_PATH SQL> -- SQL> select :JAVA_SOURCE_PATH JAVA_SOURCE_PATH from dual 2 / JAVA_SOURCE_PATH -------------------------------------------------------------------------------- /public/SampleServlet.java Elapsed: 00:00:00.01 SQL> def JAVA_NAME = SampleServlet SQL> def JAVA_SOURCE_PATH DEFINE JAVA_SOURCE_PATH = "/public/SampleServlet.java" (CHAR) SQL> -- SQL> create or replace and resolve java source 2 named "&JAVA_NAME" 3 using CLOB (select xdburitype('&JAVA_SOURCE_PATH').getClob() from dual); 4 / old 2: named "&JAVA_NAME" new 2: named "SampleServlet" old 3: using CLOB (select xdburitype('&JAVA_SOURCE_PATH').getClob() from dual); new 3: using CLOB (select xdburitype('/public/SampleServlet.java').getClob() from dual); Java created. Elapsed: 00:00:00.56 SQL> show errors No errors. SQL> -- SQL> declare 2 shortname varchar2(128); 3 begin 4 select dbms_java.shortname(NAME) 5 into shortname 6 from USER_JAVA_CLASSES 7 where SOURCE = '&JAVA_NAME'; 8 execute immediate 'grant execute on "' || shortname || '" to public'; 9 end; 10 / old 7: where SOURCE = '&JAVA_NAME'; new 7: where SOURCE = 'SampleServlet'; PL/SQL procedure successfully completed. Elapsed: 00:00:00.06 SQL> create table MY_XML_TABLE of XMLTYPE 2 / Table created. Elapsed: 00:00:00.06 SQL> select * 2 from MY_XML_TABLE 3 / no rows selected Elapsed: 00:00:00.01 SQL> VAR RESPONSE VARCHAR2(4000) SQL> -- SQL> DEF HOSTNAME = ORA10200 SQL> -- SQL> DECLARE 2 V_SERVLET_URL VARCHAR2(4000) := 'http://&USERNAME:&PASSWORD@&HOSTNAME/sys/servlets/&USERNAME/sample/upload.xml'; 3 V_MESSAGE VARCHAR2(4000) := 'World '; 4 V_REQUEST UTL_HTTP.REQ; 5 V_RESPONSE UTL_HTTP.RESP; 6 V_BUFFER VARCHAR2(32000); 7 V_RESPONSE_TEXT CLOB; 8 V_RESPONSE_XML XMLTYPE; 9 V_WSDL XMLTYPE; 10 BEGIN 11 DBMS_LOB.CREATETEMPORARY(V_RESPONSE_TEXT, TRUE); 12 13 begin 14 V_REQUEST := UTL_HTTP.BEGIN_REQUEST(URL => V_SERVLET_URL, METHOD => 'PUT'); 15 -- UTL_HTTP.SET_AUTHENTICATION(V_REQUEST, '&USERNAME', '&PASSWORD' ); 16 UTL_HTTP.SET_HEADER(V_REQUEST, 'User-Agent', 'Mozilla/4.0'); 17 UTL_HTTP.SET_HEADER (R => V_REQUEST, NAME => 'Content-Length', VALUE => LENGTH(V_MESSAGE)); 18 UTL_HTTP.WRITE_TEXT (R => V_REQUEST, DATA => V_MESSAGE); 19 V_RESPONSE := UTL_HTTP.GET_RESPONSE(V_REQUEST); 20 LOOP 21 UTL_HTTP.READ_LINE(V_RESPONSE, V_BUFFER, TRUE); 22 if (LENGTH(V_BUFFER) > 0) then 23 DBMS_LOB.WRITEAPPEND(V_RESPONSE_TEXT,LENGTH(V_BUFFER),V_BUFFER); 24 end if; 25 END LOOP; 26 UTL_HTTP.END_RESPONSE(V_RESPONSE); 27 EXCEPTION 28 WHEN UTL_HTTP.END_OF_BODY THEN 29 UTL_HTTP.END_RESPONSE(V_RESPONSE); 30 END; 31 32 :RESPONSE := V_RESPONSE_TEXT; 33 34 DBMS_LOB.FREETEMPORARY(V_RESPONSE_TEXT); 35 36 END; 37 / old 2: V_SERVLET_URL VARCHAR2(4000) := 'http://&USERNAME:&PASSWORD@&HOSTNAME/sys/servlets/&USERNAME/sample/upload.xml'; new 2: V_SERVLET_URL VARCHAR2(4000) := 'http://SERVLET:SERVLET@ORA10200/sys/servlets/SERVLET/sample/upload.xml'; old 15: -- UTL_HTTP.SET_AUTHENTICATION(V_REQUEST, '&USERNAME', '&PASSWORD' ); new 15: -- UTL_HTTP.SET_AUTHENTICATION(V_REQUEST, 'SERVLET', 'SERVLET' ); PL/SQL procedure successfully completed. Elapsed: 00:00:00.62 SQL> set long 100000 SQL> -- SQL> select :RESPONSE 2 from dual 3 / :RESPONSE --------------------------------------------------------------------------------Upload Complete Successfully uploade d document into MY_XML_TABLEElapsed: 00:00:00.01 SQL> select * 2 from MY_XML_TABLE 3 / SYS_NC_ROWINFO$ --------------------------------------------------------------------------------World Elapsed: 00:00:00.00 SQL>Firefox abandons his silently http request within 60 seconds
- Summary
Firefox abandons its http request in nearly 60 seconds (period till)
waiting time varies) and says nothing to users. This has happened at a time of
Nginx and Apache.- Environment
Client browser: Firefox 35.0.1
Client OS: Windows 7 Enterprise 32-bit SP1
Web server: Apache 2.2.3 - 91 & 1.6.2 - 1 of Nginx
Server operating system: CentOS 5.11
PHP: 5.3.3
FastCGI: spawn-fcgi(3) - 1.6.3 - 1- Description of the problem
I noticed that nginx record 499 http response code so often.
Nginx is used almost only to two web applications, one based on PHP
and others on ruby. We encounter this problem in both applications. The server and the client PC belong to the same subnet.Since last month, nginx logged 624 errors for Firefox and 16 others
browsers (IE, almost).For the test, so I wrote a simple PHP (see bottom of article) and I tried to access
Thanks to these two Apache and Nginx with 35.0.1 Firefox and IE 11. IE11
waited for 120 seconds and returned html successfully through two nginx
and Apache, but Firefox has failed or the other.Let me describe the behavior of Firefox.
1. Enter the test php url in the address bar, and then press ENTER.
2. the message "waiting for response from the server" appears in the status bar for a while.
3. watch the conversation network through Wireshark, signals 'Keep Alive'
are repeated several times between server and client, and after that,
4. the message disappears. 'END' signal is sent to the server, the client, just after that. Firebug newspapers 'Aborted' to the almost at the same time.
5. the responses from the server ' END ACK.There is a difference of bit with nginx and Apache behavior after ' END
ACK "."A.Nginx
Nginx logs '499' error and end the conversation immediately.
B.Apache is not connect anthying at this stage. After 120 seconds (sleep timer
in PHP) of the request, it returns html expected. Of course Firefox doesn't make it, but I could confirm both request and response of the "Follow TCP Stream" of Wireshark function. Finally, it is saved with the http status code 200 to the httpd log file.I repeated this test several times. Actual expiration time varies from 22
70 seconds but the results are the same.To my knowledge, the browser should display "timeout error".
After such a situation, but it only shows nothing. If the end user does not
find out what happened.---
- What I tried to solve the problem
- Disable all other than firebug extensions.
- 'network.tcp.keepalive.enabled' set to false in: config.
- the value "network.http.spdy.enabled" fake, too.
- the "network.http.response.timeout" value 0.
- Mobile IPV6 and DNS prefetch, seeing what follows to help.
https://support.Mozilla.org/en-us/KB/websites-Don
- past Timeout to 0 to http.conf to apche.
My goal is to make our web applications to work correctly in our work environment. I have recommended Firefox to colleagues because it was a very cool application. Change the default brawser is a nightmare for me. Any suggestions are welcome.
---
< php test >
Sleep (120);
echo time();Dear jscher2000
I saw your site with my Firefox twice and there is no expiration time. After 120 seconds, Firefox has made text "sleep 120 seconds before generating the HTML."
If this isn't the problem in Firefox, but our network or server or both of them.
Thanks to you all. I will try to pinpoint the cause of our problem.
How can I send a HTTP request to a web server using TCP?
I'm writing a HTTP string to activate a script CGI, server of our company. It seems that the OPEN TCP CONNECTION works. Can I just use the TCP WRITE function to send the HTTP request string to the server?
Thank you
TimI know that I probably would have finished faster if I had the Internet Toolbox, but the solution ends up being pretty simple with just the TCP features.
Here is the solution, I came with yesterday (in the case where someone else needs) after searching Protocols TCP as suggested by "Laboratory Viewer" and examine details in the riding of developer. It ends up being only a string of 4 line.GET HTTP://proxyserver/path/file.asp?id=test HTTP/1.1
HOMEroxyserverThe first line of the string is made up of three things:
(1) the GET command
(2) the URL of the program target (in this case an ASP program that distributes a message preset)
NOTE that in this case, the URL contained "HTTP://proxyserver" and not only the path to the file. If your not using a proxy server, you can probably omit the name of the server of the URL, but you must always the name of the host server to the second line.
(3) the HTTP version usedThe second line is the host server.
The last two lines are empty, but the two are apparently necessary to properly close the TCP request.
Vi uses an OPEN TCP CONNECTION to connect to port 80, then the 4 line string is sent with a WRITING of TCP and the connection is closed with a NARROW CONNECTION of TCP.
In my application, when the piece of equipment monitored by LabVIEW begins to enter a dangerous to use, LabVIEW uses this vi to send the HTTP request through the TCP connection and a program of target ASP on the company's web server. The ASP reads the message ID (? id = test) and sends the message page and the text messaging appropriate to maintenance and engineering personnel. People warned by text pagers are supposed to respond immediately.
Our DSI wrote the ASP that allows you to set the ID of multiple message with different distribution lists. Each message is triggered with a different ID of the virtual instrument according to the gravity of the situation.
Thanks to other amateurs who have published their questions and their answers. Hope someone else finds this useful.
Http request message with BB10 Simulator test
Hi all
I implement request to send http request and receive the response from the server.
Earlier for testing with simulators, we used MDS for the connection to the server.
How to test this application using Simulator BB10 Alpha? Kindly let me know.
Thank you and best regards,
Shubhangi
Hello
I use more kink for reference: it is very useful.
Also in my code, it was typo. Now the http request has been published to server correctly.
Thank you and best regards,
Shubhangi
XML Http Request returns only "undefined"?
Hi all
XML Http Request only returns "undefined".
Any idea what's going on?
Have you in the white list the areas that you try to access the config.xml file?
https://developer.BlackBerry.com/HTML5/documentation/access_element_834677_11.html
Otherwise, see this example page that shows how to use XHR. Maybe there is an excerpt that is missing in your code?
http://BlackBerry.github.IO/WebWorks-samples/kitchenSink/HTML/browser/XHR.html
HTTP request works does not in a Simulator
Hi all
am held to an odd question in the BB. My http request class always throws incorrect exception as the url. spin the MDS Server too. to send the request, I talked link http://riccomini.name/Topics/Mobile/BlackBerry/BlackBerryHTTPClient/...
try url www.google.com... every time am getting error 400... I don't think that the url is incorrect.
So please help me to solve the problem. Is there a problem with MDS? using jde 4.5 and 8300 simulator-based test.
I tried the sample provided by the SDK... also for this same problem am facing
Thanku
Sorry not an area of expertise, but I guess you have a proxy on your network server and you must configure the MDS to work with it. Search for proxy server, there is an article that explains how.
signature of the oversized https request
Hi, is it possible that we can trigger an alarm when an https request exceeds a certain size?
I can define a type state.http signature using parameters such as the following? MaxRequestFieldLength takes into account the fragmentation of application data by ssl?
-Direction = ToService
-MaxRequestFieldLength = 1000000
-servicePorts = 443
-AlarmThrottle = FireOnce
-MinHits = 1
-ResetAfterIdle = 15
-ThrottleInterval = 15
-WantFlag = TRUE
If this does not work, would you please suggest alternatives. Thank you.
I looked into it, and it does not seem that this will really be feasible with the help of a personal signature. First, you must use the STRING. TCP engine for this. THE STATE. Engine HTTP needs context information in the HTTP stream in order to work properly. Because the HTTPS protocol is encrypted traffic, we have not these signals. So there's basically trying to count bytes in a HTTPS stream. Two problems here. First of all, the implementation of regex in STRING. TCP is limited to 512 ~ States for performance reasons. So, we will build only a model to 512 or more characters. This obviously does not follow the large desired patterns. Secondly, we need some sort of condition of single endpoint, a character model, at the end of the regex model with. Due to the random nature of characters in the encrypted HTTPS data, we do not have the guarantee that our terminator will not unexpectedly appear in the stream for giving us no good way to determine, we have reached the end of the search. This signature will probably be coded in a new engine.
Hello
I have an application that performs an http request to a server that send to BlackBerry and BlackBerry XML parse XML with SAX. I get this error: invalid character '& #x10' encountered. Can you tell me what is this character and how I can solve it?
Thanks in advance.
Kind regards
Gianni.
I solved it adding
conn.setRequestProperty (' x-rim-transcode-content "," none"");
but I do not know why... May I ask why?
HTTP request at regular intervals
Hello
I have an application that update its database, create an http request and parsing the xml response (it dynamically build the query with xml content). I want to update my database at regular intervals, so I need to do http request at regular intervals, of power to the top of the device to power off. My autorun app at startup, but I would like to request http in the same interval, even if I enter the application and I close. I tried with the task of thread or a timer, but I have the same problem, it is if I enter the application and close the thread dies and I can't see http request. I don't know if I explain my problem... Can you tell me if there is a solution?
Thanks in advance.
Kind regards
Gianni.
Use a background application. You can use a different entry point (see the knowledge base) to enter your main application.
a timer and timertask run a thread would be the best solution I think
Maybe you are looking for
-
iPhone: Photos and iCloud
Here's what I hope I can do: I use iCloud for save my photos of my iMac. All my photos on my iMac will also my iPhone (5 000 + photos). It seems that I used to be able to select in iTunes that photoalbums I put on my phone. Now all my albums are on m
-
I respond to emails a box will appear asking you if I want to save the text, and then when I send the answer, I still wonder about some long files that is not sent as and my replies come empty to the recipients.
-
I recently discovered that browser Konqueror for Linux can help the user to limit the CPU usage while visiting a Web site using flash technology by changing the settings in the Flash section and by adjusting the slider settings VERY HIGH to HIGH and
-
Original title: I have recently moved to College, when I play a movie for example on my laptop sounds constantly crackling and interupting the media currently playing, how should I do? I have recently moved to College, when I play a movie for example
-
When continue a program (Add/Remove Programs) you will lose data in the program?