WebServiceRequest > Object

Creates a object used to manage, make and receive Ajax based calls to a Web Service. This object caters to the ASP.NET Web Service style services and optimized for interacting with it.

Static Fields

WebServiceRequest.GenerateServiceReference ServiceReference Creates a reference to a WebServiceRequest that can be used statically that allows you to have Intellisense on your static WebServiceRequests.
WebServiceRequest.DefaultDeserializationMethod SerializationMethod The deserialization type to use when receiving Ajax responses. Default is SerializationMethod.JSON.
WebServiceRequest.DefaultParameters Dictionary Default parameters added to every Ajax Request.
WebServiceRequest.DefaultResponseObjectProperty String The property to refer to to reach the "true" object. An example is ASP.NET sends back: "{ \"d\": {\"prop1\": value, \"prop2\": value } }". The true response object should have prop1 and prop2 as first level properties, but "d" is wrapping it. The static field will unwrap it for easier use by the script.
WebServiceRequest.DefaultSerializationMethod SerializationMethod The serialization type to use when sending an Ajax request. Default is SerializationMethod.JSON.
WebServiceRequest.DefaultTimeOut TimeSpan The amount of time to wait before aborting a request and throwing a timeout error. Default is 1 minute.
WebServiceRequest.PreventCacheCalls Boolean Default is true. When true, a randomized query name/value is added to the url of the request to make the url unique.
WebServiceRequest.SendCookies Boolean Determines if cookies are sent with the request. Default is false.
WebServiceRequest.ServicesDirectory String The directory of where your services reside (i.e. *.asmx files).

Constructors

WebServiceRequest() Creates a blank Ajax request that has no service attached to it.
AjaxRequest(String service, String funcName) Creates an Ajax request that will be sent to a service with the given name, calling the function provided.

Fields

DeserializationMethod SerializationMethod The method used to deserialization the response.
Function String Name of the function to call in the service.
Parameters Dictionary A set of name/value pairs sent to the server with the request.
PreventCacheCalls Boolean If true, prevents cached calls by attaching a unique value at the end of every request.
ResponseObjectProperty String The property to refer to to reach the "true" object. An example is ASP.NET sends back: "{ \"d\": {\"prop1\": value, \"prop2\": value } }". The true response object should have prop1 and prop2 as first level properties, but "d" is wrapping it. The static field will unwrap it for easier use by the script.
SerializationMethod SerializationMethod The serialization type to use when sending an Ajax request. Default is UrlEncoded.
Service String The name of the service to call. Combined with the WebServiceRequest.SerivcesDirectory to construct the proper url.
Tag Object Any object to attach to the request.
TimeOut TimeSpan Amount of time to wait before aborting the request and calling OnTimeOut.
Type Type Returns Type.AjaxRequest
Url String The url to send the request to.
XMLHttpRequest HttpRequest Native JavaScript object used to make the request.
Verb String The type of method used to send the request. Default Verb.Post.

Events

OnAbort AjaxEventArgs Called when the request has been aborted.
OnError AjaxEventArgs Called if the request does not receive a 200 response.
OnSend AjaxEventArgs Called when the request is sent.
OnSuccess AjaxEventArgs Called when the request has received a response and deserialized (if applicable).
OnTimeOut AjaxEventArgs Called once the TimeOut time has passed and the request is aborted.

Functions

Abort() Aborts the request and fires the OnAbort event.
Send() Sends the request.
Send(Boolean synchronous)   Sends the request either returns the AjaxEventArgs as a response (if true) or calls an event to be handled asynchronously (if false).

Last edited Oct 24, 2011 at 8:15 PM by dahrkdaiz, version 1

Comments

No comments yet.