ethrbunny has asked for the wisdom of the Perl Monks concerning the following question:

Im having an issue with Soap::Lite. My client code is crashing (faulting) when I return a hash containing too much information.

EG I have a function that goes through a directory and does a 'stat' of each file. I put this output into a hash with the filenames as the keys and return the hash. By viewing the 'trace' output from soap I see that the info is being sent over the wire but its incomplete.

If I turn off the fault handler I see this error:
unclosed token at line 1, column 16377, byte 16377 at c:/perl/lib/XML/Parser.pm line 187.

Im guessing that I've over run some buffer so SOAP truncates the return value.

Is there a documented limit to what I can send via Soap in Perl? This value is close enough to 0xFFFF / 4 that it makes me wonder.
Whats the strategy for sending large quantities of information?

Replies are listed 'Best First'.
Re: Soap::Lite - returning lots of info
by weismat (Friar) on Oct 21, 2007 at 06:14 UTC
    I would not think that the error is related to the size. The error points more into an issue with the building of the XML of the hash. Could it be the case that the directory contains a file with the same name and thus the building of the XML file fails? I would suggest that you serialize the hash before using SOAP::Lite. Have a look at this link for some further guideance http://tardate.blogspot.com/2007/02/complex-soaplite-requests-my-rules-for.html
      Ive tried 3 distinct directories now. All fail when the size of the return reaches ~0x3FFF. I even tried building a hash with numbers from 0-50K. Same result.

      To be clear: Im not doing any special work with the Soap return values. Im letting the package do all the marshaling for me. It has worked great as long as Ive stayed below the apparent max values.

      Chances are good that Im doing something ignorant here. I'd be more than happy to eat the proverbial crow and have the error be mine. If someone wants to point it out and rub my nose in it Im ok with that. I need Soap::Lite to work. I *really* don't want to have to go back and re-write tons of code in C++.
        Chances are good that Im doing something ignorant here.
        Unfortunately, I think chances are better that there's some serialisation bug in SOAP::Lite ;)

        Obviously the size of the data-structure should have no impact on serialisation. If you've tested at just below and just above 0x3FFF and can repeat the result, then report a bug. There are many 1+ year old bugs there so I don't know whether that will help, but documenting the bug can't hurt.

        The serialisation classes don't look too complicated... you may wish to have a go at debugging this yourself.

        Martin Kutter would seem to be the active maintainer (someone please correct me if necessary), so you could probably direct any questions (which get raised in tracking it down yourself) to him. Martin wrote SOAP::WSDL (one of my favourite modules) which takes the hassle out of the client-side... I'm pretty sure he understands the SOAP::Lite codebase well ;)

        -David