Sending binary data via a GET or POST REST call

Hello Everyone,

I'm creating a program that will use a REST interface to send a binary
file to the server but I'm really not sure how to do that. I know how
to do the REST call but how do I send binary data? The documentation
says I will send it as file_data=<raw_binary_data> in my GET request.

I'm using the HTTPWebRequest() and HTTPWebResponse() classes to do
this from the client.

Can anyone help?
Also, is the process much different to send via POST? Can anyone point
me in the right direction?

Thanks!
Anthony
0
Anthony
12/7/2009 3:39:01 AM
dotnet.languages.vb 830 articles. 0 followers. Follow

6 Replies
2139 Views

Similar Articles

[PageSpeed] 38

Small Correction:

The method is actually ONLY POST. So I guess my question is: from a
VB.NET application, how do I send raw binary data as part of my POST
request?
0
Anthony
12/7/2009 4:04:18 AM
Take a look at the System.Net.WebClient class.  It might be what you're 
looking for.

Mike.

"Anthony P." <papillion@gmail.com> wrote in message 
news:5d5210c9-b80e-4577-abdf-d75b98c3cdee@n13g2000vbe.googlegroups.com...
> Small Correction:
>
> The method is actually ONLY POST. So I guess my question is: from a
> VB.NET application, how do I send raw binary data as part of my POST
> request? 

0
Michael
12/7/2009 5:42:36 AM
On Dec 6, 11:42=A0pm, "Michael Ober" <obermd.@.alum.mit.edu.nospam>
wrote:
> Take a look at the System.Net.WebClient class. =A0It might be what you're
> looking for.

Thanks Mike! Close but not quiet. I need something I can pass
parameters along with (this is a REST call). WebClient doesn't allow
that. Any other ideas?
0
Anthony
12/7/2009 6:19:28 AM
Anthony P. wrote:
> On Dec 6, 11:42 pm, "Michael Ober"<obermd.@.alum.mit.edu.nospam>
> wrote:
>> Take a look at the System.Net.WebClient class.  It might be what you're
>> looking for.
>
> Thanks Mike! Close but not quiet. I need something I can pass
> parameters along with (this is a REST call). WebClient doesn't allow
> that. Any other ideas?

Have you looked at OpenRasta?

http://www.openrasta.com/
http://trac.caffeine-it.com/openrasta/wiki/Doc

HTH
0
Jason
12/7/2009 2:38:32 PM
> http://www.openrasta.com/http://trac.caffeine-it.com/openrasta/wiki/Doc

Jason,

Thanks but doesn't meet my needs. I'm not using ASP.NET. This is a
traditional desktop app that interacts with a REST service over the
internet. Certainly attaching binary data to a variable in a REST call
can't be that difficult where nobody knows how, can it?

Anthony
0
Anthony
12/7/2009 9:35:39 PM
Anthony P. wrote:
>> http://www.openrasta.com/http://trac.caffeine-it.com/openrasta/wiki/Doc
>
> Jason,
>
> Thanks but doesn't meet my needs. I'm not using ASP.NET. This is a
> traditional desktop app that interacts with a REST service over the
> internet. Certainly attaching binary data to a variable in a REST call
> can't be that difficult where nobody knows how, can it?
>
> Anthony

OpenRasta is not just for ASP.NET. If I were doing REST I'd probably use it.

If you haven't already solved your problem then these links might help:

http://www.shaneng.net/Main/Multi-PartFormPost
http://www.dotnet247.com/247reference/msgs/41/207812.aspx
http://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data
http://developer.nirvanix.com/forums/t/56.aspx
http://bytes.com/topic/c-sharp/answers/268661-how-upload-file-via-c-code
http://www.groupsrv.com/dotnet/post-373624.html
http://killustar.blogspot.com/2009/03/silverlight-multi-part-form-post.html

0
Jason
12/8/2009 12:18:26 PM
Reply:

Similar Artilces:

