Action that makes http call

Hello,

I have to create a scenario with a custom user’s action: user logons with the post action (a cookie is set) and the custom action is called.

I wonder if I can use GatlingHttpClient.newClient ? Do the exiting cookies will be used (I do no see any cookie in the GatlingHttpClient.newClient code) ?

Regards,

Nicolas

Hi,

Could you first detail why you need a custom action for this?

Stéphane

My purpose is to stress a gwt application. I’m using gwtrpccommlayer (http://code.google.com/p/gwtrpccommlayer/).

---- Client side----

  1. gwtrpccommlayer instruments MyService interface with a proxy and return myService
  2. client call myService.action(args)
  3. proxy is invoked
  4. proxy serializes the service name, the method name and the arguments
  5. proxy makes an http request
    ---- server side----
  6. server deserialize the request
  7. server gets the MyService implementation and invoke action(args)
  8. server serialize the result of the service
    ---- client side----
  9. proxy receives the responses and deserialize the result

The advantage of gwtrpccommlayer is I’m always sync with the java interface. I do not have to modify request when interface changed. The request generation tasks are definitively easier.

Hope i’m clear…

Looks like a good idea.
But my first impression is that you don’t want to use Gatling’s HTTP builtins that use Async Http Client: gwtrpccommlayer is built on top of Apache Http Client, which is a different project.

I want to manage users authentication and session with gatling (authentication is based on spring security with custom jsp page)

It seems I have to make a choice between a full gatling solution or an http client one :wink:

If I use http client, can I set the HttpClient instance in the user session?

I want to manage users authentication and session with gatling
(authentication is based on spring security with custom jsp page)

It seems I have to make a choice between a full gatling solution or an
http client one :wink:

Well, no, but you of course have more work to have the 2 of them
communicate.

If I use http client, can I set the HttpClient instance in the user
session?

I assume that you're talking about Apache.
So yes, of course. That's what we do with Async Http Client when one use
disableClientSharing. That's also how Andrew's websocket support works.

I want to manage users authentication and session with gatling (authentication is based on spring security with custom jsp page)

It seems I have to make a choice between a full gatling solution or an http client one :wink:

Well, no, but you of course have more work to have the 2 of them communicate.

Yes, I mean the shortest path

If I use http client, can I set the HttpClient instance in the user session?

I assume that you’re talking about Apache.
So yes, of course. That’s what we do with Async Http Client when one use disableClientSharing. That’s also how Andrew’s websocket support works.

I wanted to be sure that I will not meet issue like serialization one…

Thanks for your help Sylvain.

Yes, I mean the shortest path

The shortest/ugliest path is probably to use Session hooks (exec(Session =>
Session)) and store the Apache engine instance, either as a shared object
(if it's to be shared), or in the session (if it's not). Don't forget to
register the engine instances like
here<https://github.com/excilys/gatling/blob/master/gatling-http/src/main/scala/io/gatling/http/ahc/HttpClient.scala#L67>,
so they get properly shut down.

I wanted to be sure that I will not meet issue like serialization one...

At this point, Gatling Session are never serialized. Might change someday
though, don't know yet.

Thanks for your help Sylvain.

You're welcome François

sorry Stephane… :wink:

No pro, my brother’s name is actually Sylvain, so I’m used to it :wink: