Using web services

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Using web services

Donato Trony
Hi,

I'm trying to build a test plan for Web Services and I'm using JMeter
version 2.0.3 with JDK 1.4.2_08-b03. I've already made a simple/single
request that it's working well.

The application that I am trying to test need the following sequence:

- The first request returns an identification that will be used in the
next requests. This is the reply that I get:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetNewIDResponse xmlns="http://www.mydomain.com/myWebservices">
         <GetNewIDResult>
            <NewIDUpdateDate>2005-05-16T13:51:17.1130000+01:00</NewIDUpdateDate>
            <OutputContext>
               <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
            </OutputContext>
         </GetNewIDResult>
      </GetNewIDResponse>
   </soap:Body>
</soap:Envelope>

- Afterwards I need to extract
<NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId> from
the reply and in the following next requests I must always indicate
the previous NewId.

The goal is to have something like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <Validate xmlns="http://www.mydomain.com/myWebservices">
         <inputContext>
            <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
            <UserName>username</UserName>
            <UserPassword>userpassaword</UserPassword>
         </inputContext>
      </Validate>
   </soap:Body>
</soap:Envelope>

I'm not being able to do it so any help will be appreciated.

Thanks,
Donato

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using web services

ManjuNS
Hi,

From the First WebService Response extract the ID information into
variable, using PostProcess/Regular Expression Extractor into
Variable. and Later use this Variable in the next TestCase.


Regular Expression Extractor

VariableName: NewId
RegularExpression: <NewId>(.*)</NewIdt>
Template:$1$

In the Second Request use NewID Variable  Extracted into SOAP Request
soap:Body>
>       <Validate xmlns="http://www.mydomain.com/myWebservices">
>          <inputContext>
>             <NewId> ${NewId}  </NewID>
                ....
            </...>
 
thanks
Manju
On 5/16/05, Donato Trony <[hidden email]> wrote:

> Hi,
>
> I'm trying to build a test plan for Web Services and I'm using JMeter
> version 2.0.3 with JDK 1.4.2_08-b03. I've already made a simple/single
> request that it's working well.
>
> The application that I am trying to test need the following sequence:
>
> - The first request returns an identification that will be used in the
> next requests. This is the reply that I get:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>    <soap:Body>
>       <GetNewIDResponse xmlns="http://www.mydomain.com/myWebservices">
>          <GetNewIDResult>
>             <NewIDUpdateDate>2005-05-16T13:51:17.1130000+01:00</NewIDUpdateDate>
>             <OutputContext>
>                <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
>             </OutputContext>
>          </GetNewIDResult>
>       </GetNewIDResponse>
>    </soap:Body>
> </soap:Envelope>
>
> - Afterwards I need to extract
> <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId> from
> the reply and in the following next requests I must always indicate
> the previous NewId.
>
> The goal is to have something like this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>    <soap:Body>
>       <Validate xmlns="http://www.mydomain.com/myWebservices">
>          <inputContext>
>             <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
>             <UserName>username</UserName>
>             <UserPassword>userpassaword</UserPassword>
>          </inputContext>
>       </Validate>
>    </soap:Body>
> </soap:Envelope>
>
> I'm not being able to do it so any help will be appreciated.
>
> Thanks,
> Donato
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using web services

Michael Stover
I think this type of regular expression will get you into trouble at
times - the .* operator is going to be greedy and match as much as
possible.  Safer would be:

<NewId>([^<]*)</NewIdt>

or

<NewId>([-a-z0-9]*)</NewIdt>

(not sure if that initial '-' has to be escaped inside the brackets).
Point being, make your regular expression as restrictive as you can, and
it will usually be more robust as a result.

-Mike


On Tue, 2005-05-17 at 10:45 +0530, Manjunath N.S. wrote:

