Hi Amela,
I'm also a JMeter newbie so I feel your pain ;=)
Try passing the output of your regexp to your beanshell as a
commandline parameter ie. encode ${Attributes} in the parameter line
of the the GUI.
Then in your beanshell script you should be able to access it as:
String x = bsh.args[0];
Good luck,
Richard
On 8/2/06, amelaao <[EMAIL PROTECTED]> wrote:
I think my problem comes from the way I'm referencing this variable created
by RegEx from BeanShell.
My RegEx look like:
ReferenceName: Attributes
Regular Expression: <ProductAttributes>(.+?)</ProductAttributes>
Template: $1$
Match No: 1
and the BeanShell function string:
${__BeanShell(String str=vars.get("${Attributes}"); String newstr =
str.replace("<"\,"<p:"); return newstr;, )} .
I tried many combinations of
vars.get("${Attributes}");
vars.get("${Attributes_g1}");
vars.get("Attributes"); inside this BeanShell but each
returns null, although the RegExpression variable Attributes displayed
through a separate JavaRequest Sampler is perfectly valid, not null,
XML string.
Please help,
Amela
On 8/1/06, amelaao <[EMAIL PROTECTED]> wrote:
>
> so I would like my parameter productAttributes to get its value from
> this function string I created, but still no results:
> ${__BeanShell(String str = vars.get("Attributes"); String newstr =
> str.replace("<"\,"<p"); vars.put("productAttributes"\, newstr);, )}
>
> Any more ideas?
>
> Thanks,
> Amela
>
> On 8/1/06, amelaao <[EMAIL PROTECTED]> wrote:
> >
> > To explain this a bit more. This is a sequence:
> > 1. Variable Attributes is returned from a RegEx in a step before.
> > 2. I have a Soap RPC Sampler with a preprocessor - User Parameters. This
> > parameter NewAttributes needs to be populated with whatever BeanShell
> > function returns in order for that Soap RPC Request to form properly.
> >
> >
> >
> > On 8/1/06, Yanroy <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > I haven't tried this, and I don't really know what I'm talking about
> > > as I'm
> > > new to beanshell, but I suspect you want to use vars.get("Attributes"}
> > > and
> > > then vars.put("Attributes", newstr) to replace the value in Attributes
> > > with
> > > your new one. Or if you're just trying to use it immediately without
> > > storing it, perhaps just returning it like you are would work (that
> > > would
> > > make sense, but I'm not familiar with that syntax).
> > > --
> > > View this message in context:
http://www.nabble.com/User-Defined-variable-and-BeanShell-function-tf2036135.html#a5602766
> > >
> > > Sent from the JMeter - User forum at Nabble.com <http://nabble.com/>.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > Regards,
> > Amela
> >
>
>
>
> --
> Regards,
> Amela
>
--
Regards,
Amela
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]