Post-serve actions

907 views
Skip to first unread message

Peter Moretti

unread,
Jul 25, 2017, 9:06:27 AM7/25/17
to wiremock-user
Hi,

Is there somewhere an documentation or an example how to use post-service actions?

What I want to achieve is the following:
- Respond to an incoming request
- After the response has been issued, POST to another URL. For the second request I would need the input from the first request as I need to build my payload based on the first request. It would be optimal to have a random delay before the second request is send but this is not a must have.

Background: I want to mock the following scenario: Our application calls a 3rd party server and gets back an accept notifications. Afterwards we don't poll for the status (which I could do with Scenarios in wirmock) but get notified by the 3rd party server when the processing is complete.

Many thanks

Peter

Tom Akehurst

unread,
Jul 25, 2017, 12:01:52 PM7/25/17
to wiremock-user
Here's the doc for it: http://wiremock.org/docs/extending-wiremock/#post-serve-actions


Incidentally, I wrote a webhook extension a while back: https://github.com/wiremock/wiremock-webhooks-extension.
Although it doesn't support using parts of the request in the hook call, it might be useful to you as a starting point.

Peter Moretti

unread,
Jul 28, 2017, 10:40:34 AM7/28/17
to wiremock-user
Thanks for the quick response. I tried it today and it worked quite well. 

Just one more question: I dit not manage to configure the action via JSON mapping file. Is this also possible?

Greetings 

--
You received this message because you are subscribed to a topic in the Google Groups "wiremock-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wiremock-user/LLOQA6BGwwg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wiremock-use...@googlegroups.com.
To post to this group, send email to wiremo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wiremock-user/568b43f7-05e8-4cae-b318-d0d22ee57db3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom Akehurst

unread,
Jul 28, 2017, 1:22:35 PM7/28/17
to wiremock-user


On Friday, 28 July 2017 15:40:34 UTC+1, Peter Moretti wrote:
Thanks for the quick response. I tried it today and it worked quite well. 

Just one more question: I dit not manage to configure the action via JSON mapping file. Is this also possible?

Greetings 

'Tom Akehurst' via wiremock-user <wiremock-user@googlegroups.com> schrieb am Di. 25. Juli 2017 um 18:01:
Here's the doc for it: http://wiremock.org/docs/extending-wiremock/#post-serve-actions


Incidentally, I wrote a webhook extension a while back: https://github.com/wiremock/wiremock-webhooks-extension.
Although it doesn't support using parts of the request in the hook call, it might be useful to you as a starting point.

On Tuesday, 25 July 2017 14:06:27 UTC+1, Peter Moretti wrote:
Hi,

Is there somewhere an documentation or an example how to use post-service actions?

What I want to achieve is the following:
- Respond to an incoming request
- After the response has been issued, POST to another URL. For the second request I would need the input from the first request as I need to build my payload based on the first request. It would be optimal to have a random delay before the second request is send but this is not a must have.

Background: I want to mock the following scenario: Our application calls a 3rd party server and gets back an accept notifications. Afterwards we don't poll for the status (which I could do with Scenarios in wirmock) but get notified by the 3rd party server when the processing is complete.

Many thanks

Peter

--
You received this message because you are subscribed to a topic in the Google Groups "wiremock-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wiremock-user/LLOQA6BGwwg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wiremock-user+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages