savonrb / savon-multipart

Heavy metal Ruby SOAP client with multipart support
MIT License
17 stars 47 forks source link

Improve detection of multipart responses #18

Open tjarratt opened 9 years ago

tjarratt commented 9 years ago

Cloned from Savon issue 682. https://github.com/savonrb/savon/issues/682

pulling from https://github.com/savonrb/savon-multipart/blob/master/spec/savon/soap/response_spec.rb#L9

I created this that forced the response into a multipart class, which worked.

globals = {
      :multipart => true,
      :raise_errors => true,
      :convert_response_tags_to  => lambda { |tag| tag.snakecase.to_sym}
 }

response = Savon::Multipart::Response.new(response.http, globals, {})
response.hash
Any ideas why this doesn't happen automatically, or if I'm missing something?

Thanks!

A good workaround might be to consider an option that just allows the user to force the response to be parsed as multipart, or possibly improving the regex to allow for more varied types of multipart headers.

tjarratt commented 9 years ago

Hey @toobulkeh is it possible this was fixed by the most recent release of Savon-Multipart? A lovely contributor recently made the check for the multipart content-type header case insensitive, and I was wondering if that might fix your issue.

toobulkeh commented 9 years ago

let me check it out, thanks for the follow up!

alexmonteiro commented 6 years ago

I'm in the same issue in 2017. I need to get some information of legacy systems using WS, and the response comes with extra content like "\r\n--uuid:51d686cd-1f98-44db-b0f7-84506459ce9d\r\nContent-Type: application/xop+xml;"

By the way I'm using the @toobulkeh forced solution to create a Savon::Multipart::Response that gives a clean soap message, but I would be gladfull if Savon or Multipart already did it.