Async web service invocation with timeout pattern

Topics: CAB & Smart Client Software Factory
Mar 4, 2006 at 4:23 AM
originally posted by: limepickle

Are you saying that if I make N calls to a proxy, they'll be queued up and processed on a (single) separate thread which will make a series of N blocking calls to my service?

I think I must have misunderstood this because that would be really hopeless.
Mar 4, 2006 at 9:03 AM
originally posted by: BradWilsonMSFT

Yes, that is our current implementation, because it fits our requirements.

Why do you call it "really hopeless"?
Mar 5, 2006 at 6:34 AM
originally posted by: limepickle

Wouldn't you want to push all N messages to the server at once? If your service can process multiple messages in parallel surely it makes sense to take advantage of that. The current implementation doesn't seem designed with this in mind. I don't understand why you'd only pump one message at a time.

Another thing that's a bit of concern is the number of classes I'd end up with if I followed the Appraisals example for the project I'm currently working on. I think someone else raised this before. I expect the message catalog for this project to contain easily 200-300 messages (split across 30-40 web services) by the time I'm done. Automated generation of command classes for all those messages would help but I don't think it would be ideal. I'm not sure about other folks, but I'd be surprised if hundreds of messages was an unusually large total for a typical CAB app.

Right now, I have proxies with Begin/End methods for async operations that adapt the types returned by the VS gen'd proxies or use an XPathNavigator to populate new instances of the types better suited for use in the client from the XML in the message. WSE does any message correlation I need.

The FDG mention the idea of raising a TimeoutException when the End method is called but that demands the client be proactive about calling the method at some point even if its callback doesn't get invoked. I'm still thinking about that one.
Mar 7, 2006 at 8:58 AM
originally posted by: PProvost

A couple of points:

RE: "Wouldn't you want to push all N messages to the server at once?"

It all depends. There are certainly situations where you want to shotgun the content at the server. But there are also cases where the ordering matters. For us, we didn't have a requirement on this reference implementation to go shotgun and the single threaded implementation was simpler. As we move forward we will be looking at the shotgun approach, but there are lots of interesting complexities around that which we can't ignore.

RE: Number of classes

I'm not sure I understand your concern here. If you need 200-300 message classes to describe all the commands, then that is what you need. This is exactly why we generate them. We don't want to have to hand-maintain those classes, but the improvement in the understandability and readability of the code when compared to a bunch of difficult XPATH/XML code is an important issue for us. Also, recognize that this particular bit of code is NOT about WSE, but it about classic ASMX web services. So we have to do what we have to do.
Mar 7, 2006 at 10:05 AM
originally posted by: limepickle

Thanks for your comments. Keep up the great work. I'll keep watching for news on the shotgun approach.