# weblogic.jws.control
Context.Callback Interface

public static interface Context.Callback

Defines callback events that may be received by the container.

All Known Subinterfaces
  `ControlContext.Callback`, `JwsContext.Callback`, `JwsContext.Callback`

Enclosing interface
  `Context`

## Method Summary

`public void` | `onAgeTimeout`(long age) Received by conversational web services when the current instance has reached its maximum lifetime.
`public void` | `onAsyncFailure`(`String` methodName, `Object`[] args) Received when an asynchronous (or, message-buffered) method is unable to be succesfully delivered.
`public void` | `onCreate`() Received after a new instance has been created and system initialization (of context object and contained controls) has been completed.
`public void` | `onException`(`Exception` e, `String` methodName, `Object`[] args) Received when a web service operation throws an uncaught exception.
`public void` | `onFinish`(boolean expired) Received by conversational web services when the current instance is about to be finished.
`public void` | `onIdleTimeout`(long time) Received by conversational web services when the current instance has reached its maximum idle timeout.

## Method Detail

### onAgeTimeout(long) Method

    public void onAgeTimeout(long age)

Received by conversational web services when the current instance has reached its maximum lifetime. The conversation finishes when the handler for this callback has finished executing.

#### Parameters

age
  The age of the conversation that has timed out.

### onAsyncFailure(String, Object[]) Method

    public void onAsyncFailure(String methodName,
                               Object[] args)

Received when an asynchronous (or, message-buffered) method is unable to be succesfully delivered.

#### Parameters

methodName
  The method that could not be delivered.

args
  An array containing the parameters of the method.

### onCreate() Method

    public void onCreate()

Received after a new instance has been created and system initialization (of context object and contained controls) has been completed.

### onException(Exception, String, Object[]) Method

    public void onException(Exception e,
                            String methodName,
                            Object[] args)

Received when a web service operation throws an uncaught exception.
Implement a handler for this callback as a single place to catch exceptions thrown from operation methods. You implement a callback handler that will execute when your service receives this callback from WebLogic Server.
The following code might be used for debugging. Prior for deployment, you might replace it with code that logs this information instead. Notice that thisÊcode also ends the conversation in which the service might have been participating. This frees no-longer-needed resources.

     public void context_onException(Exception e, String methodName, Object[] arguments)
     {
         System.out.println("MyService: exception in " + methodName + "(" +
             arguments + "). Exception: " + e);
             context.finishConversation();
     }

Not all methods in a web service are necessarily operations. In web services, an operation is a method specifically exposed to clients. In WebLogic Workshop, the source code of an operation is preceded by an @common:operation annotation.
Note that in previous releases, the @common:operation tag was known as the @jws:operation tag. This tag is still supported for backward compatibility.

#### Parameters

e
  The exception object thrown from the method.

methodName
  The name of the method from which the exception was thrown.

args
  An array containing the parameters of the method that threw the exception.

### onFinish(boolean) Method

    public void onFinish(boolean expired)

Received by conversational web services when the current instance is about to be finished. The conversation may be ending due to a call to the finishConversation method, a timeout, or successful completion of a method annotated with `@conversation phase="finish"`.

#### Parameters

expired
  `true` if the conversation finished because it timed out; otherwise, `false`.

### onIdleTimeout(long) Method

    public void onIdleTimeout(long time)

Received by conversational web services when the current instance has reached its maximum idle timeout. The conversation finishes when the handler for this callback has finished executing.

#### Parameters

time
  The current time in milliseconds.