wood burning stoves 2.0*
The moose likes Web Services and the fly likes is it right way to send exception to client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "is it right way to send exception to client" Watch "is it right way to send exception to client" New topic

is it right way to send exception to client

maha laxmi
Ranch Hand

Joined: Sep 23, 2005
Posts: 68
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="http://emp.com/services/Emp">
<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 java.io.Serializable {
private java.lang.String info;

public EmpFaultException() {

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

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

public void setInfo(java.lang.String info) {
this.info = info;
jQuery in Action, 2nd edition
subject: is it right way to send exception to client
Similar Threads
Calling a web service in Axis2
Web Service Client using IBM Web sphere JAX-WS runtime Issue
Axis WSDL2Java's Error: reference but not defined
jax-ws clients and jboss
Problem of create Web Service Client