My application, and indeed it seems the whole SOAP framework, assumes that a web server will answer an XML string. Well, I've hit a customer where the web server's response is multi-part. That is, something like this:
The header (first 5 lines) is no problem. But SstWSSoapDeserializationHandler>>#invoke: creates a parser (AbtXmlMappingParser) asking it to parse everything from that first --uuid... line through the end, which it can't. I don't see where to stick some multipart-aware code to end up with just that XML string. Is there a good way to do this?
Well, I happen to have a very convenient spot where I can put in some code to handle this. Our application has a subclass of SstWSHttpDispatchHandler where we have our own #invoke:, and in there I can call this new method I came up with.
"This method exists since we need to pick out the XML string which might be buried in anSstByteMessage's contents.
See a test caller which demonstrates usefulness:
self test1 inspect "
| boundary part bodyString ans xmlStartingIndex |
bodyString := anSstByteMessage contents asString. "entire contents string by default; in simple case it's the XML string"
(SstHttpAssembler new isMultipart: anSstByteMessage header) ifFalse: [^bodyString].
"Getting here means the header contentType is not nil; look for 'boundary=' in the contentType,
which states what the separator is between parts.
Note that SstHttpMultipartContentAssembler class>>#fromHeader: does not honor such a complicated example as ours."