SOAP response with same MessageId as the request

808 views
Skip to first unread message

Ruben Munive

unread,
Jul 20, 2015, 11:28:10 AM7/20/15
to wiremo...@googlegroups.com
I'm mocking a SOAP service. The services client sends a unique message id in the request header and is expecting it back in the response. Each new request generates a new message id. How would I be able to accomplish this?

Tom Akehurst

unread,
Jul 20, 2015, 1:56:16 PM7/20/15
to wiremo...@googlegroups.com, ruben...@gmail.com
If you need to dynamically add the message ID, I suggest you write a ResponseTransformer implementation.

Ruben Munive

unread,
Aug 22, 2015, 1:22:02 AM8/22/15
to wiremock-user, ruben...@gmail.com
Great, this did the trick!  I've added it to several of my projects that respond in XML and JSON.

Thank you,

Anderson Almeida

unread,
Feb 26, 2016, 1:51:20 PM2/26/16
to wiremock-user

Hi,
My scenario soap, i will like to use wiremock to response xml soap with variables and response dynamic.
for example in mappings:

 {
"request": {
    "method": "POST",
    "url": "/order",
 `------capture` variable id of request `xml??????`
},
"response": {
        "status": 200,
             "bodyFileName":/order/id.xml, # ------response xml of variable id------  
    "headers": {
        "Content-Type": "text/xml"
    }
}
 }

example request:

<customer>
      <id>5959</id>
</customer>

example response:
----5959.xml

<customer>
    <id>5959</id>
    <name>XPTO</name>
    </customer>
</customer>

Can i use this scenario in wiremock, capturing id of customer and response this id of customer to xml?

Thanks!

Tom Akehurst

unread,
Feb 27, 2016, 1:11:50 PM2/27/16
to wiremock-user
WireMock won't dynamically render responses on its own, but you can write a ResponseDefinitionTransformer implementation to template the response.

You could also use this if you're still on version 1.x: https://github.com/adamyork/wiremock-velocity-transformer

Reply all
Reply to author
Forward
0 new messages