SOAP, XPath and multipart response


First of all, great work with Gatling, I’m really loving it !

I’ve got some trouble consuming a SOAP WebService.

The request is fine, but the response looks like that :

HTTP response:
200 OK
Server: [Apache-Coyote/1.1]
Content-Type: [multipart/related; type=“application/xop+xml”; boundary=“uuid:102b75da-ad3f-4b96-938a-d13a2f4feeda”; start=“”; start-info=“text/xml”]
Transfer-Encoding: [chunked]

Content-Type: application/xop+xml; charset=UTF-8; type=“text/xml”
Content-Transfer-Encoding: binary


The gatling error is Could not parse response into a DOM Document: org.xml.sax.SA…
I assume it’s the first part (uuid, Content-Type…) which prevents the parser to do its job, but I can’t get how to just extract the SOAP xml part so I can use my XPath expression. I found some information with SOAP/MTOM requests, but I didn’t find anything on parsing the response.

Could you provide some help please ?


You won’t be able to use XPath on the response body as it’s not valid XML. The reason is that it’s not a plain body, but a multipart one.
Sadly, Gatling doesn’t have any built-in feature for dealing with multipart responses at the moment.

What you could do is parse the bodyBytes inside a transform step with javamail so you can grab the parts you’re interested in and extract what you exactly want with either Saxon or Xalan.



Thank you for you answer Stéphane.
We are currently using regex to parse the body as a workaround. I guess we’ll have to continue until the multipart responses are handled by Gatling :slight_smile:

Have a nice day,