> Hi,
>
> >From the First WebService Response extract the ID information into
> variable, using PostProcess/Regular Expression Extractor into
> Variable. and Later use this Variable in the next TestCase.
>
>
> Regular Expression Extractor
>
> VariableName: NewId
> RegularExpression: <NewId>(.*)</NewIdt>
> Template:$1$
>
> In the Second Request use NewID Variable  Extracted into SOAP Request
> soap:Body>
> >       <Validate xmlns="http://www.mydomain.com/myWebservices">
> >          <inputContext>
> >             <NewId> ${NewId}  </NewID>
>                 ....
>             </...>
>  
> thanks
> Manju
> On 5/16/05, Donato Trony <[hidden email]> wrote:
> > Hi,
> >
> > I'm trying to build a test plan for Web Services and I'm using JMeter
> > version 2.0.3 with JDK 1.4.2_08-b03. I've already made a simple/single
> > request that it's working well.
> >
> > The application that I am trying to test need the following sequence:
> >
> > - The first request returns an identification that will be used in the
> > next requests. This is the reply that I get:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> >    <soap:Body>
> >       <GetNewIDResponse xmlns="http://www.mydomain.com/myWebservices">
> >          <GetNewIDResult>
> >             <NewIDUpdateDate>2005-05-16T13:51:17.1130000+01:00</NewIDUpdateDate>
> >             <OutputContext>
> >                <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
> >             </OutputContext>
> >          </GetNewIDResult>
> >       </GetNewIDResponse>
> >    </soap:Body>
> > </soap:Envelope>
> >
> > - Afterwards I need to extract
> > <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId> from
> > the reply and in the following next requests I must always indicate
> > the previous NewId.
> >
> > The goal is to have something like this:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> >    <soap:Body>
> >       <Validate xmlns="http://www.mydomain.com/myWebservices">
> >          <inputContext>
> >             <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
> >             <UserName>username</UserName>
> >             <UserPassword>userpassaword</UserPassword>
> >          </inputContext>
> >       </Validate>
> >    </soap:Body>
> > </soap:Envelope>
> >
> > I'm not being able to do it so any help will be appreciated.
> >
> > Thanks,
> > Donato
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using web services

sebb-2-2
As Mike says - restrictive is good.
One could also (normally) say - greedy is bad.

Use the ? qualifier to stop the match being greedy.

For example:
<NewId>(.*?)</NewIdt>

Or perhaps
<NewId>(.+?)</NewIdt>
if you don't want to match

<NewId></NewIdt>

S.
On 5/17/05, Michael Stover <[hidden email]> wrote:

> I think this type of regular expression will get you into trouble at
> times - the .* operator is going to be greedy and match as much as
> possible.  Safer would be:
>
> <NewId>([^<]*)</NewIdt>
>
> or
>
> <NewId>([-a-z0-9]*)</NewIdt>
>
> (not sure if that initial '-' has to be escaped inside the brackets).
> Point being, make your regular expression as restrictive as you can, and
> it will usually be more robust as a result.
>
> -Mike
>
>
> On Tue, 2005-05-17 at 10:45 +0530, Manjunath N.S. wrote:
> > Hi,
> >
> > >From the First WebService Response extract the ID information into
> > variable, using PostProcess/Regular Expression Extractor into
> > Variable. and Later use this Variable in the next TestCase.
> >
> >
> > Regular Expression Extractor
> >
> > VariableName: NewId
> > RegularExpression: <NewId>(.*)</NewIdt>
> > Template:$1$
> >
> > In the Second Request use NewID Variable  Extracted into SOAP Request
> > soap:Body>
> > >       <Validate xmlns="http://www.mydomain.com/myWebservices">
> > >          <inputContext>
> > >             <NewId> ${NewId}  </NewID>
> >                 ....
> >             </...>
> >
> > thanks
> > Manju
> > On 5/16/05, Donato Trony <[hidden email]> wrote:
> > > Hi,
> > >
> > > I'm trying to build a test plan for Web Services and I'm using JMeter
> > > version 2.0.3 with JDK 1.4.2_08-b03. I've already made a simple/single
> > > request that it's working well.
> > >
> > > The application that I am trying to test need the following sequence:
> > >
> > > - The first request returns an identification that will be used in the
> > > next requests. This is the reply that I get:
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > >    <soap:Body>
> > >       <GetNewIDResponse xmlns="http://www.mydomain.com/myWebservices">
> > >          <GetNewIDResult>
> > >             <NewIDUpdateDate>2005-05-16T13:51:17.1130000+01:00</NewIDUpdateDate>
> > >             <OutputContext>
> > >                <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
> > >             </OutputContext>
> > >          </GetNewIDResult>
> > >       </GetNewIDResponse>
> > >    </soap:Body>
> > > </soap:Envelope>
> > >
> > > - Afterwards I need to extract
> > > <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId> from
> > > the reply and in the following next requests I must always indicate
> > > the previous NewId.
> > >
> > > The goal is to have something like this:
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > >    <soap:Body>
> > >       <Validate xmlns="http://www.mydomain.com/myWebservices">
> > >          <inputContext>
> > >             <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
> > >             <UserName>username</UserName>
> > >             <UserPassword>userpassaword</UserPassword>
> > >          </inputContext>
> > >       </Validate>
> > >    </soap:Body>
> > > </soap:Envelope>
> > >
> > > I'm not being able to do it so any help will be appreciated.
> > >
> > > Thanks,
> > > Donato
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Using web services

