Showing posts with label Web Services. Show all posts
Showing posts with label Web Services. Show all posts

Friday, March 07, 2008

WCF client says 'No Corresponding Start Element Open'

Once again I'll just make a comment about this error. When using Dataset across a WCF service the service call may fail with the error "No Corresponding Start Element Open". The error makes perfect sense once you know the answer, but to the uninitiated it might be perplexing.

The problem is that the return value of the service call is a Dataset. If you return null from the service call then the client will see this error. The answer, well it depends on what you want to achieve. But probably just return an empty dataset and then test the contents on the client (which should be done anyway for good coding practice).

Instant Development: Frustrating Error: No Corresponding Start Element Open

kick it on DotNetKicks.com Shout it

Wednesday, February 20, 2008

Global and tidy exception handling for ScriptService

Faced with a handful of ScriptService for the site I am working on, I would like to implement some common exception handling across all the methods. Not to change the behaviour on the client, but rather to capture the exceptions and post the to an exception log or an email or something...

So there are solutions to this for traditional WebServices. See the SoapExtension mechanism documentation provided by Microsoft Handling and Throwing Exceptions in XML Web Services and SOAP Message Modification Using SOAP Extensions. But as we all know the ScriptService mechanism doesn't use the SOAP message stack.

Which brings us to the point Ayende makes ASP.Net Ajax, Error Handling and WTF. I'm not sure whether this is entirely correct that there are no hooks to provide custom handling in the ScriptService lifecycle.

Maybe I'll get a chance to investigate myself one day, but for the moment there just isn't time....

kick it on DotNetKicks.com Shout it

Tuesday, October 23, 2007

Frustrating Error: No Corresponding Start Element Open

If you have been searching and have found this then you have probably had a frustrating hour or more with an error of "No Corresponding Start Element Open". No doubt you have rebuilt your WCF service, updated the service reference, maybe even removed and re added the service reference. Still you'll have the error.

So maybe one of a couple of things are happening. If your client is not WCF then maybe the generation of the service proxy is making some parameters optional in the request or response. In this case have a read of this article to get a better idea of what is happening.
Eugene Osovetsky's Blog : Solving the "disappearing data" issue when using Add Web Reference or Wsdl.exe with WCF services

However, in my case I have WCF as the client - something else is awry. One thing to check is if you have a Dataset in your method signature. If the service call is returning null instead of a Dataset instance then this error will come up. There are a couple of options - return an empty Dataset or set the EmitDefaultValue attribute on the argument. Read more about that here No Corresponding Start Element Open

kick it on DotNetKicks.com Shout it

Tuesday, August 14, 2007

Tips and Tricks with Microsoft AJAX

Wicked Code: UpdatePanel Tips and Tricks -- MSDN Magazine, June 2007

Recently I had my first experience with Microsoft AJAX. In previous incarnations I have written many websites with 'traditional' AJAX using Xml-Http and some client side scripting.

The first thing that struck me about Atlas was that is wasn't lightweight. At all. Sending complete page state and a full page lifecycle. It seemed to me that it was a recipe for writing a really unscalable website without even knowing it. If you don't know what type of load this will place on our bandwidth or server, then I would suggest not doing anything with UpdatePanels and update timers! The use of these controls should be well thought out rather than liberal.

Take for example the task of updating a control when a value is selected in another control. Using Microsoft AJAX this would involve a complete postback of page state and page lifecycle on the server. Now consider when the user is using the keyboard to scroll through the contents of the controlling listbox. That's one postback and page lifecycle for each value that is scrolled over. Eeek! Not my idea of scalable.

In this case it might be better to consider a more traditional AJAX approach. Note that this doesn't mean writing all of the client-side script and the webservice yourself. The Microsoft AJAX toolkit can provide some features to help you. This article presents some options for hooking up a client-side event with a more traditional lightweight approach using the ScriptService and PageMethods.

These are something that are well worth the investigation if you are considering using Microsoft AJAX toolkit extensively on your site. A little bit of fore-thought can go a long way.

kick it on DotNetKicks.com Shout it