More on ASP.NET AJAX Web Service Proxies

Previously, I posted about the difference between the proxies generated by the earlier CTP release, and the current Beta 1 release.

In that post, I noted how much different the proxies were in the latest Beta 1 release. They are obviously much larger.

To get the proxy code, I simply navigated to my .ASMX page that contained my web service and appended a "/JS" to the url address. Something like:

http://localhost:49463/TestSite/SampleService.asmx/js

Well, you can weight your page down even more by requesting the debug versions of scripts, and additionally, the web service proxies themselves.

You can look at the debug version of a web service proxy by appending "/JSDEBUG" to your web service URL. So the above URL now becomes:

http://localhost:49463/TestSite/SampleService.asmx/jsdebug

and yields the code below (I hope your ready, its big...). You will note the extensive use of comments. Again, this is (IMO) for the upcoming Orcas release and improved debugging, intellisense support.

Note that the debug version of the proxy is generated when you have <compilation debug="true"> in your web.config file.

Type.registerNamespace('Test');
Test.SampleService=function() {
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
Test.SampleService.prototype={
HelloServer:function(succeededCallback, failedCallback, userContext) {
/// <summary>Invoke the HelloServer WebMethod</summary>
/// <param name="succeededCallback" type="function" optional="true">Callback on successful completion of request</param>
/// <param name="failedCallback" type="function" optional="true">Callback on failure of request</param>
/// <param name="userContext" optional="true">User context data (any JavaScript type)</param>
return Sys.Net._WebMethod._invoke.apply(null, [ this, 'HelloServer','Test.SampleService.HelloServer',false,{},succeededCallback, failedCallback, userContext]); },
Search:function(prefixText,count,succeededCallback, failedCallback, userContext) {
/// <summary>Invoke the Search WebMethod</summary>
/// <param name="prefixText">WebMethod parameter: prefixText(type: String)</param>
/// <param name="count">WebMethod parameter: count(type: Int32)</param>
/// <param name="succeededCallback" type="function" optional="true">Callback on successful completion of request</param>
/// <param name="failedCallback" type="function" optional="true">Callback on failure of request</param>
/// <param name="userContext" optional="true">User context data (any JavaScript type)</param>
return Sys.Net._WebMethod._invoke.apply(null, [ this, 'Search','Test.SampleService.Search',false,{prefixText:prefixText,count:count},succeededCallback, failedCallback, userContext]); },_get_path: function() { return Test.SampleService.get_path(); },

set_timeout: function(value) {
/// <summary>Sets the timeout for this service.</summary>
/// <param name="value" type="Number">The timeout in milliseconds.</param>
var e = Function._validateParams(arguments, [{name: 'timeout', type: Number}]);
if (e) throw e;
if (value < 0) {
throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout);
}
this._timeout = value;
},
get_timeout: function() {
/// <summary>Returns the timeout in milliseconds for this service.</summary>
/// <returns type="Number">The timeout in milliseconds for the service.</returns>
return this._timeout;
},
set_defaultUserContext: function(value) {
/// <summary>Sets the default userContext for this service.</summary>
/// <param name="value">The default userContext for this service.</param>
this._userContext = value;
},
get_defaultUserContext: function() {
/// <summary>Returns the default userContext for this service.</summary>
/// <returns>Returns the default userContext for this service.</returns>
return this._userContext;
},
set_defaultSucceededCallback: function(value) {
/// <summary>Sets the default succeededCallback for this service.</summary>
/// <param name="value" type="Function">The default succeededCallback for this service.</param>
var e = Function._validateParams(arguments, [{name: 'defaultSucceededCallback', type: Function}]);
if (e) throw e;
this._succeeded = value;
},
get_defaultSucceededCallback: function() {
/// <summary>Returns the default succeededCallback for this service.</summary>
/// <returns type="Function">Returns the default succeededCallback for this service.</returns>
return this._succeeded;
},
set_defaultFailedCallback: function(value) {
/// <summary>Sets the default FailedCallback for this service.</summary>
/// <param name="value" type="Function">The default FailedCallback for this service.</param>
var e = Function._validateParams(arguments, [{name: 'set_defaultFailedCallback', type: Function}]);
if (e) throw e;
this._failed = value;
},
get_defaultFailedCallback: function() {
/// <summary>Returns the default failedCallback for this service.</summary>
/// <returns type="Function">Returns the default failedCallback for this service.</returns>
return this._failed;
}
}
Test.SampleService._staticInstance = new Test.SampleService();
Test.SampleService.set_path = function(value) {
/// <summary>Sets the service url.</summary>
/// <param name="path" type="String">The service url.
var e = Function._validateParams(arguments, [{name: 'path', type: String}]); if (e) throw e; Test.SampleService._staticInstance._path = value; }
Test.SampleService.get_path = function() {
/// <summary>Returns the service url.</summary>
/// <returns type="String">The service url.</returns>
return Test.SampleService._staticInstance._path; }
Test.SampleService.set_timeout = function(value) {
/// <summary>Sets the service timeout.</summary>
/// <param name="value" type="Number">The service timeout.
var e = Function._validateParams(arguments, [{name: 'timeout', type: Number}]); if (e) throw e; if (value < 0) { throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout); }
Test.SampleService._staticInstance._timeout = value; }
Test.SampleService.get_timeout = function() {
/// <summary>Returns the service timeout.</summary>
/// <returns type="Number">The service timeout.</returns>
return Test.SampleService._staticInstance._timeout; }
Test.SampleService.set_defaultUserContext = function(value) {
/// <summary>Sets the service default userContext.</summary>
/// <param name="value">The service default user context.
Test.SampleService._staticInstance._userContext = value; }
Test.SampleService.get_defaultUserContext = function() {
/// <summary>Returns the service default user context.</summary>
/// <returns>The service default user context.</returns>
return Test.SampleService._staticInstance._userContext; }
Test.SampleService.set_defaultSucceededCallback = function(value) {
/// <summary>Sets the service default succeeded callback.</summary>
/// <param name="value" type="Function">The service default succeed callback function.
var e = Function._validateParams(arguments, [{name: 'defaultSucceededCallback', type: Function}]); if (e) throw e; Test.SampleService._staticInstance._succeeded = value; }
Test.SampleService.get_defaultSucceededCallback = function() {
/// <summary>Returns the service default succeeded callback.</summary>
/// <returns type="Function">The service default succeeded callback.</returns>
return Test.SampleService._staticInstance._succeeded; }
Test.SampleService.set_defaultFailedCallback = function(value) {
/// <summary>Sets the service default failed callback function.</summary>
/// <param name="value" type="Function">The service default failed callback function.
var e = Function._validateParams(arguments, [{name: 'defaultFailedCallback', type: Function}]); if (e) throw e; Test.SampleService._staticInstance._failed = value; }
Test.SampleService.get_defaultFailedCallback = function() {
/// <summary>Returns the service default failed callback function.</summary>
/// <returns type="Function">The service default failed callback function.</returns>
return Test.SampleService._staticInstance._failed; }
Test.SampleService.set_path("/ASPNET_AJAX_ServerControls/WebServices/SampleService.asmx");
Test.SampleService.HelloServer= function(onSuccess,onFailed,userContext) { /// <summary>Invoke the HelloServer WebMethod</summary>
/// <param name="succeededCallback" type="function" optional="true">Callback on successful completion of request</param>
/// <param name="failedCallback" type="function" optional="true">Callback on failure of request</param>
/// <param name="userContext" optional="true">User context data (any JavaScript type)</param>
Test.SampleService._staticInstance.HelloServer(onSuccess,onFailed,userContext); }
Test.SampleService.Search= function(prefixText,count,onSuccess,onFailed,userContext) { /// <summary>Invoke the Search WebMethod</summary>
/// <param name="prefixText">WebMethod parameter: prefixText(type: String)</param>
/// <param name="count">WebMethod parameter: count(type: Int32)</param>
/// <param name="succeededCallback" type="function" optional="true">Callback on successful completion of request</param>
/// <param name="failedCallback" type="function" optional="true">Callback on failure of request</param>
/// <param name="userContext" optional="true">User context data (any JavaScript type)</param>
Test.SampleService._staticInstance.Search(prefixText,count,onSuccess,onFailed,userContext); }

No Comments