Donato Trony
In reply to this post by ManjuNS
Hi Manju,

It's working now. I found that I forgot to check the "Read SOAP
Response" in the WebService(SOAP) Request.

Instead of using the SOAP request directly in the"Soap/XML-RPC Data"
window, I would like to specify a XML file in "File with SOAP XML
Data" box.
I test it, but the variables are not replaced. It's possible to do that ?

Thank you for your help.
Regards
Donato

On 5/17/05, Manjunath N.S. <[hidden email]> wrote:

> Hi Donato,
>
> Java Request is for different purpose, in your case, it wont help.
>
> -testplan
> -Thread Group
>  -WebService(SOAP) Request-1
>    -RegularExpressionExtractor
>  -WebService(SOAP) Request-2
> -ViewResultTree..
>
> when WebService(SOAP) Request-1 test case is executed successfully
> check in the response of this request, whether you are getting proper
> Results.
>
> If you are getting correct results, then RegularExpressionExtractor
> should extract the NewID Value into  the  Variable(NewId).
>
> Then In WebService(SOAP) Request-2, you should use this Variable(NewId).
>
> if u still have problem do send me the response of the
> WebService(SOAP) Request-1, there might be problem with Regular
> Expression applied to extract the newid.
>
> hope it helps you..
>
> regards
> Manju..
> On 5/17/05, Donato Trony <[hidden email]> wrote:
> > Manju,
> >
> > Thanks for your help.
> > I tried with the following test plan
> >
> > -test plan
> > -- thread group
> > --- WebService(SOAP) Request
> > --- Regular Expression Extractor
> > --- Java Request
> > --- View Results in Table
> >
> > The options used for Regular Expression Extractor are the following:
> >
> > Response Field check: Body
> >
> > VariableName: NewId
> > RegularExpression: <NewId>(.*)</NewId>
> > Template:$1$
> > Match No.:1
> > Default Value: Failed
> >
> > In JMeter mail archive I saw a way to check the content of extracted
> > variables using a "Java Request" sampler.
> > In the "Java Request" the variable "Label" has the value ${NewId}
> > In the "View Results in Table" I always get the Default value of
> > "Regular Expression Extractor" Failed.
> > There is any sequence that I must follow in the test plan ?
> >
> > Once again thank you for your help
> > Donato
> >
> >
> > On 5/17/05, Manjunath N.S. <[hidden email]> wrote:
> > > Hi,
> > >
> > > From the First WebService Response extract the ID information into
> > > variable, using PostProcess/Regular Expression Extractor into
> > > Variable. and Later use this Variable in the next TestCase.
> > >
> > > Regular Expression Extractor
> > >
> > > VariableName: NewId
> > > RegularExpression: <NewId>(.*)</NewIdt>
> > > Template:$1$
> > >
> > > In the Second Request use NewID Variable  Extracted into SOAP Request
> > > soap:Body>
> > > >       <Validate xmlns="http://www.mydomain.com/myWebservices">
> > > >          <inputContext>
> > > >             <NewId> ${NewId}  </NewID>
> > >                ....
> > >            </...>
> > >
> > > thanks
> > > Manju
> > > On 5/16/05, Donato Trony <[hidden email]> wrote:
> > > > Hi,
> > > >
> > > > I'm trying to build a test plan for Web Services and I'm using JMeter
> > > > version 2.0.3 with JDK 1.4.2_08-b03. I've already made a simple/single
> > > > request that it's working well.
> > > >
> > > > The application that I am trying to test need the following sequence:
> > > >
> > > > - The first request returns an identification that will be used in the
> > > > next requests. This is the reply that I get:
> > > >
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > >
> > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > > >    <soap:Body>
> > > >       <GetNewIDResponse xmlns="http://www.mydomain.com/myWebservices">
> > > >          <GetNewIDResult>
> > > >             <NewIDUpdateDate>2005-05-16T13:51:17.1130000+01:00</NewIDUpdateDate>
> > > >             <OutputContext>
> > > >                <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
> > > >             </OutputContext>
> > > >          </GetNewIDResult>
> > > >       </GetNewIDResponse>
> > > >    </soap:Body>
> > > > </soap:Envelope>
> > > >
> > > > - Afterwards I need to extract
> > > > <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId> from
> > > > the reply and in the following next requests I must always indicate
> > > > the previous NewId.
> > > >
> > > > The goal is to have something like this:
> > > >
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > >
> > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > > >    <soap:Body>
> > > >       <Validate xmlns="http://www.mydomain.com/myWebservices">
> > > >          <inputContext>
> > > >             <NewId>debaa047-a763-42d3-a728-caafad2a6c5d</NewId>
> > > >             <UserName>username</UserName>
> > > >             <UserPassword>userpassaword</UserPassword>
> > > >          </inputContext>
> > > >       </Validate>
> > > >    </soap:Body>
> > > > </soap:Envelope>
> > > >
> > > > I'm not being able to do it so any help will be appreciated.
> > > >
> > > > Thanks,
> > > > Donato
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [hidden email]
> > > > For additional commands, e-mail: [hidden email]
> > > >
> > > >
> > >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using web services

