ASP.NET AJAX Web Service Proxies

Posted by: Glavs Blog, on 25 Oct 2006 | View original | Bookmarked: 0 time(s)

You have no doubt seen the multitude of posts talking about some of the many changes in the beta release of the ASP.NET AJAX libraries compared to the CTP releases.

Well, here is another....

Below is a CTP generated proxy of a web service:

Type.registerNamespace('Test'); Test.SampleService=new function() { this.appPath = "http://localhost:2455/AtlasServerControls/"; var cm=Sys.Net.ServiceMethod.createProxyMethod; cm(this,"HelloServer"); cm(this,"Search","prefixText","count"); }

And here is a Beta 1 generated proxy of the same web service:

Type.registerNamespace('Test');
Test.SampleService=function() {
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
Test.SampleService.prototype={
HelloServer:Sys.Net._WebMethod._createProxyMethod(this,"HelloServer", "Test.SampleService.HelloServer",false),
Search:Sys.Net._WebMethod._createProxyMethod(this,"Search", "Test.SampleService.Search",false,"prefixText","count"),_get_path: function() { return Test.SampleService.get_path(); },
set_timeout: function(value) { this._timeout = value; },
get_timeout: function() { return this._timeout; },
set_defaultUserContext: function(value) { this._userContext = value; },
get_defaultUserContext: function() { return this._userContext; },
set_defaultSucceededCallback: function(value) { this._succeeded = value; },
get_defaultSucceededCallback: function() { return this._succeeded; },
set_defaultFailedCallback: function(value) { this._failed = value; },
get_defaultFailedCallback: function() { return this._failed; }
}
Test.SampleService._staticInstance = new Test.SampleService();
Test.SampleService.set_path = function(value) { Test.SampleService._staticInstance._path = value; }
Test.SampleService.get_path = function() { return Test.SampleService._staticInstance._path; }
Test.SampleService.set_timeout = function(value) { Test.SampleService._staticInstance._timeout = value; }
Test.SampleService.get_timeout = function() { return Test.SampleService._staticInstance._timeout; }
Test.SampleService.set_defaultUserContext = function(value) { Test.SampleService._staticInstance._userContext = value; }
Test.SampleService.get_defaultUserContext = function() { return Test.SampleService._staticInstance._userContext; }
Test.SampleService.set_defaultSucceededCallback = function(value) { Test.SampleService._staticInstance._succeeded = value; }
Test.SampleService.get_defaultSucceededCallback = function() { return Test.SampleService._staticInstance._succeeded; }
Test.SampleService.set_defaultFailedCallback = function(value) { Test.SampleService._staticInstance._failed = value; }
Test.SampleService.get_defaultFailedCallback = function() { return Test.SampleService._staticInstance._failed; }
Test.SampleService.set_path("/ASPNET_AJAX_ServerControls/WebServices/SampleService.asmx");
Test.SampleService.HelloServer= function(onSuccess,onFailed,userContext) {Test.SampleService._staticInstance.HelloServer(onSuccess,onFailed,userContext); }
Test.SampleService.Search= function(prefixText,count,onSuccess,onFailed,userContext) {Test.SampleService._staticInstance.Search(prefixText,count,onSuccess,onFailed,userContext); }

Big difference.

About the only thing the same iin both s the first line. Note the use of the prototype pattern in the new proxy. While not only remaining consistent with the current library and associated patterns for constucting objects, this will be more important once Orcas is available and the improved debugging experience allows us to peer inside these proxies.

Share this post: Email it! | bookmark it! | digg it! | reddit!

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: Ajax | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1242 | Hits: 90

Similar Posts

  • Ambiguous References in DefaultWsdlHelpGenerator.aspx more
  • Q3 2009 Release Week kicks-off November 4th, Free Daily Webinars more
  • ASP.NET 4 Web Server Here Shell Extension more
  • Upgrade Wizard: auto-upgrades and more more
  • Adhoc testing of .NET RIA Services more
  • DevReach Follow-up, Part I more
  • ASP.NET 4 Beta 2 - New Version, New Docs, New MSDN Site ! more
  • Silverlight Live Streaming service update more
  • Announcing Microsoft Ajax Library (Preview 6) and the Microsoft Ajax Minifier more
  • My ASP.NET MVC stack and why I chosen it more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD