You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Sergio Boso <se...@bosoconsulting.it> on 2020/02/08 11:47:08 UTC

Programatically set POST binary content yìto HTTP sampler in Jmeter

Hi everybody,

I'm writing a Load test that send Time Stamping Requests to a Time Stamping Autority.

This is a standard protocol, described in rfc3161. This require a POST execution, sending a small ASN1 object, that is binary.

Now, I have written the groovy part that set up the ASN1 object, and that creates the *bytes[] array*, but I cannot copy to a 
variable, because the casting to a string *modifies* the content. However I cannot find any other way to pass this content.

Given the amount of traffic I have to generate, writing to a file and then attach it is not a viable solution.

Is there any other way to work around this issue?

Thank you in advance!




-- 

Ing. Sergio Boso



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


Re: Programatically set POST binary content yìto HTTP sampler in Jmeter

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 09.02.20 um 20:23 schrieb Sergio Boso:
> Yes it works!!
>
> Also I had to set the "Content encoding" in the Sampler to "ISO-8859-1".

So I guess you took the first variant?

> Thank you.

Glad it worked.

Felix

>
>
> Sergio
>
>
> Il 09/02/2020 12:50, Felix Schumacher ha scritto:
>> Am 08.02.20 um 12:47 schrieb Sergio Boso:
>>> Hi everybody,
>>>
>>> I'm writing a Load test that send Time Stamping Requests to a Time
>>> Stamping Autority.
>>>
>>> This is a standard protocol, described in rfc3161. This require a POST
>>> execution, sending a small ASN1 object, that is binary.
>>>
>>> Now, I have written the groovy part that set up the ASN1 object, and
>>> that creates the *bytes[] array*, but I cannot copy to a variable,
>>> because the casting to a string *modifies* the content. However I
>>> cannot find any other way to pass this content.
>> Have you tried to convert the bytes array to a string using an 8-bit
>> encoding like iso-8859-1?
>>
>>   String request = new String(asnBytes,
>> java.nio.charsets.StandardCharsets.ISO_8859_1)
>>
>> Another possibility would be to convert it to base64
>>
>>   String b64Request = Base64.mimeEncoder.encodeToString(x)
>>
>> and send that value with a content-transfer-encoding header set to
>> "base64".
>>
>> Felix
>>
>>> Given the amount of traffic I have to generate, writing to a file and
>>> then attach it is not a viable solution.
>>>
>>> Is there any other way to work around this issue?
>>>
>>> Thank you in advance!
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>
>

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


Re: Programatically set POST binary content yìto HTTP sampler in Jmeter

Posted by Sergio Boso <se...@bosoconsulting.it>.
Yes it works!!

Also I had to set the "Content encoding" in the Sampler to "ISO-8859-1".
Thank you.


Sergio


Il 09/02/2020 12:50, Felix Schumacher ha scritto:
> Am 08.02.20 um 12:47 schrieb Sergio Boso:
>> Hi everybody,
>>
>> I'm writing a Load test that send Time Stamping Requests to a Time
>> Stamping Autority.
>>
>> This is a standard protocol, described in rfc3161. This require a POST
>> execution, sending a small ASN1 object, that is binary.
>>
>> Now, I have written the groovy part that set up the ASN1 object, and
>> that creates the *bytes[] array*, but I cannot copy to a variable,
>> because the casting to a string *modifies* the content. However I
>> cannot find any other way to pass this content.
> Have you tried to convert the bytes array to a string using an 8-bit
> encoding like iso-8859-1?
>
>   String request = new String(asnBytes,
> java.nio.charsets.StandardCharsets.ISO_8859_1)
>
> Another possibility would be to convert it to base64
>
>   String b64Request = Base64.mimeEncoder.encodeToString(x)
>
> and send that value with a content-transfer-encoding header set to "base64".
>
> Felix
>
>> Given the amount of traffic I have to generate, writing to a file and
>> then attach it is not a viable solution.
>>
>> Is there any other way to work around this issue?
>>
>> Thank you in advance!
>>
>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>


-- 

Ing. Sergio Boso

Mail:
Cell:
Web:
Linkedin:
PEC:
Skype:

	

sergio@bosoconsulting.it <ma...@bosoconsulting.it>
+39 335 7243 445
www.bosoconsulting.it <http://www.bosoconsulting.it>
http://it.linkedin.com/in/sergioboso <http://www.linkedin.com/pub/sergio-boso/1/29b/255>
sergio.boso@ingpec.eu <ma...@ingpec.eu>
sbos61




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


Re: Programatically set POST binary content yìto HTTP sampler in Jmeter

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 08.02.20 um 12:47 schrieb Sergio Boso:
> Hi everybody,
>
> I'm writing a Load test that send Time Stamping Requests to a Time
> Stamping Autority.
>
> This is a standard protocol, described in rfc3161. This require a POST
> execution, sending a small ASN1 object, that is binary.
>
> Now, I have written the groovy part that set up the ASN1 object, and
> that creates the *bytes[] array*, but I cannot copy to a variable,
> because the casting to a string *modifies* the content. However I
> cannot find any other way to pass this content.

Have you tried to convert the bytes array to a string using an 8-bit
encoding like iso-8859-1?

 String request = new String(asnBytes,
java.nio.charsets.StandardCharsets.ISO_8859_1)

Another possibility would be to convert it to base64

 String b64Request = Base64.mimeEncoder.encodeToString(x)

and send that value with a content-transfer-encoding header set to "base64".

Felix

>
> Given the amount of traffic I have to generate, writing to a file and
> then attach it is not a viable solution.
>
> Is there any other way to work around this issue?
>
> Thank you in advance!
>
>
>
>

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