SOAP, XPath and multipart response

214 views
Skip to first unread message

Simon Manquest

unread,
Nov 25, 2014, 4:31:26 AM11/25/14
to gat...@googlegroups.com
Hello,

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:
status=
200 OK
headers= 
Server: [Apache-Coyote/1.1]
Content-Type: [multipart/related; type="application/xop+xml"; boundary="uuid:102b75da-ad3f-4b96-938a-d13a2f4feeda"; start="<root.m...@cxf.apache.org>"; start-info="text/xml"]
Transfer-Encoding: [chunked]
Date: [Tue, 25 Nov 2014 08:56:59 GMT]

body=
--uuid:102b75da-ad3f-4b96-938a-d13a2f4feeda
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary

<soap xml blabla>
--uuid:102b75da-ad3f-4b96-938a-d13a2f4feeda--

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 ?

Simon

Stéphane Landelle

unread,
Nov 25, 2014, 4:52:50 AM11/25/14
to gat...@googlegroups.com
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.

Cheers,

Stéphane

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Manquest

unread,
Nov 25, 2014, 4:58:28 AM11/25/14
to gat...@googlegroups.com
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 :)

Have a nice day,
Simon


Le mardi 25 novembre 2014 10:31:26 UTC+1, Simon Manquest a écrit :
Hello,

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:
status=
200 OK
headers= 
Server: [Apache-Coyote/1.1]
Content-Type: [multipart/related; type="application/xop+xml"; boundary="uuid:102b75da-ad3f-4b96-938a-d13a2f4feeda"; start="<root.message@cxf.apache.org>"; start-info="text/xml"]
Transfer-Encoding: [chunked]
Date: [Tue, 25 Nov 2014 08:56:59 GMT]

body=
--uuid:102b75da-ad3f-4b96-938a-d13a2f4feeda
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary

<soap xml blabla>
Reply all
Reply to author
Forward
0 new messages