# How Do I: Return Information to a Client Using a Callback?

You can use a callback to return information to a client asynchronously. When you invoke the callback, your web service sends a message back to the client.

Using callbacks assumes that the client software implements its own code for receiving the callback message you send. If the client does not support receiving callbacks, an alternative is to use polling, as described in Using Polling as an Alternative to Callbacks.

To Add a Callback

1. In Design View, select your web service.
2. Right-click and select Add Callback.
3. Double-click the arrow corresponding to the callback. The Edit Maps and Interface dialog appears.
4. Change the name of your callback and its arguments to include the information that you wish to send to the client.
5. Click OK.

To invoke the callback in your web service, you can write code such as the following, but replacing name with the name of your callback, passing it the arguments that match the types you entered in the Edit Maps and Interface dialog:

    callback.name(arg1, arg2);

Related Topics

Using Callbacks to Notify Clients of Events

Using Polling as an Alternative to Callbacks