POST/multipart-POST
Hi,
I've been looking at various APIs for sending HTTP POST functions, in particular I'm interested in the different uses between the above 2 methods. The typical line is "if you're sending a file - use multipart".
Why, do POST methods have a certain maximum size?
Or, what's the point when I should use POST or multipart-POST?
Is it typical to just use multipart-POST everywhere?
Is the trade-off just more overhead?
Any help on this would be appreciated.
This is really an HTTP question, not a Java question.
Similar Messages
-
I have been given a new requirement to send a zipped file(s) to a client using HTTPS using a Multipart Post.
I have found an example...
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1024);
BEGIN
req := utl_http.begin_request('http://www.psoug.org');
resp := utl_http.get_response(req);
LOOP
utl_http.read_line(resp, value, TRUE);
dbms_output.put_line(value);
END LOOP;
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;Which obviously returns and displays the HTML content of the URL, however we need to post zipped files in the content. We have been told by someone at Oracle that we can use the UTL_HTTP package to do this but when i search for this all i find is Java.
Can anyone point me in the right direction as to where to start and any code examples would be a great help, i tried posting this in the SQL / PLSQL forum but with no success..
Thanks in advance
Graham.Hi:
This is tricky one and I have to say that there is not a lot around about it.
The example you have shown is for UTL_HTTP and while you are on the right track, you want HTTPS and that requires, in addition to what you, the use of the Oracle Wallet. The wallet has to be setup on your machine and referenced in your code. Additionally, you need to be quite clear about the data that is being expected by the remote system to which you are sending the POST request.
Here is a code example that I have tried to explain a bit for you. Obviously my code is doing something quite different from what you require but the methodology will be similar:
+++++++++++++++++++++++
create or replace
PROCEDURE ABS_MSG_API
(cab IN VARCHAR2,
booking_ref IN NUMBER)
AS
l_cab VARCHAR2(10);
l_booking_ref NUMBER;
l_uuid VARCHAR2(50);
l_answer integer;
req utl_http.req;
resp utl_http.resp;
value clob;
listing VARCHAR2(400);
BEGIN
l_cab := cab;
l_booking_ref := booking_ref;
listing := 'https://........<site address>;
/* next you must identify the location of your wallet */
utl_http.set_wallet('file:C:\Documents and Settings\administrator\ORACLE\WALLETS','redy2go4it');
utl_http.set_transfer_timeout(60);
dbms_output.put_line(listing);
/* next we start the request. Though a GET here, a POST is the same thing */
req := utl_http.begin_request(listing,'GET','HTTP/1.1');
/* in my case a username and password are passed - think of this at your POST parameters */
utl_http.set_header(req,'Username',xxxx);
utl_http.set_header(req,'Password',xxxxx);
utl_http.set_header(req,'Version','99.99.99');
/* the rest is much like your code already, with some debug capability */
resp := utl_http.get_response(req);
DBMS_OUTPUT.PUT_LINE('Request Method....'||req.METHOD);
DBMS_OUTPUT.PUT_LINE('HTTP Response Status Code: ' || resp.status_code);
DBMS_OUTPUT.PUT_LINE('HTTP Response Reason Phrase: ' || resp.reason_phrase);
DBMS_OUTPUT.PUT_LINE('HTTP Response Version: ' || resp.http_version);
LOOP
utl_http.read_line(resp, value, TRUE);
l_answer := instr(value,'uuid',1,1);
IF l_answer > 0 THEN
l_uuid := substr(value,l_answer+6,36);
dbms_output.put_line('The string is.....'||l_uuid);
END IF;
IF l_answer > 0 THEN
send_dt_message(l_uuid,l_cab,l_booking_ref);
EXIT;
END IF;
END LOOP;
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
l_answer := instr(value,'uuid',1,1);
dbms_output.put_line('The value is......'||l_answer);
END ABS_MSG_API;
When you submit a POST, all of the parameters are passed as part of the header. You must determine exactly the information being expected by the remote system.
You can find further information is you search for HTTPS on Ask Tom. There is some useful stuff there.
I use UTL_HTTP for HTTPS requrests all the time. As I said, it is a bit tricky at first, but the key is the Oracle Wallet and then reading the UTL_HTTP documentation that comes on your DB media disc under PLSQL Packaged Procedures.
I hope this helps.
Bruce Clark -
I have been given a new requirement to send a zipped file(s) to a client using HTTPS using a Multipart Post.
I have found an example...
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1024);
BEGIN
req := utl_http.begin_request('http://www.psoug.org');
resp := utl_http.get_response(req);
LOOP
utl_http.read_line(resp, value, TRUE);
dbms_output.put_line(value);
END LOOP;
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;Which obviously returns and displays the HTML content of the URL, however we need to post zipped files in the content. We have been told by someone at Oracle that we can use the UTL_HTTP package to do this but when i search for this all i find is Java.
Can anyone point me in the right direction as to where to start and any code examples would be a great help.
Thanks in advance
Graham.I have been given a new requirement to send a zipped file(s) to a client using HTTPS using a Multipart Post.
I have found an example...
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1024);
BEGIN
req := utl_http.begin_request('http://www.psoug.org');
resp := utl_http.get_response(req);
LOOP
utl_http.read_line(resp, value, TRUE);
dbms_output.put_line(value);
END LOOP;
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;Which obviously returns and displays the HTML content of the URL, however we need to post zipped files in the content. We have been told by someone at Oracle that we can use the UTL_HTTP package to do this but when i search for this all i find is Java.
Can anyone point me in the right direction as to where to start and any code examples would be a great help.
Thanks in advance
Graham. -
Diff between Payroll Posting & Payment Posting
Hi Friends,
Whats difference between Payment Posting & Payroll Posting
regards
Praveen PThanks for the input.
After running the payroll posting, do we need to run Payment Posting for all the employees.
Which table will it update after payment posting.
If we are not activated PRE DME and DME. do we still need to run payment posting.
Praveen PP
Edited by: Praveen P.P on Oct 20, 2010 6:54 AM -
Wrong Posting Opposite Posting
Hi Gurus,
I would appreciate, if anyone could explain the meaning of Wrong Posting Opposite Posting in "Define Reason for Reversal".
Also, why do we choose Alt. Post Date for the same.
Please explain
Thanks
MohitHi,
When the document was posted obviously u will enter the posting date, Where as when u reverse the document, It should identify that the document has been reversed to the original document, for that we need to enter alt.posting date which will determine the reversal reason also.
Ex:Reversal of an incorrect posting in the same period.
Reversal of an incorrect posting in the subsequent period
Wrong posting or oposite postings are giving wrong account or wrong debit or credit.
Hope this will helpful.
Tx
veena -
Hello Gurus
i am posting for post dated cheques to vendor t code Fbw6 here i am getting the following error
Account type D is not defined for document type KZ
Thanks in advanceHi,
Your are saying that u r posting for vendors, then how come you are using Account type D it is for customers, u have to use Account Type K. Then that error will not come.
hope you understood.
regards
srikanth. -
Give me some examples for functions for read POST, write POST, modify POST
Give me some examples for functions for read POST, write POST, modify POST, create and delete theme in forum. This functions have to be make like Remote Methods
Give me some examples for functions for read POST, write POST, modify POST, create and delete theme in forum. This functions have to be make like Remote Methods
-
Double Posts/Triple Posts?
On other forums, performing a double post is a no-no. A triple post is unheard of. But here I've seen my first 7 posts in row.
http://forums.ni.com/t5/LabVIEW/Bit-coin-mining-with-FPGA-Single-board-reo/m-p/2475006#M757254
What is the longest you've seen? Do I hear 9? or 10?
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.altenbach wrote:
Some other forums do e.g. a MD5 hash of all recent posts, and if the hash of a new posts matches the hash of a recent existing posts, the post is rejected.
This will at least eliminate the duplicate posts due to forum malfunction.
Okay this I understand and it has happened to me a few times, but what I was more talking about is when someone posts a question, then replies with a semi-related question, and then an update to the first issue, then a third issue, then an update to the first issue, then a post about a forth issue. One of the more difficult things to do in a thread is talk about multiple subjects, or update a particular subject when there are many updates to it that are all one sided conversations.
I feel like after posting you need to give the community time to digest the post before posting again. This is another reason why I hate "Bump" posts just so your topic gets more exposure. It's like nagging someone to call you back. You left a message once, then twice, leaving 4 other messages telling them to call you back isn't going to make it happen any sooner. But I do see these "Bump" posts actually working so I guess that's why people do it.
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously. -
Assets table where We can know Depreciation Posted & Not Posted.
Dear All,
We are having Serious Problem In Assets Depreciation.
Can Anybody Pls let me know the table where we can find Assets , Depreciation Posted & Not Posted as we have to make some Analysis.
Thanks & Regards,
PankajHello
go to t093d which will suffice ur requirement
Regards
madhav -
P45 Platinum - Triple Posting/Dual Posting
Hi...
I searched many places on the net but could not come to a resolution. This seems like 'the' place. Well I have a P45 Platinum. It always double posts/triple posts before boot up. And this only happens on cold boot. So if I power down, and leave the UPS on, boot up is normal. If I turn the UPS off, then it mult-posts.
1. Will start (fans spin and no display) for 2 seconds.
2. Goes off for 2 seconds.
3. Again (1)
4. Again (2)
5. Again (3)
6. Again (4)
7. Posts and starts normal.
My system config is as:
MSI P45 Platinum (BIOS 1.6 dated 02/20/2009)
[email protected]@1.432V + CM Hyper 212
Corsair TWIN2X4096-8500C5(5-5-5-15)@2.1V@1016Mhz (could not get it to 1066 Mhz)
2 x HD4890[Xfire]@1000/900[MEM/GPU]
Corsair 650TX
Seagate 180GB+80GB
The CPU OC is perfectly stable. Have stressed it using OCCT / Prime95 / RealTEMP / Furmark. Can game for hours with no issue. Temperatures are good too.
thanks a ton....!
AnilQuote from: Jack t.N. on 06-January-10, 22:58:18
Remove your OC Settings...
Okay I bought the system to default, by loading and committing all values using the F6 in the BIOS. The system is first posting perfect.
FSB:DRAM ration = Auto
V - DRAM = Auto
SS = Yes
Ram is running at 534.6 Mhz (1:2 DRAM:FSB) @ 5-7-7-24.
Now the question is: How do I get this baby to run at 4.0 Ghz. With the quickest RAM speed. If I can not get quick RAM speed no issue, but I want the 4.0 Ghz speed for the CPU.
Quote from: Del UK on 06-January-10, 22:37:31
With the overclock you achieved and components..... I am 90% sure, that PSU (Even though good quality) does not have the power for first cold boot.
If you leave UPS on, parts of system still receiving power, so not as hard on PSU.
As quick test, what happens, if you removed 1 of the graphics cards and boot from cold?
I will give this a try, but default settings are working fine -- if I cannot get the 4.0 Ghz with quick RAM option, will load the OC and try with one GPU. -
Cannot post a post that contains the percent symbol
If you try and post a post that contains the percent symbol you get a server 500 error.
Hi Smion
You're right. I wanted to post and it was also not possible because of this percent sign.
In my opinion it's a forum coding bug.
I hope this problem will be solved in the future. -
http://pastebin.isawsome.net/pastebin.php?show=366
I'm trying to get a POST together to upload a local file to the tumblr api (tumblr.com). I keep getting Authorization Failed. I'm thinking it could be the header, or maybe a malformed URL (but that looks ok to me).
Anyways, code is above and below. I can't seem to find much documentation, so I figured I'd give the ol' BBS a shot.
def upvid(self):
password = self.password
email = self.email
BOUNDARY = 'bOn3dkjlDr3Y'
CRLF = '\r\n'
files = '/home/dude/warn.wav'
f=file('/home/dude/warn.wav')
fvalue = f.read()
ctype = mimetypes.guess_type(files)
L = []
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="files"; filename="%s"' % (files))
L.append('Content-Type: %s' %(ctype[0]))
L.append('')
L.append(fvalue)
L.append('--' + BOUNDARY + '--')
L.append('')
#body = CRLF.join(L)
body = ''.join(L)
values = {
'data' : body,
'type' : 'audio',
'password' : self.password,
'email' : self.email
values=urllib.urlencode(values)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
h = httplib.HTTPConnection(self.url)
headers = {'Content-Type': content_type }
h.follow_all_redirects = True
h.request('POST', '/api/write', values, headers)
print values
res = h.getresponse()
print res.status, res.reason, res.read()the code seems fine at a quick glance,
i checked using a web browser(GET) and it returns the same thing regardless of what input or lack thereof
i'm going to guess this is a problem with tumblr -
Cfhttp + post + multipart problem
Hi, I’m trying to make cfhttp request with post method and multipart=”yes” attrib (trying to emulate form submiting). I use CF8 build 8.01, Wireshark, FF 3.6.16.
The problem is that I get Status code: 500 Internal Server Error in response
My cf code:
<cfscript>
request.strRAtr = {
method="post",
url="….",
useragent="Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15 (.NET CLR 3.5.30729)",
redirect="no",
multipart = "yes";
result = "variables.strReqRes"
request.arrRParam = [
{ type = "header",
name="Host",
value="…"
{ type = "header",
name="Accept",
value="text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
{ type = "header",
name="Accept-Language",
value="en-us,en;q=0.5"
{ type = "header",
name="Accept-Encoding",
value="gzip,deflate"
{ type = "header",
name="Accept-Charset",
value="ISO-8859-1,utf-8;q=0.7,*;q=0.7"
{ type = "header",
name="Keep-Alive",
value="115"
{ type = "header",
name="Connection",
value="keep-alive"
{ type = "header",
name="Referer",
value="…."
request.strCookieParam = {
type="cgi",
name="Cookie",
value="……",
encoded="no"
</cfscript>
<cfhttp attributecollection="#request.strRAtr#">
<cfloop from="1" to="#arrayLen(request.arrRParam)#" index="i">
<cfhttpparam type = "#request.arrRParam[i].type#"
name = "#request.arrRParam[i].name#"
value = "#request.arrRParam[i].value#">
</cfloop>
<cfhttpparam type = "formfield"
name = "wizardMode"
value = "…">
<cfhttpparam attributecollection="#request.strCookieParam#">
</cfhttp>
I’ve analysed the Wireshark – the difference between cfrequest and request from FF is in <mime_multipart chunk> (I export captured data from Wireshark into PDML – xml packet detail)
From FF I’ve get:
<proto name="mime_multipart" showname="MIME Multipart Media Encapsulation, Type: multipart/form-data, Boundary: "---------------------------311112870412835"" size="4585" pos="936">
<field name="mime_multipart.type" showname="Type: multipart/form-data" size="0" pos="936" show="multipart/form-data"/>
<field name="" show="First boundary: -----------------------------311112870412835\r\n" size="46" pos="936" value="2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d333131313132383730343132 3833350d0a"/>
<field name="mime_multipart.part" showname="Encapsulated multipart part: " size="57" pos="982" show="" value="436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2277697a 6172644d6f6465220d0a0d0a74727565">
<field name="mime_multipart.header.content-disposition" showname="Content-Disposition: form-data; name="wizardMode"\r\n\r\n" size="53" pos="982" show="form-data;name=\"wizardMode\"" value="436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2277697a 6172644d6f6465220d0a0d0a"/>
<field name="data" value="74727565"/>
<field name="data.data" showname="Data: 74727565" size="4" pos="1035" show="74:72:75:65" value="74727565"/>
<field name="data.len" showname="Length: 4" size="0" pos="1035" show="4"/>
</field>
And from CFHTTP:
<proto name="mime_multipart" showname="MIME Multipart Media Encapsulation, Type: multipart/form-data, Boundary: "-----------------------------7d0d117230764"" size="6297" pos="1049">
<field name="mime_multipart.type" showname="Type: multipart/form-data" size="0" pos="1049" show="multipart/form-data"/>
<field name="" show="First boundary: -------------------------------7d0d117230764\r\n" size="46" pos="1049" value="2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d37643064313137323330 3736340d0a"/>
<field name="mime_multipart.part" showname="Encapsulated multipart part: (text/plain)" size="98" pos="1095" show="" value="436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2277697a 6172644d6f6465220d0a436f6e74656e742d547970653a20746578742f706c61696e3b20636861727365743d55 54462d380d0a0d0a74727565">
<field name="mime_multipart.header.content-disposition" showname="Content-Disposition: form-data; name="wizardMode"\r\n" size="51" pos="1095" show="form-data;name=\"wizardMode\"" value="436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2277697a 6172644d6f6465220d0a"/>
<field name="mime_multipart.header.content-type" showname="Content-Type: text/plain; charset=UTF-8\r\n\r\n" size="43" pos="1146" show="text/plain;charset=UTF-8" value="436f6e74656e742d547970653a20746578742f706c61696e3b20636861727365743d5554462d380d0a 0d0a"/>
<proto name="data-text-lines" showname="Line-based text data: text/plain" size="4" pos="1189">
<field name="" show="true" size="4" pos="1189" value="74727565"/>
</proto>
</field>
As you can see, CFHTTP creates «Encapsulated multipart part: (text/plain)» and «data-text-lines» – why??? I suppose, that this difference is explanation of Status code: 500 Internal Server Error in response. Am I right? And what I have to do for right post in that case?
Thanks.So, my question - my answer. First of all, my supposition about "...I suppose, that this difference is explanation of Status code: 500 Internal Server Error in response..." was WRONG!
For all people, who want to uderstand post_multipart I recomend to read RFC1341 (http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html)
My problem was on another side:
I post "wrong" example in this thread - in cfhttp I rote "...
<cfhttpparam type = "formfield"
name = "wizardMode"
value = "…">...
But actualy value was "-1". In CFML Reference on p.290 I found that: "...All
form field data must be encoded in this character encoding, and ColdFusion does not
URLEncode the data..."!!!!!
That's IT !!!!!
I forgot about URLEncodedFormat function - and this was my actual problem!!! -
Does anyone know anything about servlets and multipart posting?
im not getting much response on the servlet forum :(
http://forum.java.sun.com/thread.jspa?threadID=701292&tstart=0
(i'll link back to here too)I have a QR reader on my iphone. Works just brill. I've used it to create business cards, with a boat load more information on it (Including my duty times, etc)
Most of the QR readers in the App store are free, so give them a try. You can copy and paste the data just like normal text.
What application for them did you have in mind? -
Error in document date & posting date-- Posting period 001 2008 is not open
hi guru's
while doing vendor creation in XK01, i m not getting the data screens like address, ..etc.i m getting error..posting period not open". what does it mean..
What date i need to give in both fields...?
can anybody send a set of data for me to create a vendor to test for my bdc/lsmw?
can any help me step by step vendor creation in xk01,
I am getting this below....
Posting period 001 2008 is not open
Message no. F5201
Diagnosis
Period 001 of fiscal year 2008 is not open for posting for the variant of posting period 1000.
System Response
Processing cannot be continued.
Procedure
The error can have several causes. In order to eliminate the error, proceed as follows:
1. Check whether the posting date was entered correctly. The system determines the posting period by means of the date.
2. Check whether the required posting period is open for posting for the variant of posting period 1000 and account type +. Make sure that the period is open for posting.
To do this, specify a period interval in which the required period for the variant of posting period 1000 and account type + is contained.
Proceed
thanksHi
Kris is right, that message means you can't post a FI document in the period 1 (probably Gennuary) of the 2008, but this can't mean you can't create a new vendor.
So are you sure on trx?
If the trx is right perhaps somebody has inserted a control in a user-exit.
Max
Maybe you are looking for
-
Help needed to extract a value from Textfield
Hi, I am new to AWT prgramming . I have created a menu called " Menu System Test window " and it contains toplevel menu item "File" and File Menu contains subitems "Product Evaluation" and "Exit". When i click File->Product Evaluation it displays a n
-
why can't i print wireless?
-
Get the color of a pixel in an image
how can i do to get the color of a pixel in an image ??? Can anyone help me ?
-
I need to select and upload a image and corresponding url from an external website using file upload control in MVC4. Please help Latheesh K Contact No:+91-9747369936
-
Modify parameters gather_stats_job
Hi, I want modify the default parameters of job gather_stats_job. I d'ont know how Thanks