You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Vipin Jain <vi...@gmail.com> on 2014/04/03 16:56:13 UTC

passing byte stream to upload document in HTTP sampler (Rest API)

Hi 

I am trying to send Upload File REst API request through HTTP sampler, I
have provided file path and mime type, but document uploaded with 1 KB in
size and the file path as it contents.

I have no clue how to pass byte stream of this document so that original
document would get upload.

please help how to pass byte stream to upload document in HTTP sampler (Rest
API)

Thanks
Vipin



-----
Vipin Jain
--
View this message in context: http://jmeter.512774.n5.nabble.com/passing-byte-stream-to-upload-document-in-HTTP-sampler-Rest-API-tp5719741.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


RE: passing byte stream to upload document in HTTP sampler (Rest API)

Posted by Jeff Ohrstrom <jo...@hotmail.com>.
You can turn the property '#log_level.httpclient.wire=debug' on so you can see what is being put out onto the wire byte by byte. This will tell you if it's picking up the document and spitting it out onto the wire.  

If it is, then there might be an encoding issue (charset property in the Content-type header). Your server returns utf-8, but jmeter defaults to iso-8859-1 (which i'm not sure the exact differences are, but could behave strangely in converting docx files).  

Alternatively, you could try to read the file yourself through a JSR223 pre-processor and pass a variable to the http sampler that does the work. Just read the file line by line and build a string to pass to the http sampler through vars.put(). 
 

> Date: Fri, 4 Apr 2014 00:28:57 -0700
> From: vipin.roby@gmail.com
> To: jmeter-user@jakarta.apache.org
> Subject: Re: passing byte stream to upload document in HTTP sampler (Rest API)
> 
> Hi
> 
> Thanks for the reply, here my request is PUT not post.
> I need to send bytestream of the document I want to upload
> Below is the request and response
> PUT
> https://spint.dev.syncplicity.com/SyncplicityConnector/SPConnector.svc/namespace/Site1_DocLib2/JMFolder1/133KBDOCFile.docx
> 
> PUT data:
> 
> D:\Syncplicity\Automaiton\Trials\UploadDocs\133KBDOCFile.docx
> 
> [no cookies]
> 
> Request Headers:
> Connection: keep-alive
> x-isi-ifs-target-type: object
> x-isi-ifs-site-url: http://SPOINT-3:8002/Site_Title_1
> Content-Type:
> application/vnd.openxmlformats-officedocument.wordprocessingml.document
> Content-Length: 63
> Host: spint.dev.syncplicity.com
> User-Agent: Apache-HttpClient/4.2.6 (java 1.5)
> 
> Response
> Response headers:
> HTTP/1.1 200 OK
> Cache-Control: private
> Content-Type: application/json; charset=utf-8
> Server: Microsoft-IIS/7.5
> x-isi-ifs-sharepoint-version: SharePoint Server 2010,SharePoint Server 2010
> X-AspNet-Version: 2.0.50727
> X-Powered-By: ASP.NET
> Date: Fri, 04 Apr 2014 07:16:17 GMT
> Content-Length: 2
> 
> 
> HTTPSampleResult fields:
> ContentType: application/json; charset=utf-8
> DataEncoding: utf-8
> 
> But document is uploaded 1 KB and file path as its contents.
> Real document is not uploaded.
> 
> Please help
> 
> -Vipin
> 
> 
> 
> -----
> Vipin Jain
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/passing-byte-stream-to-upload-document-in-HTTP-sampler-Rest-API-tp5719741p5719752.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
> 
 		 	   		  

Re: passing byte stream to upload document in HTTP sampler (Rest API)

Posted by Vipin Jain <vi...@gmail.com>.
Hi

Thanks for the reply, here my request is PUT not post.
I need to send bytestream of the document I want to upload
Below is the request and response
PUT
https://spint.dev.syncplicity.com/SyncplicityConnector/SPConnector.svc/namespace/Site1_DocLib2/JMFolder1/133KBDOCFile.docx

PUT data:

D:\Syncplicity\Automaiton\Trials\UploadDocs\133KBDOCFile.docx

[no cookies]

Request Headers:
Connection: keep-alive
x-isi-ifs-target-type: object
x-isi-ifs-site-url: http://SPOINT-3:8002/Site_Title_1
Content-Type:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Length: 63
Host: spint.dev.syncplicity.com
User-Agent: Apache-HttpClient/4.2.6 (java 1.5)

Response
Response headers:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
x-isi-ifs-sharepoint-version: SharePoint Server 2010,SharePoint Server 2010
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Fri, 04 Apr 2014 07:16:17 GMT
Content-Length: 2


HTTPSampleResult fields:
ContentType: application/json; charset=utf-8
DataEncoding: utf-8

But document is uploaded 1 KB and file path as its contents.
Real document is not uploaded.

Please help

-Vipin



-----
Vipin Jain
--
View this message in context: http://jmeter.512774.n5.nabble.com/passing-byte-stream-to-upload-document-in-HTTP-sampler-Rest-API-tp5719741p5719752.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org