Generated Proxy Classes Web Service Methods
Invoke the corresponding Web service methods. These methods exist at run time after the proxy class has been generated by the server.
Note
The names of the generated proxy class methods are based on the methods in the related Web service methods.
// Call a Web service method using the proxy class.
MyNameSpace.MyServiceProxy.MyServiceMethod(param1, param2, SucceededCallback, FailedCallback, userContext);
// Call a Web service method using a proxy class instance.
var myServiceProxy = MyNameSpace.MyService();
myServiceProxy.MyServiceMethod(param1, param2, SucceededCallback, FailedCallback, userContext);
Parameters
Parameter |
Definition |
---|---|
param1, param2, paramn |
Parameters for the Web service method. You can pass as many parameters as are defined in the Web service method. |
SucceededCallback |
The succeeded callback function. This is an optional parameter. If you pass no value, the defaultSucceededCallback value is used, if defined; otherwise the call succeeds silently and no client processing of the results occurs. If you pass values to subsequent parameters in the method call, you must set SucceededCallback to null. |
FailedCallback |
The failed callback function. This is an optional parameter. If you pass no value, the defaultFailedCallback value is used, if defined; otherwise the Web service call fails silently. If you pass values to subsequent parameters in the method call, you must set FailedCallback to null. |
userContext |
An object that contains the user context. This is an optional parameter. If you pass no value, the defaultUserContext value is used, if defined; otherwise null is passed to the callback function. |
Remarks
You can call Web service methods by using the generated proxy class. Alternatively, you can create an instance of the Web service proxy class. You can then specify the succeeded callback function, failed callback function, and, optionally, time-out or user context as properties of the instance. You can then use this proxy instance to call Web service methods. In that case, you do not have to pass the callback functions or user context in the call. If you do pass these values, they override any default values set as properties of the instance.
You can create multiple proxy class instances, each with different properties. You typically create instances of the generated proxy class when you want to apply different defaults, such as different callback functions, to different Web service calls. By using different callback functions, you can process the returned data in different ways, depending on your application needs. Calling methods of the proxy instance also simplifies the syntax of calling Web service methods and the logic of callback functions.
Example
The following example shows how to define the default values for a proxy class instance and then use the instance to call a Web service method.
proxyInstance =
new Samples.AspNet.UsingProxyClass();
proxyInstance.set_timeout(1000);
proxyInstance.set_defaultUserContext("New context");
proxyInstance.set_defaultSucceededCallback(SucceededCallback);
proxyInstance.set_defaultFailedCallback(FailedCallback);
// Set the default color object.
proxyInstance.SetColor(color);
See Also
Reference
Generated Proxy Classes defaultFailedCallback Property
Generated Proxy Classes defaultSucceededCallback Property
Generated Proxy Classes defaultUserContext Property