Dear Monks,
I've developed a perl webservice framework (internal consumption only for now) which maps webservice handlers to perl classes.
Currently it supports:
- SOAP services
- JSONRPC services
- static and dynamic content, read at runtime.
Sometimes, method calls to SOAP or JSONRPC services return large amounts of data (eg: 10,000 "records" or more). In these cases a significant amount of time elapses between return of values and the sending of data to the client - mostly down to XML encoding, sometimes due to latency between the webservice and some external datasource.
I'd like to be able to "stream" my return values to the client (and for now I'm focussing on SOAP). That's no problem for the client-side, as I can simply implement an incremental reader with a SAX-based XML parser - I know what each "record" will look like based on the WSDL.
A natural solution to the server-side part would be that:
- the method returns a service "continuation"; SOAP::Lite could create a stub XML document based on the (empty) returned list, but should only immediately send up to the <body> tag to the client.
- the server could periodically "call" the continuation to obtain batches of "records"; each returned record should be turned into the appropriate XML fragment then sent to the client immediately.
- when the continuation returns undef, the server should send the closing tags from the stub XML document to the client.
My questions are threefold:
- Is this the wrong approach?
-
- If not, has someone done this before?
- If so, am I missing some hooks in SOAP::Lite which makes this easier?
-David
PS: I'm aware of continuation-based web transactions in Seaside (smalltalk).