ok before I try it out since that will take time, when i had something similar to do, I just used a BeanShell preprocessor and used sampler.addArgument instead of forming a string and trying to send the post body, see if it works for you regards deepak
On Mon, Nov 9, 2009 at 9:49 AM, Richard Gaywood <[email protected]>wrote: > Hi Deepak! Thanks for your response. > > To clarify what I'm doing: my source page contains a number of tags like > this: > > <input value="a7684624-aa9d-4bdd-be3c-97e8d67485d4" > name="0eeaaef9-d725-4608-bcbb-6e4e55af41d3_1" type="radio" id="[snip]" > CssClass="rdbtn" GroupName="0eeaaef9-d725-4608-bcbb-6e4e55af41d3_1" > checked="checked" /> > > I am grabbing them with this regexp: > > <input > > value="([a-z0-9A-Z]{8}-[a-z0-9A-Z]{4}-[a-z0-9A-Z]{4}-[a-z0-9A-Z]{4}-[a-z0-9A-Z]{12})" > > name="([a-z0-9A-Z]{8}-[a-z0-9A-Z]{4}-[a-z0-9A-Z]{4}-[a-z0-9A-Z]{4}-[a-z0-9A-Z]{12}_1)".*?checked="checked" > > and then using a ForEach controller and a beanshell sampler to build the > following string contained in a JMeter variable: > > > d49c8919-36d2-4825-b739-ff10752f3ede_1=efa5f43d-395e-4c92-9579-bc4215b0773c&f855d8c6-9cd8-419e-836e-59ad55565dab_1=1c40bc35-86f8-4e30-aa5c-2efb7284c4e2&bd5b9945-3c29-4c81-b890-e782f2385471_1=dd78cbb0-2d00-48af-aa77-6a3b1af8bd15& > [etc etc] > > This string contains the = and & signs you would expect to see in a POST > body. But when JMeter sends this, it URI encodes those characters, so it > ends up sending: > > > a602b71a-95ab-4046-8b24-8454a6d8a295_1%3Dc8635002-86a7-4841-9d8d-68bd375b1236%26b212fb47-6261-4f74-b8bc-8c7b331ed21a_1%3D4bba8a26-5542-43ef-b8e3-f57a0e95d7b7%26a3cdbda4-ea65-4a0a-95b0-99b94fb782de_1 > [etc etc] > > Note that & has become %26 and = has become %3D. Then, of course, the web > service I'm calling doesn't seen all those name=value pairs, it just sees a > single parameter. This happens when the "encode?" tickbox on the > HTTPRequest > is ticked _or_ unticked. > > On Mon, Nov 9, 2009 at 5:14 PM, Deepak Shetty <[email protected]> wrote: > > > Hi > > a. When you say URL encode do you mean the %nn for non ascii characters > or > > the & encoded as & (because these are HTML encoded to escape & and > need > > to be dealt with differently). > > What does the source actually have? If the source html on which you are > > running your regex to extract data , is already encoded , then checking > or > > unchecking the checkbox will appear to have to no effect (it might get > > double encoded). can you add Debug samplers to check whether the data you > > are extracting out is correct or already encoded? > > b. Checking or Unchecking the encode value does work, you can try it > > standalone with a hardcoded string which has special characters like = or > + > > > > regards > > deepak > > > > > > On Mon, Nov 9, 2009 at 6:51 AM, Richard Gaywood < > [email protected] > > >wrote: > > > > > Hi list! Encountered a problem with JMeter (v2.3.4) that I cannot find > a > > > workaround for. Hoping someone has a suggestion I've overlooked. > > > > > > I have a complicated HTTP POST request (70+ parameters, with a number > of > > > variable substitutions). I've coded it up but encountered a problem > with > > > eleven parameters that were just GUID name/value pairings. Some work > with > > a > > > regular expression extractor, a Beanshell sampler, and a ForEach > > controller > > > has constructed these into a single JMeter variable with the usual > > > "name=value&name=value&name=value&" (etc) structure. > > > > > > My problem is, JMeter is insisting in URL encoding the JMeter variable > > > contents when I put it in the "send parameters with the request" > section, > > > regardless of how I tick or untick the "encode?" column. I found this > old > > > post by sebb: > > > > > > On Mon, Oct 8, 2007 at 7:40 PM, sebb <[email protected]> wrote: > > > > > >> OK, in that case I think there is a work-round. > > >> > > >> If you use parameters with values but *no names*, then HttpClient (and > > >> Java http) will include the values in the POST body as is with no > > >> encoding or equals signs. > > >> > > >> (This does not appear to be documented anywhere ... oops!) > > >> > > > > > > But this only seems to work when I only have one single line in the > > request > > > parameters config. As soon as I mix the workaround with normally > encoded > > > parameters, JMeter stops working. See my screenshot -- where I set two > > > parameters; the first a JMeter variable containing the string > > > "name=value&spam=eggs" and the other a normal parameter with name "ham" > > and > > > value "green". When I hit send, the POST parameters look like: > > > POST data: > > > ham=green > > > ...with no mention of the other two parameters. > > > > > > So... is there a workaround for this? Or do I need to manually URL > encode > > > my 60-odd parameters and put them all in a single Value box of my > > > HTTPClient? > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > >

