|
Listing 7. An illustration of a stubs-based client handling MyException, a service-specific exception. import javax.xml.rpc.soap.SOAPFaultException;
import java.rmi.RemoteException;
public final class Client {
public Client() {}
public static void main(String[] argv)
throws Exception
{
// Setup the global JAXM message factory
System.setProperty(
"javax.xml.soap.MessageFactory",
"weblogic.webservice.core.soap.
MessageFactoryImpl");
// Setup the global JAX-RPC service factory
System.setProperty(
"javax.xml.rpc.ServiceFactory",
"weblogic.webservice.core.rpc.
ServiceFactoryImpl");
HelloWorld_Impl ws =
new HelloWorld_Impl(argv[0]);
HelloWorldPort port = ws.getHelloWorldPort();
try {
port.sendSOAPFault();
} // try
catch(MyException ex) {
System.out.println("[Client]
Exception caught is : " + ex.toString());
System.out.println("[Client] errorMessage : " +
ex.getErrorMessage());
System.out.println("[Client] errorId : " +
ex.getErrorId());
System.out.println("[Client]
Exception stack trace :");
ex.printStackTrace();
}
}
}
|