You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by bobMeliev <b....@gmail.com> on 2014/09/12 15:25:33 UTC

How to send file with Beanshell

I want to send file with Beanshell but getting error:

Error in method invocation: Method setHTTPFiles(
org.apache.jmeter.protocol.http.util.HTTPFileArg ) not found in
class'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' 

Here is code:



How I can solve this problem? 



--
View this message in context: http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025.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: How to send file with Beanshell

Posted by bobMeliev <b....@gmail.com>.
Thanks, Beanshell script is working. 



--
View this message in context: http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025p5721047.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: How to send file with Beanshell

Posted by Deepak Shetty <sh...@gmail.com>.
The method setHTTPFiles accepts an array hence method not found
https://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.html


HTTPFileArg fileArg = new HTTPFileArg();
fileArg.setPath("d:/data.csv");
HTTPFileArg[] arr = new HTTPFileArg[1];
arr[0]=fileArg;
s.setHTTPFiles(arr);

As before though , for doing something like this you are better off with a
pre processor..(if needed)

On Sat, Sep 13, 2014 at 4:04 AM, bobMeliev <b....@gmail.com> wrote:

> Here is code: http://paste.ubuntu.com/8333869/
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025p5721038.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: How to send file with Beanshell

Posted by bobMeliev <b....@gmail.com>.
Here is code: http://paste.ubuntu.com/8333869/



--
View this message in context: http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025p5721038.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: How to send file with Beanshell

Posted by Deepak Shetty <sh...@gmail.com>.
No code came through in your email (attachments not supported in the
mailing list)

On Fri, Sep 12, 2014 at 6:25 AM, bobMeliev <b....@gmail.com> wrote:

> I want to send file with Beanshell but getting error:
>
> Error in method invocation: Method setHTTPFiles(
> org.apache.jmeter.protocol.http.util.HTTPFileArg ) not found in
> class'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'
>
> Here is code:
>
>
>
> How I can solve this problem?
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025.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: How to send file with Beanshell

Posted by Deepak Shetty <sh...@gmail.com>.
ah ok - I have only tried using the Bean Shell preprocessor to manipulate
the HTTP Sampler that it is the child of whereas you seem to be trying to
instantiate the http sampler within a sampler - in which case I dont know
the correct class
HTTPSampler
+BeanShell pre processor (which get the sampler and if I remember correctly
is of class HTTPSampler or HTTPSampler2 not the proxy class that you are
using.)

I dont think what you are trying is easy to do or even possible and will
probably need one of the devs to comment

On Sat, Sep 13, 2014 at 4:06 AM, bobMeliev <b....@gmail.com> wrote:

> I was learning howto use Beanshell in JMeter.
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025p5721039.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:Re: How to send file with Beanshell

Posted by Yi Wei <sc...@gmail.com>.
Beanshell is almost the same as java, you can check the details here. http://www.beanshell.org 发自邮箱大师 在2014年09月13日 19:06,bobMeliev写道: I was learning howto use Beanshell in JMeter. -- View this message in context: http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025p5721039.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: How to send file with Beanshell

Posted by bobMeliev <b....@gmail.com>.
I was learning howto use Beanshell in JMeter. 



--
View this message in context: http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025p5721039.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: How to send file with Beanshell

Posted by sebb <se...@gmail.com>.
On 12 September 2014 14:25, bobMeliev <b....@gmail.com> wrote:
> I want to send file with Beanshell but getting error:

Why can you not use the standard HTTP sampler?

> Error in method invocation: Method setHTTPFiles(
> org.apache.jmeter.protocol.http.util.HTTPFileArg ) not found in
> class'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'
>
> Here is code:
>
>
>
> How I can solve this problem?
>
>
>
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/How-to-send-file-with-Beanshell-tp5721025.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
>

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