Setting up a Web Service with the new Atlas Bits - Microsoft AJAX Library and ASP.NET 2.0 Ajax Extensions

To call a web service through the Microsoft AJAX Library, you will need to add the Microsoft.Web.Script.Services namespace to the using/import statements for your web service, unless you would like to add the complete name to the attributes.  This is a change from the previous CTPs.  I had liked that there was no code changes that needed to be done for the web services in the previous CTPs.  Now, I have to add some attributes to my web service class.

If you are going to call your web services, you will need to add two new attributes to your web service classes.  These are:

    [ScriptService] // This attribute must be on your web services anyway. 

    [GenerateScriptType(typeof(ComplexDataType))] // needed if you are going to pass a complex data type

Where ComplexDataType is the type of data that you will transfer.  Using the Atlas Example from their site, the example would be

    [GenerateScriptType(typeof(Animal))]

If you don’t add the script service attribute, you might get an error like this:


Pulled from:

http://morewally.com/cs/blogs/wallym/archive/2006/10/20/426.aspx

http://morewally.com/cs/blogs/wallym/archive/2006/10/20/428.aspx

1 Comment

  • Is it just horrible fixed-width-no-matter-what blog software that makes the text get cut off on the right side?

    3 sentences are cut off while you are explaining what they are doing/telling the framework

Comments have been disabled for this content.