Send the POST request with BLOB content
Hello
I usually use the following structure to send the POST request with content of varchar2 and numbers
content := '{"Original File Name":"'||V_HOMEBANNER_1_EN_NAME(indx)||'"}'; url := 'https://api.appery.io/rest/1/db/Names'; req := utl_http.begin_request(url, 'POST',' HTTP/1.1'); UTL_HTTP.set_header(req, 'X-Appery-Database-Id', '5f2dac54b02cc6402dbe'); utl_http.set_header(req, 'content-type', 'application/json'); UTL_HTTP.set_header(req, 'X-Appery-Session-Token', sessionToken); utl_http.set_header(req, 'Content-Length', LENGTH(content)); utl_http.write_text(req, content); res := utl_http.get_response(req); BEGIN LOOP utl_http.read_line(res, buffer); END LOOP; utl_http.end_response(res); EXCEPTION WHEN utl_http.end_of_body THEN utl_http.end_response(res); END;
And it works very well. However, now I want to send/download (jpg image) files a blob in a MongoDB collection called "Files" (so url: = ttps://api.appery.io/rest/1/db/files). The guide of the collection is the next loop as a general advice:
curl -X POST \ -H "X-Appery-Database-Id: 5f2dac54b02cc6402dbe" \ -H "X-Appery-Session-Token: <session_token>" \ -H "Content-Type: <content_type>" \ --data-binary '<file_content>' \ https://api.appery.io/rest/1/db/files/<file_name>
But I couldn't translate this curvature in PL/SQL query. Specifically, the part (-given binary '< file_content >")
I have these BLOB files in an Oracle table, and they are stored with their names as follows:
File_name | File_content |
---|---|
PIC_1.jpg | BLOB OBJECT |
PIC_2.jpg | BLOB OBJECT |
PIC_3.jpg | BLOB OBJECT |
My question, how to download these images in the target URL?
After a few hours I spent on it, I got it working. My solutions is inspired by this http://blog.optiosys.com/?p=246
Since you must send you no the (same) CLOB and BLOB files, you need just need to replace .write_text by .write_raw.
Here is my part of work for your reference:
content: = V_HOMEBANNER_1_EN (indx); -blob
file_name: = 'test.jpg ';
URL: = "https://api.appery.io/rest/1/db/files/": file_name;
Req: = utl_http.begin_request (url, 'POST', ' HTTP/1.1');
Utl_http.set_header (req, 'X-Appery-database - Id', '53fae4b02cc4021dbe');
Utl_http.set_header (req, 'X-Appery-Session-token', sessionToken);
Utl_http.set_header (req, "content-type', ' image/jpeg");
req_length: = DBMS_LOB.getlength (CONTENT);
DBMS_OUTPUT. Put_line (req_length);
-IF YOU LIMIT THE DATA UNDER 32KB MSG:
IF req_length<=>=>
THEN
Start
Utl_http.set_header (req, "Content-Length", req_length);
Utl_http.write_raw (req, content);
exception
while others then
DBMS_OUTPUT. Put_line (SQLERRM);
end;
-IF MSG DATA MORE THAN 32 KB
ELSIF req_length > 32767
THEN
BEGIN
DBMS_OUTPUT. Put_line (req_length);
Utl_http.set_header (req, "Transfer-Encoding", "Chunked");
While (offset<>
LOOP
DBMS_LOB. Read (content, amount, offset, buffer);
Utl_http.write_raw (req, buffer);
offset: = offset + amount;
END LOOP;
exception
while others then
DBMS_OUTPUT. Put_line (SQLERRM);
end;
END IF;
l_http_response: = UTL_HTTP.get_response (req);
Utl_http.READ_TEXT (l_http_response, response_body, 32767);
Utl_http.end_response (l_http_response);
I hope this helps. Good luck
Tags: Database
Similar Questions
-
Cannot send the UDP datagram with device 8320 (V4.2.2.180)
There is a post says "Cannot send the datagram UDP with JDE 4.5" to
In the emulator of JDE4.2 it really works, but he meets the same problem in the blackberry8320 (V4.2.2.180) device, get the same java.io.IOException (detailMessage = null) to the send() operation;
I looked in the (accessible via wifi) PC with a tool named Sockettool (it can create the client and Server TCP/UDP), it can be connected to the emulator and receive datagrams sent to the emulator, but can not be connected to device.
Is this a problem related version too?
Appreciate if you can share your experience with datagram connection to the device.
Here is my code:
Emulator: host = "udp://iport1; port2.
Feature: host = "udp://iport1; port2 /; = wifi interface.
try { udp_client = (DatagramConnection) Connector.open(host); byte[] data = {65,66,67,68}; int len = data.length; dg_out = udp_client.newDatagram(data, data.length); udp_client.send(dg_out); udp_client.close(); }catch (Exception e) { System.out.println("UDP Exception:"+e.getMessage()); }
If the application is able to send and receive UDP traffic in the BlackBerry Simulator, but not on a BlackBerry real pocket computer the first thing to check is to check that your carrier supports. Several carriers do not support UDP traffic or restrict to specific ports or data types. This can cause exceptions or make it appear that the application will silently fail (carrier is just dropping packets).
-
BlackBerry Smartphones cannot send the meeting request
Since obtaining the storm failed to send the meeting request. Can I receive a correctly but when send the meeting request, the request is not received by the recipient. I get no error message advising me that meeting was not sent successfully.
Is there a setting I'm missing? Thank you
Oh I'm sorry! During the process of switching devices, there were 2 BIS accounts, set up... an active with each other with the storm... and WE fixed the error and we were able to send the guest with success.
Thank you!
-
How to remove or customize the white preloader with edge content in DPS applications.
I'm looking for a possible solution with the White Page of Preloader when you create an API via Indesign.
The content is created entirely in Adobe Edge animate, then its published HTML code is placed by the superposition of Folio of Indesign. Then via the DPS APP BUILDER converted into an IPA, this work is fantastic!
.. but...
When the application is launched on the iPad there are always, always the white screen of preload with the wheel of rotation for a few cases.
Tried to customize the preloader in Edge screen but the white screen will display first, then the custum pre-load the screen, then the content.
Also tried to directly edit the HTML code, but no luck, still has the white screen with the spinning wheel.
Someone have an idea how to hide this white screen? Or how to customize it?
Thanks for any suggestions.
Instead of creating the image of the poster on the edge, try to use a poster in InDesign. The image of the poster on the top of the overlay from the edge and put the overlay with a delay, for example 0.5 seconds. The image of the poster must appear initially, while the superimposition of edge loading in the background, and then appears in front of the image of the poster.
-
Intrusion via CFMAIL to send the web/image with image map page
I can send my web page with the image and the image embedded, card by doing "file" / "send" / "Page by e-mail" in the browser. It creates an email with the image and the link Hypertext-card and works very well. Page is https://www.health-pact.com/Email_02Nov08.htm
How to create the same page web/graphic in my source code and intrusion via CFMAIL to send content (jpg and image map) just like I can do my browser?
http://livedocs.Adobe.com/ColdFusion/8/htmldocs/email_03.html#1126596
Send an HTML email, and make the image source an absolute path, like this:
well = "#Slide2" / >--
Ken Ford
Adobe Community Expert Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com'health-Pact'
wrote in message
News:gerbc7$i7g$1@forums. Macromedia.com...
> I can email my web page with the image and the image embedded, card making
> "File" / "Send" / "Page by e-mail" in the browser. It creates an email
> with
> the image and the link Hypertext-card and works very well. Page is
> https://www.health-pact.com/Email_02Nov08.htm
>
> How to create the same page web/graphic in my source code and use intrusion via CFMAIL
> to
> Send content (jpg and image map) just like I can do my browser?
>
> -
How endece server send the update request
Hi all
I read the short guide to the cluster server, I understand that I can submit the update request to all nodes of follower, and then the follower node will forward the request to update to the node leader for update operation. But if I configure the host from the short to the follower node server, I got the below error message:
"
2015-07-17 14:50:37, 825 received ERROR 1015825 [SocketReader] error message from the server: attempt to remove tuples within a readonly or trailing index.
2015-07-17 14:50:37, 832 widget ERROR 1015825 [WatchDog_1015825] [add/replace in bulk record: BULK_ADD_REPLACE_RECORDS1] failed with unknown cause.
"
My setup on the server of the Integrator:
ENDECA_SERVER_HOST = endeca_test_node2 (it is followers node of the data domain 'test_dd')
ENDECA_SERVER_PORT = 7003
ENDECA_SERVER_CONTEXT = server short
DATA_DOMAIN_NAME = test_dd
Can someone tell me how to solve this problem, or there is a bug on the server for short, which limited demand for update to the head only node, routing does not function to the node of the follower to the node of leader?
Will be very appreciated if you can help!
IMO
As you said, the intention of the cluster behavior is highway the bulk loading queries. I think it worked out of the box there about a year. However, from what I see at our customers, I don't think it works more.
As a general rule, we are now building in the logic to determine the node leader for all of our clients on a cluster before you run updates.
Patrick
-
Sending the command apdu with an array of bytes as CDATA
Hello
I learn the java card as part of my final year project. So far I think I can do the most basic things, but I stuck a special moment.
I know that there are different manufacturers to create an apdu command object and a number of these manufacturers take an array of bytes as CDATA values.
My problem is, how do I access this data table in the side of the card because apdu.getBuffer () returns an array of integers (bytes)? And what is actually on apdu.getBuffer () [ISO7816. (Instead of OFFSET_CDATA)] when you send the apdu command object using such constuctor?
concerning
Published by: 992194 on 6 March 2013 06:12992194 wrote:
(..) I should have mentioned earlier that my card use jc 2.2.1 version, and from different places, I've read that this version does not support ExtendedLength facilities.Indeed.
I also understand the semantics of apdu.getBuffer () [ISO7816. OFFSET_CDATA] is the first byte of the data command. My question is, these command data was initially provided as an array of bytes. Something like this:
+ new CommandAPDU(CLA, INS, P1, P2, DATA_ARRAY, Le) +.
For example, when you call:
ubyte [] buffer = apdu.getBuffer)
So it means that the values of bytes inside the tableau_donnees argument automatically occupy locations + buffer [ISO7816. OFFSET_CDATA] + inside the buffer?
Yes. The length would be (abstract) (buffer [ISO7816. (OFFSET_LC] & 0xFF) . Notice the & 0xFF is a must greater than 127 bytes.
Or there is a mechanism to extract the table tableau_donnees itself?
Laughing out loud
In fact, in the interest of performance and portability in environments with low memory, usual coding style must pass buffer , an offset that and length; rather than take an object, which would require a copy. Welcome to the real world of Java Card.
-
in the vertical version of the page with a picture of scrollable content, I have can´t by scanning to the next item. the scrollable content framework has, in both versions, the exact size of the page. in the horizontal version, it works perfectly. Used folio builder v22, pdf and smothscrolling off.
Post edited by: dps loss
Thanks for the reply. But I discovered that it was my fault. A status of an object is outside the scrolling of content. But thank you for the opportunity to ask questions.
-
Ask the CLOB column (with XML content)
1. how to extract a particular xml tag value for a column with the CLOB data type.
Example:
< REQUEST_DETAIL >
PR < GROUP_TYPE > < / GROUP_TYPE >
< GroupName > ASSET MANAGEMENT TECHNICAL DATA < / GroupName >
< BUS_UNIT_ACRN > SCS-FCAT < / BUS_UNIT_ACRN >
< PROJ_MGR_ID > < / PROJ_MGR_ID >
< PROJ_MGR_NAME > Roland Roy < / PROJ_MGR_NAME >
< / REQUEST_DETAIL >
Select
XmlType (provable). Extract('/REQUEST_DETAIL/GROUP_TYPE/text()').getStringVal)
e t
/
example above works.
If I do not know the order of xml tag to ask how can I get the value.
(/ * * / / * * / REQUEST_DETAIL/GROUP_TYPE / * / *)
2 using the DBMS_LOB. SUBSTR takes longer to run and it never returns results and session will wait status for access to LOB_INDEX content (at the same time the CLOB column is used by the application).
Y at - it another option for faster results.
SELECT DBMS_LOB. SUBSTR (xml_blob, 4, DBMS_LOB.) INSTR (xml_blob, "< name >", 1, 1) + 6) name.
status,
CNT to COUNT (*)
OF LOG_TBL
WHEN TRUNC (IO_DATE) = TRUNC (SYSDATE)
GROUP OF DBMS_LOB. SUBSTR (xml_blob, 4, DBMS_LOB.) INSTR (xml_blob, "< name >", 1, 1) + 6),
status
Kind regards
Veera
Adiitional your reuirement to omit the public areas
2729533 wrote:
Your 1 returln sql any domain name (p099 and public - seems to search all nodes in an xml file). I only need 1 domain name (and omit the public areas)
- SELECT X.*
- T
- , xmltable ('(//*[DomainName!="PUBLIC"]/DomainName) [1] ')
- PASSAGE xmlparse (document t.XML_BLOB)
- THE DOMAIN VARCHAR2 COLUMNS (15) PATH '.'
- ) X
- where t.no = 317663815
-
Replace the selected text with other content TextFrame
Hello
I am changing a text selected in something new, involving the movement of text and the paragraph style using a jsx script. At the present time, everything works beautifully:
- I entered the select text
- I have create a new temporary TextFrame
- I build my new paragraphs and apply styles to them in the new TextFrame
What I was not able to reach still is to replace the original selected text by temporary TextFrame content.
Any help would be more than welcome
A part of my script:
myText = app.selection[0].contents;
...
do some stuffvar myDocument = app.documents.item(0);
var myPage = myDocument.pages.item(0);
var myTextFrame = myPage.textFrames.add();
myTextFrame.geometricBounds = [0, -70, 150, 70];
myTextFrame.contents = "Paragraph1\rParagraph2...";
myTextFrame.paragraphs[0].appliedParagraphStyle = pStyleGroup.paragraphStyles.itemByName('Style1');
myTextFrame.paragraphs[1].appliedParagraphStyle = pStyleGroup.paragraphStyles.itemByName('Style2');
And now, in myTextFrame, I have my new paragraph formatted, and I would like to replace the original selected text with the contents of my TextFrame (keeping the paragraph styles).
Hello
Keep the logic of the code and edit utilities:
var mSourceIdx = app.selection[0].index, mStory = app.selection[0].parentStory, mReplaceStuff = { elements: [ ["Paragraph_1\r", "Style_1"], ["Paragraph_2\r", "Style_2"], ["Paragraph_X\r", "Style_X"] ]}, mTarget, cElement, cText, cParaStyle; while (cElement = mReplaceStuff.elements.pop()) { cText = cElement[0]; cParaStyle = app.activeDocument.paragraphStyles.item(cElement[1]); // modify if styleGroups present in a structure mTarget = mStory.insertionPoints.item(mSourceIdx); mTarget.contents = cText; mTarget.paragraphs[0].appliedParagraphStyle = cParaStyle; } app.selection[0].contents = "";
MReplaceStuff allows to prepare stuff to replace
Jarek
-
Is it possible to make the http request with a part without the app?
If this is the case, then could you give me a simple example to achieve with c ++? I tried to write #include
on top but he says ../src/service.cpp:20:33: fatal error: QNetworkAccessManager: No such file or directory
When I create an instance of QNetworkRequest.
Thank you very much!
Looks like you need to include the appropriate library.
try adding - lbbnetwork in the .pro -
Can BBM sends the HTTP request to the server
You can make your application HTTP connections. The BBM API are not involved with it. Guide to networking found here: https://bdsc.webapps.blackberry.com/java/documentation/ww_java_networking/Intro_networking_1984362_1...
-
Get the following error when you run only one RDP or simple PCOIP remote distance run. Error appears during the Apache test in Internet Explorer. Any ideas?
There are a few known issues with IE11. If you uinstall IE11 updates, that is to say bring back to IE8 or IE9, things should work fine.
-
A question about the service request with the support
Hello
I raised a SR I have to degenerate. I'm a dba but not a Manager. Can someone guide on what I need to do get climb the sevearity SR 3 to sev2?
Kind regardsHello
See what * Service request escalation: Notification being sent to the Manager also [395414.1 ID] *.
concerning
-
Report, which reflects the age of the service request with respesct to the Regio
Hello
Is there a way we could create a report that displays the following:
The age (days) of the North-South Centre
90 + 21 1 1
60 - 79 2 32 2
30-59 2 3 2
10-29 1 2 4
09 - 1 1 1 1
What we are trying to do is to create a report that shows that how much SR are open age given to each region. For example one of the SRs, with age > 90 are open and which region.
Note: The age = Diff between SR Date of opening and the current Date
Any help would be really appreciated.
Thank you
AhmedHi, something like this can help you
CASE
WHEN (TimestampDiff (SQL_TSI_DAY, "Closed Date". To date, "Date Opened". (Date) > 90) THEN ' AGE > 90'
WHEN (TimestampDiff (SQL_TSI_DAY, "Closed Date". To date, "Date Opened". Date) > 59 AND TimestampDiff (SQL_TSI_DAY, "Closed Date". To date, "Date Opened". Date)< 91)="" then="" 'age="" 60="" -="">
ANOTHER '' nothing. ''
END-John CRMIT
Maybe you are looking for
-
I just bought this calculator and began to learn how to use it. I tried to divide 10 by 16533 but do not get a conclusion when the function is pressedwhy? The operating mode is RPN.
-
A100-158, X 1600 low performance
Hi, I have a Satellite A100-158 with mobility X 1600.When I run 3DMark05, my score is only 2548 when it should be at least of 3600. Several websites tested the X 1600 and they get good scores...I use Toshiba drivers for ATI catalyst 6.3 do not suppor
-
How a pinbed.how to configure the interface? design the hw & mechanica? low cost! PCB ICT test (& ICSC!)TX
-
Any time I need to cancel/delete a print job, I'm sitting in limbo! I cancel properly and he claims that 'delete'... but it takes FOREVER! Why? Help!
-
I have windows XP THAT updated... Have had constant problems with the browser to IE because I removed AVG. Have now made a part of this program is still running into problems of brower causing, I stop every day with microsoft fix it tool but the nex