Question: Using RCurl to upload CEL files to a LIMS
0
gravatar for stephen@mnemosyne.co.uk
9.7 years ago by
Dear Bioconductor mailing list, I am trying without success to upload an Affy CEL file to a LIMS system using RCurl. The LIMS expects to receive a multipart formatted http post request with some metadata in the headers. When I try to create an RCurl statement to upload the file I get various errors complaining that Http GET is not supported on the server - any help or suggestions would be very gratefully received. uri <- "http://127.0.0.1:8080/tomcat/ezUploader" f = CFILE("example.CEL") fileOid="12345" analyticalGroup="12345" curlPerform(url=uri, httpheader=c(fileOid=fileOid, analyticalGroup=analyticalGroup), upload=TRUE, readdata=f@ref, infilesize=file.info(filename)[1, "size"]) An attempt to upload the given CEL file leads to a tomcat error - Apache Tomcat/6.0.18 - Error report - HTTP Status 405 - HTTP method PUT is not supported by this URL. The Java code below using the Apache HttpClient demonstrates what I am trying to achieve HttpPost httpPost = new HttpPost(url.toString()); MultipartEntity entity = new MultipartEntity(); entity.addPart("fileOid", new StringBody("12345", Charset.forName("UTF-8"))); FileBody fileBody = new FileBody(filename); entity.addPart(filename.getName(), fileBody); httpPost.setEntity(entity); Any help with the RCurl equivalent would be very gratefully received Thanks Stephen sessionInfo() R version 2.10.1 (2009-12-14) i386-apple-darwin8.11.1 locale: [1] C/UTF-8/C/C/C/C attached base packages: [1] tools stats graphics grDevices utils datasets methods [8] base other attached packages: [1] mnemosynePicnic_0.1.1 XML_2.6-0 RCurl_1.3-1 [4] bitops_1.0-4.1 [[alternative HTML version deleted]]
affy • 742 views
ADD COMMENTlink modified 9.7 years ago by Seth Falcon7.4k • written 9.7 years ago by stephen@mnemosyne.co.uk40
Answer: Using RCurl to upload CEL files to a LIMS
0
gravatar for Geoff Jentry
9.7 years ago by
Geoff Jentry50
Geoff Jentry50 wrote:
On Mon, 22 Mar 2010, stephen at mnemosyne.co.uk wrote: <snip> > HttpPost httpPost = new HttpPost(url.toString()); <snip> > Any help with the RCurl equivalent would be very gratefully received Have you played around with postForm?
ADD COMMENTlink written 9.7 years ago by Geoff Jentry50
On Mon, Mar 22, 2010 at 4:48 PM, Geoff Jentry <geoffjentry at="" hexdump.org=""> wrote: > On Mon, 22 Mar 2010, stephen at mnemosyne.co.uk wrote: > <snip> >> >> HttpPost httpPost = new HttpPost(url.toString()); > > <snip> >> >> Any help with the RCurl equivalent would be very gratefully received > > Have you played around with postForm? and fileUpload()? Sean
ADD REPLYlink written 9.7 years ago by Sean Davis21k
Thanks - fileUpload looks pretty promising, though documentation appears a little vague. I'll have a crack with this - any pointers would be great! Cheers Stephen On Mar 22, 2010, at 10:51 PM, Sean Davis wrote: > On Mon, Mar 22, 2010 at 4:48 PM, Geoff Jentry <geoffjentry at="" hexdump.org=""> wrote: >> On Mon, 22 Mar 2010, stephen at mnemosyne.co.uk wrote: >> <snip> >>> >>> HttpPost httpPost = new HttpPost(url.toString()); >> >> <snip> >>> >>> Any help with the RCurl equivalent would be very gratefully received >> >> Have you played around with postForm? > > and fileUpload()? > > Sean
ADD REPLYlink written 9.7 years ago by stephen@mnemosyne.co.uk40
postForm and curlPerform both behave identically, and use just slight differences in structure - no luck with either! Thanks for the suggestion though. Cheers Stephen On Mar 22, 2010, at 10:48 PM, Geoff Jentry wrote: > On Mon, 22 Mar 2010, stephen at mnemosyne.co.uk wrote: > <snip> >> HttpPost httpPost = new HttpPost(url.toString()); > <snip> >> Any help with the RCurl equivalent would be very gratefully received > > Have you played around with postForm?
ADD REPLYlink written 9.7 years ago by stephen@mnemosyne.co.uk40
Answer: Using RCurl to upload CEL files to a LIMS
0
gravatar for Seth Falcon
9.7 years ago by
Seth Falcon7.4k
Seth Falcon7.4k wrote:
Hi Stephen, On 3/22/10 12:37 PM, stephen at mnemosyne.co.uk wrote: > I am trying without success to upload an Affy CEL file to a LIMS > system using RCurl. > The LIMS expects to receive a multipart formatted http post request > with some metadata in the headers. When I try to create an RCurl > statement to upload the file I get various errors complaining that > Http GET is not supported on the server - any help or suggestions > would be very gratefully received. If your server wants an HTTP POST request with Content-Type: multipart/form-data, then maybe I can help. Otherwise, I'm not sure I know what you want from your description. Using the curl command line, I think you want something like this: curl -F "fileOid=12345" \ -F "analyticalGroup=bob" \ -F "thefile=@thedata.txt" \ http://your-server/ I think you can achieve this using RCurl as follows: > library("RCurl") > uri <- "http://your-server/" > postForm(uri, > fileOid = "1234", > analyticalGroup = "bob", > theFile = fileUpload(filename = "~/temp/thedata.txt", > contentType = "text/amazing"), > .encoding="uft-8") If that does not work for you, perhaps you can try finding the right incantation using the curl command line. With that, there is probably a way to figure out how to get RCurl to do what you want. + seth -- Seth Falcon Bioconductor Core Team | FHCRC
ADD COMMENTlink written 9.7 years ago by Seth Falcon7.4k
Dear Seth, Fantastic - this has the problem cracked! Cheers Stephen On Mar 27, 2010, at 1:55 AM, Seth Falcon wrote: > Hi Stephen, > > On 3/22/10 12:37 PM, stephen at mnemosyne.co.uk wrote: >> I am trying without success to upload an Affy CEL file to a LIMS >> system using RCurl. > >> The LIMS expects to receive a multipart formatted http post request >> with some metadata in the headers. When I try to create an RCurl >> statement to upload the file I get various errors complaining that >> Http GET is not supported on the server - any help or suggestions >> would be very gratefully received. > > If your server wants an HTTP POST request with Content-Type: multipart/form-data, then maybe I can help. Otherwise, I'm not sure I know what you want from your description. > > Using the curl command line, I think you want something like this: > > curl -F "fileOid=12345" \ > -F "analyticalGroup=bob" \ > -F "thefile=@thedata.txt" \ > http://your-server/ > > I think you can achieve this using RCurl as follows: > >> library("RCurl") >> uri <- "http://your-server/" >> postForm(uri, >> fileOid = "1234", >> analyticalGroup = "bob", >> theFile = fileUpload(filename = "~/temp/thedata.txt", >> contentType = "text/amazing"), >> .encoding="uft-8") > > If that does not work for you, perhaps you can try finding the right incantation using the curl command line. With that, there is probably a way to figure out how to get RCurl to do what you want. > > + seth > > > -- > Seth Falcon > Bioconductor Core Team | FHCRC
ADD REPLYlink written 9.7 years ago by stephen@mnemosyne.co.uk40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 267 users visited in the last hour