troelskn / handsoap

Handsoap is a library for creating SOAP clients in Ruby
http://github.com/unwire/handsoap
151 stars 2 forks source link

Large multipart responses failing #9

Closed fatcat closed 15 years ago

fatcat commented 15 years ago

In service.rb line 413, ::Tempfile objects don't have the .string method, so it died there. I hacked the following in an attempt to get around, but I don't know if this is correct:

*\ /var/lib/gems/1.8/gems/troelskn-handsoap-0.4.3/lib/handsoap/service.rb 2009-08-09 11:41:50.433057698 -0400 --- /var/lib/gems/1.8/gems/troelskn-handsoap-0.4.3/lib/handsoap/service-dannys.rb 2009-08-09 11:39:26.297058435 -0400


* 360,365 ** --- 360,366 ----

  loop do
    head = nil

! parts << {:head => head, :body => body.string} break if buf.size == 0 break if content_length == -1 end --- 411,425 ---- "" end

! if body.kind_of? ::StringIO then ! parts << {:head => head, :body => body.string} ! elsif body.kind_of? ::Tempfile then ! bodystring="" ! body.read(mycontent_length, bodystring) ! parts << {:head => head, :body => bodystring} ! else ! raise "body must be StringIO or Tempfile" ! end break if buf.size == 0 break if content_length == -1 end

Anyway, after changing the service.rb, I now get:

"Exception `Handsoap::XmlQueryFront::ParseError' at /var/lib/gems/1.8/gems/troelskn-handsoap-0.4.3/lib/handsoap/xml_query_front.rb:56 - Handsoap::XmlQueryFront::ParseError"

This is probably to do with my hack not being the right way to do it, specifically I couldn't figure out whether "content_length" is the right size to use for the body.read.

Before throwing the parse error, I receive 3 parts of the response. The first two (64894 bytes and 34174 bytes) go fine. I'll forward all the files in an email.

--- Request --- URI: http://10.0.1.231:8080/axis2/services/DataCentricService SOAPAction: GetObjectViewByCategoryRequest

Content-Type: text/xml;charset=UTF-8

<?xml version='1.0' ?>

env:Body core:Tokenee6a7186-208a-4d97-8427-40da4c73cda0/core:Token /core:AuthToken dat:categorydeviceobj/dat:category dat:domainId1/dat:domainId /dat:GetObjectViewByCategoryRequest /env:Body /env:Envelope --- Response --- HTTP Status: 200 Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_FF5B45112F1A1EA3831249832076826; type="application/xop+xml"; start="0.urn:uuid:FF5B45112F1A1EA3831249832076827@apache.org"; start-info="text/xml" --- Part #1 --- Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: binary ## Content-ID: 0.urn:uuid:FF5B45112F1A1EA3831249832076827@apache.org --- Part #2 --- Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: binary ## Content-ID: 1.urn:uuid:FF5B45112F1A1EA3831249832076828@apache.org --- Part #3 --- Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: binary Content-ID: 2.urn:uuid:FF5B45112F1A1EA3831249832076830@apache.org
troelskn commented 15 years ago

I made a slightly different change, since Tempfile and StringIO share a common interface.