Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it right way to send exception to client

maha laxmi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here i pasted webservice,client classes and sample of wsdl file;

Is it right to catch EmpFaultException in client code;Is any other way to do it;

if empMaster is null i want to throw the message to the user.


public interface Employee extends java.rmi.Remote {
public boolean withdraw(java.lang.String account, int amount)
throws java.rmi.RemoteException,

EmpResponseType[] empMaster;

empMaster = stub.withdraw(requestType);
}catch(EmpFaultException e)
out.println("Could not find Employee");


sample of wsdl

<xsd:schema targetNamespace="">
<xsd:element name="EmpFault">
<xsd:element name="info" type="xsd:string"/>

<wsdl:message name="EmpFaultMessage">
<wsdl art element="impl:EmpFault" name="fault"/>

<wsdl ortType name="EmpPortType">
<wsdl peration name="getEmp">
<wsdl:input message="impl:getEmpRequest" name="getEmpRequest"/>
<wsdl utput message="impl:getEmpResponse" name="getEmpResponse"/>
<wsdl:fault message="impl:EmpFaultMessage" name="EmpFaultException"/>
</wsdl peration>
</wsdl ortType>

checked exception::::
public class EmpFaultException
extends java.lang.Exception
implements {
private java.lang.String info;

public EmpFaultException() {

public EmpFaultException(
java.lang.String info) { = info;

public java.lang.String getInfo() {
return info;

public void setInfo(java.lang.String info) { = info;
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic