JwsContext.onException Callback
Received when a method marked as an operation throws an uncaught exception.
public void onException(Exception e, String methodName, Object[] arguments)
e
The exception object thrown from the method.
methodName
The name of the method from which the exception was thrown.
arguments
An array containing the parameters of the method that threw the exception.
None.
None.
Implement a handler for this callback as a single place to catch exceptions thrown from operation methods.
You should not write code to invoke this callback. Rather, you implement a callback handler that will execute when your service receives the callback from WebLogic Server. Your code might look like the following:
public void context_onException(Exception e, String methodName, Object[] arguments) { /* 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 unneeded resources. */ System.out.println("MyService: exception in " + methodName + "(" + arguments + "). Exception: " + e); context.finishConversation(); } }
For more information on using this callback, see How Do I: Handle Errors in a Web Service?
Note that 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 a @jws:operation annotation.