Post Dated Cheque in Receivables
Hi to All GP Tech, Here i have some confusion in Receivable/payable Module GP-8.0 SP-3,having complete Module sales-Receivable,SalesOrder Processing,Purchase&Payable,Inve ntory & Finance. 1-When preparing A Cash Reciepts for normal cash cheque or cash its straight prepare print and post , but what happen when postdated cheque comes as 12dec2006, $50.00, from Customer 'ABC' what should i do , how system and posting take care on the cheq realizeation date and how accounts GL side and as well as customer side will behave - is their any way it can be record , their is no p...

color coordinate data from IF results for charts
I want to show all data bars that are less than zero to be Red in color and all positive data bars be Green in color. All clearly explained by Jon at http://peltiertech.com/Excel/Charts/ConditionalChart1.html best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "ASME Help" <ASME Help@discussions.microsoft.com> wrote in message news:CD061F01-3E29-485E-ACAB-9DD95DC797FA@microsoft.com... >I want to show all data bars that are less than zero to be Red in color and > all positive data bars be Green in color. ...

delay sending out all emails outlook 2003
How do I permanently delay sending out all emails for 2 minutes if I realize there is an error or I forgot an attachment? Use Rules. http://www.outlook-tips.net/archives/2007/20070508.htm http://www.slipstick.com/emo/2008/up080508.htm#3 -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ Outlook Tips by email: dailytips-subscribe-request@lists.outlooktips.net Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Cente...

Fixed assets GL posting
After we have make a depuration in the FA module the user has log into the financial Batches & he delete it by mistake. So is there is any way to restore the GL batch or the GL transaction entry. By the way I tray to do "reset year" from tools * routines * FA * deprecate assets but it didn't work. so please advice. Not that I know, unless you restore from backup. else: 1) you may like to revert depn for that month, re-run depn, post to gl, then 'clean up' the FA batch that contains both 'revert depn' and 'depn' entries. 2) or just manually ent...

Sending large mails very slow
Hello, A friend of my works with Outlook 2003 (not Outlook Express) on a HP desktop pc with XP SP2 installed. When he sends a large email, it takes a lot of time before the mail was send. For example: it takes 2 minutes to send a mail of 2 MB, about 6 minutes to send a mail of 6 MB... On a second computer, he does not have that problem. The mailbox (pst-file) is about 476 MB. He uses ZoneAlarm en AVG Grisoft but we turned off those with no results. Also with an new, empty pst file, the system remains slow... Reinstalling Outlook isn't a solution (try that too)... Has anybody ideas? Si...

Intercept query parameter values from data refresh
Hi, Is there a way to determine the value a user specifies for a query parameter when using the "Refresh Data" command? I have a External data query to an SQL server database that contains a single parameter. I'd like to determine what the user entered for that parameter from within Excel vba code or other means. I'm running Excel XP on Windows XP. Any ideas would be greatly appreciated. Thanks in advance! Jim ...

Workflow for birthday reminder/email sending
I know one can search upcoming contacts birthdays by adding the month to form. But how can i automate it using workflow to send reminders/emails? ...

Excel Queries using Access data
Im trying to create a query from within Excel. When I select new database query and select a database which has no securtiy login/password, no problem, works fine. However, when I try to source the data from a database which I have created using user logins/passwords it says that I do not have admin privilages to use the database even though I am putting in the correct login/username in the popup window? Please can anyone help? I've had limited experience with this sort of thing but I've always had to strip out the protection on the Access Database and create a copy before suc...

Outlook Coding
I have code to send emails progamtically from a module in Excel 2000 using OUtlook 2000, but now I need to have the code select 1 of 5 different email addresses and potentially a different mail server. Any ideas? --------------------------------- Set NewMail = CreateObject("Outlook.Application") Set objmail = NewMail.CreateItem(olMailItem) With objmail .To = Email .Subject = "Quotes for " & Name .Body = emailtext .Send End With Set NewMail = Nothing Set objmail = Nothing ---------------------------------- Submitted...