sebb-2-2
On 5/18/05, Donato Trony <[hidden email]> wrote:

> Hi Manju,
>
> It's working now. I found that I forgot to check the "Read SOAP
> Response" in the WebService(SOAP) Request.
>
> Instead of using the SOAP request directly in the"Soap/XML-RPC Data"
> window, I would like to specify a XML file in "File with SOAP XML
> Data" box.
> I test it, but the variables are not replaced. It's possible to do that ?
>

JMeter does not replace variables IN files, if that's what you are trying to do.

It should be possible to use variables in file NAMES in most test
elements (not currently in listeners).

Have you checked jmeter.log for any errors?

Does the same variable reference work elsewhere?

S.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Using web services

Donato Trony
Hi,

I have no errors in jmeter.log file.
Can I use the variables defined in users.xml file in "Soap/XML-RPC Data" ?
How can I do that ?
Thanks
Donato

---------- Forwarded message ----------
From: sebb <[hidden email]>
Date: May 18, 2005 7:25 PM
Subject: Re: Using web services
To: JMeter Users List <[hidden email]>, Donato Trony
<[hidden email]>


On 5/18/05, Donato Trony <[hidden email]> wrote:

> Hi Manju,
>
> It's working now. I found that I forgot to check the "Read SOAP
> Response" in the WebService(SOAP) Request.
>
> Instead of using the SOAP request directly in the"Soap/XML-RPC Data"
> window, I would like to specify a XML file in "File with SOAP XML
> Data" box.
> I test it, but the variables are not replaced. It's possible to do that ?
>

JMeter does not replace variables IN files, if that's what you are trying to do.

It should be possible to use variables in file NAMES in most test
elements (not currently in listeners).

Have you checked jmeter.log for any errors?

Does the same variable reference work elsewhere?

S.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using web services

Peter Lin
as far as I know, JMeter currently doesn't allow you to substitute a
value in the XML for either SOAP/xml-rpc or SOAP webservice sampler.

A while back I started to work on a webservice sampler using Axis, but
I didn't get to far and got side tracked.

peter


On 5/19/05, Donato Trony <[hidden email]> wrote:

> Hi,
>
> I have no errors in jmeter.log file.
> Can I use the variables defined in users.xml file in "Soap/XML-RPC Data" ?
> How can I do that ?
> Thanks
> Donato
>
> ---------- Forwarded message ----------
> From: sebb <[hidden email]>
> Date: May 18, 2005 7:25 PM
> Subject: Re: Using web services
> To: JMeter Users List <[hidden email]>, Donato Trony
> <[hidden email]>
>
>
> On 5/18/05, Donato Trony <[hidden email]> wrote:
> > Hi Manju,
> >
> > It's working now. I found that I forgot to check the "Read SOAP
> > Response" in the WebService(SOAP) Request.
> >
> > Instead of using the SOAP request directly in the"Soap/XML-RPC Data"
> > window, I would like to specify a XML file in "File with SOAP XML
> > Data" box.
> > I test it, but the variables are not replaced. It's possible to do that ?
> >
>
> JMeter does not replace variables IN files, if that's what you are trying to do.
>
> It should be possible to use variables in file NAMES in most test
> elements (not currently in listeners).
>
> Have you checked jmeter.log for any errors?
>
> Does the same variable reference work elsewhere?
>
> S.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]