You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Jatin Davey <ja...@cisco.com> on 2009/12/31 11:46:48 UTC

Extracting sessionid's from previously queried POST methods

Hi

I have a following sequence of HTTP Post requests :

-- Post request 1 (Does not return anything for me to extract)
-- Post request 2 (Does not return anything for me to extract)
-- Post request 3 (Here my client asks for session id by doing something 
like this : serviceName=GetSession)
-- Post request 4 (Here it posts to the server with some session id like 
"=*sessionid*&agentid"

All the subsequent POST requests are important for me as i pass some 
values which results in data storage in the DB. I need to extract the 
string : *sessionid *which is present between the '=' and '&' characters.

Please tell me how to go about this using JMeter.

Thanks
Jatin

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


Re: Extracting sessionid's from previously queried POST methods

Posted by Jatin Davey <ja...@cisco.com>.
Got it , Thanks Deepak , Sebb and Adrian. Extracted the session id and 
able to add data using JMeter with dynamically changing session id's. 
This would serve me to model lot more things in my tests.

Thanks
Jatin

Deepak Shetty wrote:
>> hat i meant here is that in XML we have a Tag which is for Sessionid and
>>     
> enclosing these tags only we get the session id that i >need to extract. So
> i thought it is the value assigned to that field which is tagged as
> <Sessionid>
> yes , but you still need an extractor.The regex would work as well  - though
> you'd have to change the regex something like <Sessionid>([^<]*)<
>
> regards
> deepak
>
>
>
> On Sun, Jan 3, 2010 at 10:28 PM, Jatin Davey <ja...@cisco.com> wrote:
>
>   
>> Hi Deepak
>>
>> Please see inline.
>>
>> Thanks
>> Jatin
>>
>>
>> Deepak Shetty wrote:
>>
>>     
>>> Please let me know which of these outputs should i rely to extract my
>>>       
>>>>         
>>> session id
>>> The output is the same in all cases , what you are doing in the results
>>> tree
>>> is just changing the way it is displayed to you. This has no bearing on
>>> how
>>> you extract the data. The responses you have shown show that the value is
>>> XML in which case the Regex Extractor (which works with any text response
>>> including XML) or the XPath Extractor (which works with XML or HTML with
>>> tidy) would be appropriate.
>>> LiveHTTPHeaders would only show you request and response headers. What you
>>> are looking at here is the body of the response. The headers should match
>>> in
>>> Firefox and JMeter.
>>>
>>>
>>>       
>> [Jatin] I will try with XPath extractor and let you know if i am successful
>> in doing so.
>>
>>  Also i feel that my session id is a unique value assigned to a field so
>>     
>>>> the
>>>>
>>>>
>>>>         
>>> value of the field is enough to extract in this case and no >regular
>>> expression is needed here
>>> Im not sure what you mean here. What do you mean by assigned to a field?
>>>
>>>       
>> [Jatin] what i meant here is that in XML we have a Tag which is for
>> Sessionid and enclosing these tags only we get the session id that i need to
>> extract. So i thought it is the value assigned to that field which is tagged
>> as <Sessionid>. Apologies for my ignorance in XML if i am wrong.
>>
>>  If
>>     
>>> this session id is unique and is generated differently, then you must
>>> extract it out (since you would probably need it for the next request ).
>>> if
>>> you mean that the session id is stored in some hidden field in the form ,
>>> you have to extract it and post it yourself, since JMeter would not
>>> automatically do it for you. The Proxy Server would record and repost the
>>> session id that was valid when you recorded the script, it would fail if
>>> you
>>> replayed the script without changing the session id to be dynamically
>>> extracted.
>>> regards
>>> deepak
>>>
>>> On Sun, Jan 3, 2010 at 10:00 PM, Jatin Davey <ja...@cisco.com> wrote:
>>>
>>>
>>>
>>>       
>>>> Ok, Now i am nearing to my solution. I used the HTTP Proxy server and
>>>> recorded a series of HTTPS Get and Post requests and came to the POST
>>>> method
>>>> that would respond back with the unique session id for me to catch using
>>>> the
>>>> regular expression. But here is the catch. When i sent out this mail
>>>> earlier
>>>> asking for a regular expression i was using HTTP Live Headers add on with
>>>> firefox but now when i used the same HTTP Post methods with JMeter and
>>>> recording the results using the results tree listener i am getting the
>>>> following things in the response data field:
>>>>
>>>> -- When viewed as a Text
>>>>
>>>>
>>>> <ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>
>>>>
>>>> -- When viewed as HTML
>>>> OK  6f041446-bf5b-46c8-ae49-b410b80d3d7d
>>>>
>>>> -- When viewed as XML
>>>>      - ServiceResponse
>>>>         - ServiceResult
>>>>           - OK
>>>>        - Sessionid
>>>>           - 6f041446-bf5b-46c8-ae49-b410b80d3d7d
>>>>
>>>> -- When viewed as JSON
>>>>
>>>>
>>>> <ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>
>>>>
>>>> Please let me know which of these outputs should i rely to extract my
>>>> session id , Also i feel that my session id is a unique value assigned to
>>>> a
>>>> field so the value of the field is enough to extract in this case and no
>>>> regular expression is needed here. Please correct me if i am wrong.
>>>>
>>>>
>>>> Thanks
>>>> Jatin
>>>>
>>>> Jatin Davey wrote:
>>>>
>>>>
>>>>
>>>>         
>>>>> Ok , I read through the user manual and came to understand that i need
>>>>> to
>>>>> use the Regular Expression extractor as mentioned by Sebb.
>>>>> Thanks for the input Sebb.
>>>>>
>>>>> Thanks
>>>>> Jatin
>>>>>
>>>>> Jatin Davey wrote:
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>> Hi Sebb
>>>>>>
>>>>>> You mentioned the following :
>>>>>>
>>>>>> Also, attach the RE  element as a child of the sampler that returns
>>>>>> the session id
>>>>>>
>>>>>> in the mail thread below.
>>>>>>
>>>>>> Did you mean the post - processor - Regular Expression Extractor.
>>>>>> Please
>>>>>> confirm.
>>>>>>
>>>>>> Thanks
>>>>>> Jatin
>>>>>>
>>>>>> sebb wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> On 31/12/2009, Adrian Speteanu <as...@gmail.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> i'm a bit rookie with the regex, but this one seems pretty easy, use
>>>>>>>> this
>>>>>>>>  expression:
>>>>>>>>
>>>>>>>>  ref_name:  extractedSessionId
>>>>>>>>  regex:        "=(.+)&
>>>>>>>>  template:   $1$
>>>>>>>>  match:      1
>>>>>>>>  default:      whatever
>>>>>>>>
>>>>>>>>  if you call ${extractedSessionId} you will receive your sessionid
>>>>>>>> including
>>>>>>>>  the " characters from your example.
>>>>>>>>
>>>>>>>>  this has been discussed recently, the (.+) formula is sloppy, you
>>>>>>>> should
>>>>>>>>  match whatever you know should be in the id, but it's should work in
>>>>>>>> your
>>>>>>>>  case. (for example, you could use  [a-z]+ instead of .+ if there are
>>>>>>>> only
>>>>>>>>  lower case alphabetical characters in the session id)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>> Or use
>>>>>>>
>>>>>>> "=([^&]+)&
>>>>>>>
>>>>>>> i.e. anything except & is captured
>>>>>>>
>>>>>>>  Also, attach the RE  element as a child of the sampler that returns
>>>>>>> the session id
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>>  On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>  > Hi
>>>>>>>>  >
>>>>>>>>  > I have a following sequence of HTTP Post requests :
>>>>>>>>  >
>>>>>>>>  > -- Post request 1 (Does not return anything for me to extract)
>>>>>>>>  > -- Post request 2 (Does not return anything for me to extract)
>>>>>>>>  > -- Post request 3 (Here my client asks for session id by doing
>>>>>>>> something
>>>>>>>>  > like this : serviceName=GetSession)
>>>>>>>>  > -- Post request 4 (Here it posts to the server with some session
>>>>>>>> id
>>>>>>>> like
>>>>>>>>  > "=*sessionid*&agentid"
>>>>>>>>  >
>>>>>>>>  > All the subsequent POST requests are important for me as i pass
>>>>>>>> some
>>>>>>>> values
>>>>>>>>  > which results in data storage in the DB. I need to extract the
>>>>>>>> string :
>>>>>>>>  > *sessionid *which is present between the '=' and '&' characters.
>>>>>>>>  >
>>>>>>>>  > Please tell me how to go about this using JMeter.
>>>>>>>>  >
>>>>>>>>  > Thanks
>>>>>>>>  > Jatin
>>>>>>>>  >
>>>>>>>>  >
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>  > To unsubscribe, e-mail:
>>>>>>>> jmeter-user-unsubscribe@jakarta.apache.org
>>>>>>>>  > For additional commands, e-mail:
>>>>>>>> jmeter-user-help@jakarta.apache.org
>>>>>>>>  >
>>>>>>>>  >
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>         
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>>     
>
>   

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


Re: Extracting sessionid's from previously queried POST methods

Posted by Deepak Shetty <sh...@gmail.com>.
>hat i meant here is that in XML we have a Tag which is for Sessionid and
enclosing these tags only we get the session id that i >need to extract. So
i thought it is the value assigned to that field which is tagged as
<Sessionid>
yes , but you still need an extractor.The regex would work as well  - though
you'd have to change the regex something like <Sessionid>([^<]*)<

regards
deepak



On Sun, Jan 3, 2010 at 10:28 PM, Jatin Davey <ja...@cisco.com> wrote:

> Hi Deepak
>
> Please see inline.
>
> Thanks
> Jatin
>
>
> Deepak Shetty wrote:
>
>> Please let me know which of these outputs should i rely to extract my
>>>
>>>
>> session id
>> The output is the same in all cases , what you are doing in the results
>> tree
>> is just changing the way it is displayed to you. This has no bearing on
>> how
>> you extract the data. The responses you have shown show that the value is
>> XML in which case the Regex Extractor (which works with any text response
>> including XML) or the XPath Extractor (which works with XML or HTML with
>> tidy) would be appropriate.
>> LiveHTTPHeaders would only show you request and response headers. What you
>> are looking at here is the body of the response. The headers should match
>> in
>> Firefox and JMeter.
>>
>>
> [Jatin] I will try with XPath extractor and let you know if i am successful
> in doing so.
>
>  Also i feel that my session id is a unique value assigned to a field so
>>> the
>>>
>>>
>> value of the field is enough to extract in this case and no >regular
>> expression is needed here
>> Im not sure what you mean here. What do you mean by assigned to a field?
>>
> [Jatin] what i meant here is that in XML we have a Tag which is for
> Sessionid and enclosing these tags only we get the session id that i need to
> extract. So i thought it is the value assigned to that field which is tagged
> as <Sessionid>. Apologies for my ignorance in XML if i am wrong.
>
>  If
>> this session id is unique and is generated differently, then you must
>> extract it out (since you would probably need it for the next request ).
>> if
>> you mean that the session id is stored in some hidden field in the form ,
>> you have to extract it and post it yourself, since JMeter would not
>> automatically do it for you. The Proxy Server would record and repost the
>> session id that was valid when you recorded the script, it would fail if
>> you
>> replayed the script without changing the session id to be dynamically
>> extracted.
>> regards
>> deepak
>>
>> On Sun, Jan 3, 2010 at 10:00 PM, Jatin Davey <ja...@cisco.com> wrote:
>>
>>
>>
>>> Ok, Now i am nearing to my solution. I used the HTTP Proxy server and
>>> recorded a series of HTTPS Get and Post requests and came to the POST
>>> method
>>> that would respond back with the unique session id for me to catch using
>>> the
>>> regular expression. But here is the catch. When i sent out this mail
>>> earlier
>>> asking for a regular expression i was using HTTP Live Headers add on with
>>> firefox but now when i used the same HTTP Post methods with JMeter and
>>> recording the results using the results tree listener i am getting the
>>> following things in the response data field:
>>>
>>> -- When viewed as a Text
>>>
>>>
>>> <ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>
>>>
>>> -- When viewed as HTML
>>> OK  6f041446-bf5b-46c8-ae49-b410b80d3d7d
>>>
>>> -- When viewed as XML
>>>      - ServiceResponse
>>>         - ServiceResult
>>>           - OK
>>>        - Sessionid
>>>           - 6f041446-bf5b-46c8-ae49-b410b80d3d7d
>>>
>>> -- When viewed as JSON
>>>
>>>
>>> <ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>
>>>
>>> Please let me know which of these outputs should i rely to extract my
>>> session id , Also i feel that my session id is a unique value assigned to
>>> a
>>> field so the value of the field is enough to extract in this case and no
>>> regular expression is needed here. Please correct me if i am wrong.
>>>
>>>
>>> Thanks
>>> Jatin
>>>
>>> Jatin Davey wrote:
>>>
>>>
>>>
>>>> Ok , I read through the user manual and came to understand that i need
>>>> to
>>>> use the Regular Expression extractor as mentioned by Sebb.
>>>> Thanks for the input Sebb.
>>>>
>>>> Thanks
>>>> Jatin
>>>>
>>>> Jatin Davey wrote:
>>>>
>>>>
>>>>
>>>>> Hi Sebb
>>>>>
>>>>> You mentioned the following :
>>>>>
>>>>> Also, attach the RE  element as a child of the sampler that returns
>>>>> the session id
>>>>>
>>>>> in the mail thread below.
>>>>>
>>>>> Did you mean the post - processor - Regular Expression Extractor.
>>>>> Please
>>>>> confirm.
>>>>>
>>>>> Thanks
>>>>> Jatin
>>>>>
>>>>> sebb wrote:
>>>>>
>>>>>
>>>>>
>>>>>> On 31/12/2009, Adrian Speteanu <as...@gmail.com> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> i'm a bit rookie with the regex, but this one seems pretty easy, use
>>>>>>> this
>>>>>>>  expression:
>>>>>>>
>>>>>>>  ref_name:  extractedSessionId
>>>>>>>  regex:        "=(.+)&
>>>>>>>  template:   $1$
>>>>>>>  match:      1
>>>>>>>  default:      whatever
>>>>>>>
>>>>>>>  if you call ${extractedSessionId} you will receive your sessionid
>>>>>>> including
>>>>>>>  the " characters from your example.
>>>>>>>
>>>>>>>  this has been discussed recently, the (.+) formula is sloppy, you
>>>>>>> should
>>>>>>>  match whatever you know should be in the id, but it's should work in
>>>>>>> your
>>>>>>>  case. (for example, you could use  [a-z]+ instead of .+ if there are
>>>>>>> only
>>>>>>>  lower case alphabetical characters in the session id)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> Or use
>>>>>>
>>>>>> "=([^&]+)&
>>>>>>
>>>>>> i.e. anything except & is captured
>>>>>>
>>>>>>  Also, attach the RE  element as a child of the sampler that returns
>>>>>> the session id
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>  On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>  > Hi
>>>>>>>  >
>>>>>>>  > I have a following sequence of HTTP Post requests :
>>>>>>>  >
>>>>>>>  > -- Post request 1 (Does not return anything for me to extract)
>>>>>>>  > -- Post request 2 (Does not return anything for me to extract)
>>>>>>>  > -- Post request 3 (Here my client asks for session id by doing
>>>>>>> something
>>>>>>>  > like this : serviceName=GetSession)
>>>>>>>  > -- Post request 4 (Here it posts to the server with some session
>>>>>>> id
>>>>>>> like
>>>>>>>  > "=*sessionid*&agentid"
>>>>>>>  >
>>>>>>>  > All the subsequent POST requests are important for me as i pass
>>>>>>> some
>>>>>>> values
>>>>>>>  > which results in data storage in the DB. I need to extract the
>>>>>>> string :
>>>>>>>  > *sessionid *which is present between the '=' and '&' characters.
>>>>>>>  >
>>>>>>>  > Please tell me how to go about this using JMeter.
>>>>>>>  >
>>>>>>>  > Thanks
>>>>>>>  > Jatin
>>>>>>>  >
>>>>>>>  >
>>>>>>> ---------------------------------------------------------------------
>>>>>>>  > To unsubscribe, e-mail:
>>>>>>> jmeter-user-unsubscribe@jakarta.apache.org
>>>>>>>  > For additional commands, e-mail:
>>>>>>> jmeter-user-help@jakarta.apache.org
>>>>>>>  >
>>>>>>>  >
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Extracting sessionid's from previously queried POST methods

Posted by Jatin Davey <ja...@cisco.com>.
Hi Deepak

Please see inline.

Thanks
Jatin

Deepak Shetty wrote:
>> Please let me know which of these outputs should i rely to extract my
>>     
> session id
> The output is the same in all cases , what you are doing in the results tree
> is just changing the way it is displayed to you. This has no bearing on how
> you extract the data. The responses you have shown show that the value is
> XML in which case the Regex Extractor (which works with any text response
> including XML) or the XPath Extractor (which works with XML or HTML with
> tidy) would be appropriate.
> LiveHTTPHeaders would only show you request and response headers. What you
> are looking at here is the body of the response. The headers should match in
> Firefox and JMeter.
>   
[Jatin] I will try with XPath extractor and let you know if i am 
successful in doing so.
>> Also i feel that my session id is a unique value assigned to a field so the
>>     
> value of the field is enough to extract in this case and no >regular
> expression is needed here
> Im not sure what you mean here. What do you mean by assigned to a field? 
[Jatin] what i meant here is that in XML we have a Tag which is for 
Sessionid and enclosing these tags only we get the session id that i 
need to extract. So i thought it is the value assigned to that field 
which is tagged as <Sessionid>. Apologies for my ignorance in XML if i 
am wrong.
> If
> this session id is unique and is generated differently, then you must
> extract it out (since you would probably need it for the next request ). if
> you mean that the session id is stored in some hidden field in the form ,
> you have to extract it and post it yourself, since JMeter would not
> automatically do it for you. The Proxy Server would record and repost the
> session id that was valid when you recorded the script, it would fail if you
> replayed the script without changing the session id to be dynamically
> extracted.
> regards
> deepak
>
> On Sun, Jan 3, 2010 at 10:00 PM, Jatin Davey <ja...@cisco.com> wrote:
>
>   
>> Ok, Now i am nearing to my solution. I used the HTTP Proxy server and
>> recorded a series of HTTPS Get and Post requests and came to the POST method
>> that would respond back with the unique session id for me to catch using the
>> regular expression. But here is the catch. When i sent out this mail earlier
>> asking for a regular expression i was using HTTP Live Headers add on with
>> firefox but now when i used the same HTTP Post methods with JMeter and
>> recording the results using the results tree listener i am getting the
>> following things in the response data field:
>>
>> -- When viewed as a Text
>>
>> <ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>
>>
>> -- When viewed as HTML
>> OK  6f041446-bf5b-46c8-ae49-b410b80d3d7d
>>
>> -- When viewed as XML
>>       - ServiceResponse
>>          - ServiceResult
>>            - OK
>>         - Sessionid
>>            - 6f041446-bf5b-46c8-ae49-b410b80d3d7d
>>
>> -- When viewed as JSON
>>
>> <ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>
>>
>> Please let me know which of these outputs should i rely to extract my
>> session id , Also i feel that my session id is a unique value assigned to a
>> field so the value of the field is enough to extract in this case and no
>> regular expression is needed here. Please correct me if i am wrong.
>>
>>
>> Thanks
>> Jatin
>>
>> Jatin Davey wrote:
>>
>>     
>>> Ok , I read through the user manual and came to understand that i need to
>>> use the Regular Expression extractor as mentioned by Sebb.
>>> Thanks for the input Sebb.
>>>
>>> Thanks
>>> Jatin
>>>
>>> Jatin Davey wrote:
>>>
>>>       
>>>> Hi Sebb
>>>>
>>>> You mentioned the following :
>>>>
>>>> Also, attach the RE  element as a child of the sampler that returns
>>>> the session id
>>>>
>>>> in the mail thread below.
>>>>
>>>> Did you mean the post - processor - Regular Expression Extractor. Please
>>>> confirm.
>>>>
>>>> Thanks
>>>> Jatin
>>>>
>>>> sebb wrote:
>>>>
>>>>         
>>>>> On 31/12/2009, Adrian Speteanu <as...@gmail.com> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> i'm a bit rookie with the regex, but this one seems pretty easy, use
>>>>>> this
>>>>>>  expression:
>>>>>>
>>>>>>  ref_name:  extractedSessionId
>>>>>>  regex:        "=(.+)&
>>>>>>  template:   $1$
>>>>>>  match:      1
>>>>>>  default:      whatever
>>>>>>
>>>>>>  if you call ${extractedSessionId} you will receive your sessionid
>>>>>> including
>>>>>>  the " characters from your example.
>>>>>>
>>>>>>  this has been discussed recently, the (.+) formula is sloppy, you
>>>>>> should
>>>>>>  match whatever you know should be in the id, but it's should work in
>>>>>> your
>>>>>>  case. (for example, you could use  [a-z]+ instead of .+ if there are
>>>>>> only
>>>>>>  lower case alphabetical characters in the session id)
>>>>>>
>>>>>>
>>>>>>             
>>>>> Or use
>>>>>
>>>>> "=([^&]+)&
>>>>>
>>>>> i.e. anything except & is captured
>>>>>
>>>>>  Also, attach the RE  element as a child of the sampler that returns
>>>>> the session id
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>>  On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com>
>>>>>> wrote:
>>>>>>
>>>>>>  > Hi
>>>>>>  >
>>>>>>  > I have a following sequence of HTTP Post requests :
>>>>>>  >
>>>>>>  > -- Post request 1 (Does not return anything for me to extract)
>>>>>>  > -- Post request 2 (Does not return anything for me to extract)
>>>>>>  > -- Post request 3 (Here my client asks for session id by doing
>>>>>> something
>>>>>>  > like this : serviceName=GetSession)
>>>>>>  > -- Post request 4 (Here it posts to the server with some session id
>>>>>> like
>>>>>>  > "=*sessionid*&agentid"
>>>>>>  >
>>>>>>  > All the subsequent POST requests are important for me as i pass some
>>>>>> values
>>>>>>  > which results in data storage in the DB. I need to extract the
>>>>>> string :
>>>>>>  > *sessionid *which is present between the '=' and '&' characters.
>>>>>>  >
>>>>>>  > Please tell me how to go about this using JMeter.
>>>>>>  >
>>>>>>  > Thanks
>>>>>>  > Jatin
>>>>>>  >
>>>>>>  >
>>>>>> ---------------------------------------------------------------------
>>>>>>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>>>  > For additional commands, e-mail:
>>>>>> jmeter-user-help@jakarta.apache.org
>>>>>>  >
>>>>>>  >
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>>     
>
>   

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


Re: Extracting sessionid's from previously queried POST methods

Posted by Deepak Shetty <sh...@gmail.com>.
>Please let me know which of these outputs should i rely to extract my
session id
The output is the same in all cases , what you are doing in the results tree
is just changing the way it is displayed to you. This has no bearing on how
you extract the data. The responses you have shown show that the value is
XML in which case the Regex Extractor (which works with any text response
including XML) or the XPath Extractor (which works with XML or HTML with
tidy) would be appropriate.
LiveHTTPHeaders would only show you request and response headers. What you
are looking at here is the body of the response. The headers should match in
Firefox and JMeter.
>Also i feel that my session id is a unique value assigned to a field so the
value of the field is enough to extract in this case and no >regular
expression is needed here
Im not sure what you mean here. What do you mean by assigned to a field? If
this session id is unique and is generated differently, then you must
extract it out (since you would probably need it for the next request ). if
you mean that the session id is stored in some hidden field in the form ,
you have to extract it and post it yourself, since JMeter would not
automatically do it for you. The Proxy Server would record and repost the
session id that was valid when you recorded the script, it would fail if you
replayed the script without changing the session id to be dynamically
extracted.
regards
deepak

On Sun, Jan 3, 2010 at 10:00 PM, Jatin Davey <ja...@cisco.com> wrote:

> Ok, Now i am nearing to my solution. I used the HTTP Proxy server and
> recorded a series of HTTPS Get and Post requests and came to the POST method
> that would respond back with the unique session id for me to catch using the
> regular expression. But here is the catch. When i sent out this mail earlier
> asking for a regular expression i was using HTTP Live Headers add on with
> firefox but now when i used the same HTTP Post methods with JMeter and
> recording the results using the results tree listener i am getting the
> following things in the response data field:
>
> -- When viewed as a Text
>
> <ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>
>
> -- When viewed as HTML
> OK  6f041446-bf5b-46c8-ae49-b410b80d3d7d
>
> -- When viewed as XML
>       - ServiceResponse
>          - ServiceResult
>            - OK
>         - Sessionid
>            - 6f041446-bf5b-46c8-ae49-b410b80d3d7d
>
> -- When viewed as JSON
>
> <ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>
>
> Please let me know which of these outputs should i rely to extract my
> session id , Also i feel that my session id is a unique value assigned to a
> field so the value of the field is enough to extract in this case and no
> regular expression is needed here. Please correct me if i am wrong.
>
>
> Thanks
> Jatin
>
> Jatin Davey wrote:
>
>> Ok , I read through the user manual and came to understand that i need to
>> use the Regular Expression extractor as mentioned by Sebb.
>> Thanks for the input Sebb.
>>
>> Thanks
>> Jatin
>>
>> Jatin Davey wrote:
>>
>>> Hi Sebb
>>>
>>> You mentioned the following :
>>>
>>> Also, attach the RE  element as a child of the sampler that returns
>>> the session id
>>>
>>> in the mail thread below.
>>>
>>> Did you mean the post - processor - Regular Expression Extractor. Please
>>> confirm.
>>>
>>> Thanks
>>> Jatin
>>>
>>> sebb wrote:
>>>
>>>> On 31/12/2009, Adrian Speteanu <as...@gmail.com> wrote:
>>>>
>>>>
>>>>> i'm a bit rookie with the regex, but this one seems pretty easy, use
>>>>> this
>>>>>  expression:
>>>>>
>>>>>  ref_name:  extractedSessionId
>>>>>  regex:        "=(.+)&
>>>>>  template:   $1$
>>>>>  match:      1
>>>>>  default:      whatever
>>>>>
>>>>>  if you call ${extractedSessionId} you will receive your sessionid
>>>>> including
>>>>>  the " characters from your example.
>>>>>
>>>>>  this has been discussed recently, the (.+) formula is sloppy, you
>>>>> should
>>>>>  match whatever you know should be in the id, but it's should work in
>>>>> your
>>>>>  case. (for example, you could use  [a-z]+ instead of .+ if there are
>>>>> only
>>>>>  lower case alphabetical characters in the session id)
>>>>>
>>>>>
>>>>
>>>> Or use
>>>>
>>>> "=([^&]+)&
>>>>
>>>> i.e. anything except & is captured
>>>>
>>>>  Also, attach the RE  element as a child of the sampler that returns
>>>> the session id
>>>>
>>>>
>>>>
>>>>
>>>>>  On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com>
>>>>> wrote:
>>>>>
>>>>>  > Hi
>>>>>  >
>>>>>  > I have a following sequence of HTTP Post requests :
>>>>>  >
>>>>>  > -- Post request 1 (Does not return anything for me to extract)
>>>>>  > -- Post request 2 (Does not return anything for me to extract)
>>>>>  > -- Post request 3 (Here my client asks for session id by doing
>>>>> something
>>>>>  > like this : serviceName=GetSession)
>>>>>  > -- Post request 4 (Here it posts to the server with some session id
>>>>> like
>>>>>  > "=*sessionid*&agentid"
>>>>>  >
>>>>>  > All the subsequent POST requests are important for me as i pass some
>>>>> values
>>>>>  > which results in data storage in the DB. I need to extract the
>>>>> string :
>>>>>  > *sessionid *which is present between the '=' and '&' characters.
>>>>>  >
>>>>>  > Please tell me how to go about this using JMeter.
>>>>>  >
>>>>>  > Thanks
>>>>>  > Jatin
>>>>>  >
>>>>>  >
>>>>> ---------------------------------------------------------------------
>>>>>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>>  > For additional commands, e-mail:
>>>>> jmeter-user-help@jakarta.apache.org
>>>>>  >
>>>>>  >
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Extracting sessionid's from previously queried POST methods

Posted by Jatin Davey <ja...@cisco.com>.
Ok, Now i am nearing to my solution. I used the HTTP Proxy server and 
recorded a series of HTTPS Get and Post requests and came to the POST 
method that would respond back with the unique session id for me to 
catch using the regular expression. But here is the catch. When i sent 
out this mail earlier asking for a regular expression i was using HTTP 
Live Headers add on with firefox but now when i used the same HTTP Post 
methods with JMeter and recording the results using the results tree 
listener i am getting the following things in the response data field:

-- When viewed as a Text
<ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>

-- When viewed as HTML
OK  6f041446-bf5b-46c8-ae49-b410b80d3d7d

-- When viewed as XML
        - ServiceResponse
           - ServiceResult
             - OK
          - Sessionid
             - 6f041446-bf5b-46c8-ae49-b410b80d3d7d

-- When viewed as JSON
<ServiceResponse><ServiceResult>OK</ServiceResult><SessionId>6f041446-bf5b-46c8-ae49-b410b80d3d7d</SessionId></ServiceResponse>

Please let me know which of these outputs should i rely to extract my 
session id , Also i feel that my session id is a unique value assigned 
to a field so the value of the field is enough to extract in this case 
and no regular expression is needed here. Please correct me if i am wrong.

Thanks
Jatin

Jatin Davey wrote:
> Ok , I read through the user manual and came to understand that i need 
> to use the Regular Expression extractor as mentioned by Sebb.
> Thanks for the input Sebb.
>
> Thanks
> Jatin
>
> Jatin Davey wrote:
>> Hi Sebb
>>
>> You mentioned the following :
>>
>> Also, attach the RE  element as a child of the sampler that returns
>> the session id
>>
>> in the mail thread below.
>>
>> Did you mean the post - processor - Regular Expression Extractor. 
>> Please confirm.
>>
>> Thanks
>> Jatin
>>
>> sebb wrote:
>>> On 31/12/2009, Adrian Speteanu <as...@gmail.com> wrote:
>>>  
>>>> i'm a bit rookie with the regex, but this one seems pretty easy, 
>>>> use this
>>>>  expression:
>>>>
>>>>  ref_name:  extractedSessionId
>>>>  regex:        "=(.+)&
>>>>  template:   $1$
>>>>  match:      1
>>>>  default:      whatever
>>>>
>>>>  if you call ${extractedSessionId} you will receive your sessionid 
>>>> including
>>>>  the " characters from your example.
>>>>
>>>>  this has been discussed recently, the (.+) formula is sloppy, you 
>>>> should
>>>>  match whatever you know should be in the id, but it's should work 
>>>> in your
>>>>  case. (for example, you could use  [a-z]+ instead of .+ if there 
>>>> are only
>>>>  lower case alphabetical characters in the session id)
>>>>     
>>>
>>> Or use
>>>
>>> "=([^&]+)&
>>>
>>> i.e. anything except & is captured
>>>
>>>  
>>> Also, attach the RE  element as a child of the sampler that returns
>>> the session id
>>>
>>>
>>>  
>>>>  On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com> 
>>>> wrote:
>>>>
>>>>  > Hi
>>>>  >
>>>>  > I have a following sequence of HTTP Post requests :
>>>>  >
>>>>  > -- Post request 1 (Does not return anything for me to extract)
>>>>  > -- Post request 2 (Does not return anything for me to extract)
>>>>  > -- Post request 3 (Here my client asks for session id by doing 
>>>> something
>>>>  > like this : serviceName=GetSession)
>>>>  > -- Post request 4 (Here it posts to the server with some session 
>>>> id like
>>>>  > "=*sessionid*&agentid"
>>>>  >
>>>>  > All the subsequent POST requests are important for me as i pass 
>>>> some values
>>>>  > which results in data storage in the DB. I need to extract the 
>>>> string :
>>>>  > *sessionid *which is present between the '=' and '&' characters.
>>>>  >
>>>>  > Please tell me how to go about this using JMeter.
>>>>  >
>>>>  > Thanks
>>>>  > Jatin
>>>>  >
>>>>  > 
>>>> ---------------------------------------------------------------------
>>>>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>>  > For additional commands, e-mail: 
>>>> jmeter-user-help@jakarta.apache.org
>>>>  >
>>>>  >
>>>>
>>>>     
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>
>>>
>>>   
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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


Re: Extracting sessionid's from previously queried POST methods

Posted by Jatin Davey <ja...@cisco.com>.
Ok , I read through the user manual and came to understand that i need 
to use the Regular Expression extractor as mentioned by Sebb.
Thanks for the input Sebb.

Thanks
Jatin

Jatin Davey wrote:
> Hi Sebb
>
> You mentioned the following :
>
> Also, attach the RE  element as a child of the sampler that returns
> the session id
>
> in the mail thread below.
>
> Did you mean the post - processor - Regular Expression Extractor. 
> Please confirm.
>
> Thanks
> Jatin
>
> sebb wrote:
>> On 31/12/2009, Adrian Speteanu <as...@gmail.com> wrote:
>>  
>>> i'm a bit rookie with the regex, but this one seems pretty easy, use 
>>> this
>>>  expression:
>>>
>>>  ref_name:  extractedSessionId
>>>  regex:        "=(.+)&
>>>  template:   $1$
>>>  match:      1
>>>  default:      whatever
>>>
>>>  if you call ${extractedSessionId} you will receive your sessionid 
>>> including
>>>  the " characters from your example.
>>>
>>>  this has been discussed recently, the (.+) formula is sloppy, you 
>>> should
>>>  match whatever you know should be in the id, but it's should work 
>>> in your
>>>  case. (for example, you could use  [a-z]+ instead of .+ if there 
>>> are only
>>>  lower case alphabetical characters in the session id)
>>>     
>>
>> Or use
>>
>> "=([^&]+)&
>>
>> i.e. anything except & is captured
>>
>>  
>> Also, attach the RE  element as a child of the sampler that returns
>> the session id
>>
>>
>>  
>>>  On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com> 
>>> wrote:
>>>
>>>  > Hi
>>>  >
>>>  > I have a following sequence of HTTP Post requests :
>>>  >
>>>  > -- Post request 1 (Does not return anything for me to extract)
>>>  > -- Post request 2 (Does not return anything for me to extract)
>>>  > -- Post request 3 (Here my client asks for session id by doing 
>>> something
>>>  > like this : serviceName=GetSession)
>>>  > -- Post request 4 (Here it posts to the server with some session 
>>> id like
>>>  > "=*sessionid*&agentid"
>>>  >
>>>  > All the subsequent POST requests are important for me as i pass 
>>> some values
>>>  > which results in data storage in the DB. I need to extract the 
>>> string :
>>>  > *sessionid *which is present between the '=' and '&' characters.
>>>  >
>>>  > Please tell me how to go about this using JMeter.
>>>  >
>>>  > Thanks
>>>  > Jatin
>>>  >
>>>  > 
>>> ---------------------------------------------------------------------
>>>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>>  > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>  >
>>>  >
>>>
>>>     
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>>   
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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


Re: Extracting sessionid's from previously queried POST methods

Posted by Jatin Davey <ja...@cisco.com>.
Hi Sebb

You mentioned the following :

Also, attach the RE  element as a child of the sampler that returns
the session id

in the mail thread below.

Did you mean the post - processor - Regular Expression Extractor. Please 
confirm.

Thanks
Jatin

sebb wrote:
> On 31/12/2009, Adrian Speteanu <as...@gmail.com> wrote:
>   
>> i'm a bit rookie with the regex, but this one seems pretty easy, use this
>>  expression:
>>
>>  ref_name:  extractedSessionId
>>  regex:        "=(.+)&
>>  template:   $1$
>>  match:      1
>>  default:      whatever
>>
>>  if you call ${extractedSessionId} you will receive your sessionid including
>>  the " characters from your example.
>>
>>  this has been discussed recently, the (.+) formula is sloppy, you should
>>  match whatever you know should be in the id, but it's should work in your
>>  case. (for example, you could use  [a-z]+ instead of .+ if there are only
>>  lower case alphabetical characters in the session id)
>>     
>
> Or use
>
> "=([^&]+)&
>
> i.e. anything except & is captured
>
>   
>
> Also, attach the RE  element as a child of the sampler that returns
> the session id
>
>
>   
>>  On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com> wrote:
>>
>>  > Hi
>>  >
>>  > I have a following sequence of HTTP Post requests :
>>  >
>>  > -- Post request 1 (Does not return anything for me to extract)
>>  > -- Post request 2 (Does not return anything for me to extract)
>>  > -- Post request 3 (Here my client asks for session id by doing something
>>  > like this : serviceName=GetSession)
>>  > -- Post request 4 (Here it posts to the server with some session id like
>>  > "=*sessionid*&agentid"
>>  >
>>  > All the subsequent POST requests are important for me as i pass some values
>>  > which results in data storage in the DB. I need to extract the string :
>>  > *sessionid *which is present between the '=' and '&' characters.
>>  >
>>  > Please tell me how to go about this using JMeter.
>>  >
>>  > Thanks
>>  > Jatin
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>  > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>  >
>>  >
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>   

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


Re: Extracting sessionid's from previously queried POST methods

Posted by sebb <se...@gmail.com>.
On 31/12/2009, Adrian Speteanu <as...@gmail.com> wrote:
> i'm a bit rookie with the regex, but this one seems pretty easy, use this
>  expression:
>
>  ref_name:  extractedSessionId
>  regex:        "=(.+)&
>  template:   $1$
>  match:      1
>  default:      whatever
>
>  if you call ${extractedSessionId} you will receive your sessionid including
>  the " characters from your example.
>
>  this has been discussed recently, the (.+) formula is sloppy, you should
>  match whatever you know should be in the id, but it's should work in your
>  case. (for example, you could use  [a-z]+ instead of .+ if there are only
>  lower case alphabetical characters in the session id)

Or use

"=([^&]+)&

i.e. anything except & is captured

>

Also, attach the RE  element as a child of the sampler that returns
the session id


>  On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com> wrote:
>
>  > Hi
>  >
>  > I have a following sequence of HTTP Post requests :
>  >
>  > -- Post request 1 (Does not return anything for me to extract)
>  > -- Post request 2 (Does not return anything for me to extract)
>  > -- Post request 3 (Here my client asks for session id by doing something
>  > like this : serviceName=GetSession)
>  > -- Post request 4 (Here it posts to the server with some session id like
>  > "=*sessionid*&agentid"
>  >
>  > All the subsequent POST requests are important for me as i pass some values
>  > which results in data storage in the DB. I need to extract the string :
>  > *sessionid *which is present between the '=' and '&' characters.
>  >
>  > Please tell me how to go about this using JMeter.
>  >
>  > Thanks
>  > Jatin
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>

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


Re: Extracting sessionid's from previously queried POST methods

Posted by Adrian Speteanu <as...@gmail.com>.
i'm a bit rookie with the regex, but this one seems pretty easy, use this
expression:

ref_name:  extractedSessionId
regex:        "=(.+)&
template:   $1$
match:      1
default:      whatever

if you call ${extractedSessionId} you will receive your sessionid including
the " characters from your example.

this has been discussed recently, the (.+) formula is sloppy, you should
match whatever you know should be in the id, but it's should work in your
case. (for example, you could use  [a-z]+ instead of .+ if there are only
lower case alphabetical characters in the session id)


On Thu, Dec 31, 2009 at 12:46 PM, Jatin Davey <ja...@cisco.com> wrote:

> Hi
>
> I have a following sequence of HTTP Post requests :
>
> -- Post request 1 (Does not return anything for me to extract)
> -- Post request 2 (Does not return anything for me to extract)
> -- Post request 3 (Here my client asks for session id by doing something
> like this : serviceName=GetSession)
> -- Post request 4 (Here it posts to the server with some session id like
> "=*sessionid*&agentid"
>
> All the subsequent POST requests are important for me as i pass some values
> which results in data storage in the DB. I need to extract the string :
> *sessionid *which is present between the '=' and '&' characters.
>
> Please tell me how to go about this using JMeter.
>
> Thanks
> Jatin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>