Where can I get on-line training for Visio
I am new to Visio and would appreciate some advice on the best way to 'teach myself'. Many thanks try this, http://office.microsoft.com/en-us/results.aspx?Scope=RC&Query=visio al "annmez" <annmez@discussions.microsoft.com> wrote in message news:E051D59E-5DEF-4484-8BC9-EA62847C17A6@microsoft.com... >I am new to Visio and would appreciate some advice on the best way to >'teach > myself'. Many thanks ...

Help needed arranging data for a pivot table
I have a very large table in excel that I need to create a pivot tabl for, but can't seem to arrange the data correctly. Here's what th table looks like: There are about 20 "type" columns across the top and down the side are dates. For each day each of the columns ha about 20 prices. So a big block of mostly price data is added eac day. Do I have to have all of the prices in one column if I want t view different "types" side by side in a pivot table? If so, I woul have many many times the 65,000 rows that excel allows. This als seems ridiculously redundant. ...

Upgrading Outlook 2000 to Outlook 2002
I have the software to upgrade my Outlook 2000 to Outlook 2002, and am concerned about losing my appointments, contacts, and settings (rules, views). If I upgrade, will Outlook 2002 detect my settings before it "removes the previous version"? I'd really appreciate some help - I'm a little bored waiting for the hurricane so I'm hoping to occupy myself with this... Data is never removed with an upgrade. The connection to your data may well be lost, but can easily be reset if that's the case. You should already be backing up your Outlook regularly. The file...

How do I link data from two different excell files?
I have two excell spreadsheets that need to be matched up and merge a certain field. Is there a statement that wou vlookup HTH, -- Gary Brown gary.DeleteThis2SendMeAnEmail.Brown@kinneson.com "twinclstar" wrote: > I have two excell spreadsheets that need to be matched up and merge a certain > field. Is there a statement that wou ...

Can receive but can't send emails on Windows Mail
An unknown error has occurred. Subject 'good site for random camping sales', Account: 'Rowena', Server: 'smtp.slingshot.co.nz', Protocol: SMTP, Server Response: '421 Cannot connect to SMTP server 202.180.66.218 (202.180.66.218:25), connect error 10060', Port: 25, Secure(SSL): No, Server Error: 421, Error Number: 0x800CCC67 This is the error message I get when I try to send emails. Up until a couple of days ago I have been able so send emails fine but now it has stopped working. Any idea of how I can fix this and send emails again? Cheers This...

Conditional Data Entry
i work for the British Red Cross, we have a database for Public Events so we need to know who our volunteers are in Bedfordshire, Hertfordshire & Essex and what training courses they have passed, if they pass a set of certain courses then they qualify as Emergency response, if the pass a different set of courses they qualify for Event First Aid and if they passed a different set of courses they qualify as FESS which is Fire & Emergency Support Service. obviously some of the qualifications in each set overlap as is to be expected, anyways what we nee is for the database t...

Data not saving from bound form when control loses focus
Hello, I noticed this thread: http://groups.google.co.uk/group/microsoft.public.access.formscoding/browse_thread/thread/9cea14add792f567/47e8c7ca272a99b9?lnk=gst&q=save+data+control+focus#47e8c7ca272a99b9 In this thread it says that if a form is bound (which mine is to a query) when a user moves from control to control it should save when the control loses focus. It currently saves when users close or move from record to record however this is causing problems as sometimes users use a custom toolbar which opens up popup forms to perform other tasks, which dont close or affect the bound f...

Send automatic reply through specific account
I have setup my Outlook 2002 to work with 3 different email accounts. I also have rules to send automatic replies for 2 of those accounts. However, the problem is, the SMTP servers of the 2 accounts through which the auto replies are routed allow only 1 outgoing message per day. The third account (being a hotmail account) does not work with the rules wizard. So, can somebody out there tell me how Outlook can be set up such that all outgoing messages are routed through the third (hotmail) account (because hotmail seems to have no such limit)? Thanks in advance. you'll need to find a SMTP t...

toggling removable bit for A Data SDHC? (so XP sees SDHC as a Fixed Drive)
I want to convert my A Data brand 16 GB SDHC (Class 6) to type "fixed" instead of "removable" so I can install & run XP on the SDHC card, or extend the Mini's C:\ drive partition to the card as described here: How to extend system partition (extend c drive) to optimize the performance of your computer? http://www.partition-tool.com/easeus-partition-manager/extend-system-partition.htm Does anyone know where to find the utility or any instructions on how to toggle the Removable Media Bit (RMB) for this particular (A Data) SDHC card, so Windows an...

accessing XML data
Hi, I need to import data from XML to Access97 , what is the best way??? Is there any ODBC solution?? Thanx! Domac This was written with Access 2000 in view, but the idea should work. Check out the article at DBJ. http://www.databasejournal.com/features/msaccess/article.php/3310901 -- Danny J. Lesandrini dlesandrini@hotmail.com http://amazecreations.com/datafast "Domac" <dd.cc@cc.cc> wrote ... > Hi, > > I need to import data from XML to Access97 , what is the best way??? > > Is there any ODBC solution?? > > Thanx! > Domac > ...

Trying to sort by row and getting errors.
I'm trying to do a simple sort by rows instead of columns and every time I try to do it I get this message: This operation requires merged cells to be identically sized. What am I doing wrong? First of all, select all cells then Format>Cells>Alignment. Click the "merge cells" option a couple of times to clear it. Now try your sort. Merged cells cause many problems and are very rarely necessary. Use Center Across Selection instead. Gord Dibben MS Excel MVP On 11 Jun 2006 16:57:42 -0700, joe54345@gmail.com wrote: >I'm trying to do a simple sort by rows in...

after adding data, grafics not calculated until save and reload
I have a speadsheet ~52MB used for 42MB without problems in which I select y a list and with Vlookup analyse a subset to produce grafics of the data I have added some data ( of last year ) on one sheet of that now the grafic sheets wil not be recalculated until I save and reload the whole sheet I tried already: coppy the project coppy all sheets to a new project make a new grafic ( out of 30 grafic) reset fonts on the grafic sheets renewed title e.g. delete the added data of course I can start all over but that meens a 14 day job and no guaranty that is will help does some one know how ...

Posting Cash Receipts #2
Occasionally, when we are posting cash receipts, the system seems to lock up. Specifically, when we are in the Apply Sales Documents window, we have marked some invoices to apply a payment, and then we try to scroll down to invoices farther down the list. The Apply Sales Documents window flashes every couple of seconds, and does not scroll down the list as expected. We are unable to click elsewhere in the window when this happens, until the system "catches up" to our scrolling. This has happened to us maybe 3-4 times in the last 4 months, and it has lasted anywhere from 3-...

Sending xls files to pc xlsx users
Version: 2004 Operating System: Mac OS X 10.5 (Leopard) Hello, <br> My xls files are opening on my associates pc Office 2007 machines as a blue screen (shows toolbars, though). <br><br>Whats' missing? ...

sending mail to a group
Hello, how do I send mail to a certain group in my address book without having to add every email address individually? Thanks, AJS Post your Outlook version. State what you mean by a "group in my address book." That term has no meaning. Outlook does not use groups in the address book. It can, however, use a Distribution List in your Contacts Folder. -- Russ Valentine [MVP-Outlook] "AJS" <newsgroup@sorga.com> wrote in message news:ezUhgHXoHHA.1776@TK2MSFTNGP05.phx.gbl... > Hello, how do I send mail to a certain group in my address book without > having to...

Macros
I have created the following macro. Where I am calling in the "Details" Worksheet I would like to call in the same info for all of the Worksheets in the Workbook. How do I do that? Thanks in advance for any help!!!! Sub TMSTabulate() ' For each workbook in source directory ' open workbook ' '* TMSVersion = ThisWorkbook.CustomDocumentProperties("TMSVersion") FiscalYear = 2005 TabCell = 2 Ledger = "BUDGET" Period = 1 With Application.FileSearch .NewSearch .LookIn = ThisWorkbook.Worksheets("Settings").Range("BDIF...