You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Ransel Lopez <rl...@timeindustrial.com> on 2004/01/06 00:49:04 UTC
Building custom faults in Java
Hi, everybody
I am a starter with SOAP.
My problem is that I want to modify what I get in the client side when an exception is raised. I want to get my own faultcode, my own faultstring and some other information in the detail. Can anyone explain what should I do?? Some examples are going to help, for sure.
I have my own exceptions and I want to modify the standard xml soapfaul that I receive. Should I serialize a SOAPFaultFactory?? How to do this??
Thank you very much!!!!
Ransel López, Web Services Developer
Time Industrial, Inc.
An Outsourced Contractor Time and Cost Tracking Service.
-----------------------------------------------------------------------------------------
tel: 780.413.1521 fax: 780.413.0474
http://www.TimeIndustrial.com <http://www.timeindustrial.com/>
-----------------------------------------------------------------------------------------
This message and attached files, if any, is (are) intended only for the addressee(s) and may
contain privileged or confidential information. Any unauthorized disclosure is strictly prohibited.
If destined to our legal counsel, this transmission is privileged communication as between an
attorney and its client.
If you have received this message in error, please notify us immediately so that we may correct
our internal records. Please then delete the original message. Thank you.
RE: Building custom faults in Java
Posted by Joe Brown <jo...@earthlink.net>.
MessageRansel,
I am a beginner with SOAP & Java, also!
However, I believe what you need to do is to
generate your own exceptions.
Try "Java and SOAP" by Robert Englander, O'Reilly Press, 2002 for lots
of good info.
Here is code for custom fault:
public class generateMyFault
{
public generateMyFault () // constructor
{
}
public int generateCustomFault () throws SOAPException
{
throw new SOAPException("SOAP-ENV:Server", "My Custom Fault
Message");
}
}
Deploy this class and call it.
some fragments for client call
url = "http://....../rpcrouter
TargetURI=generateMyFault
MethodName=generateCustomFault
try
{
invoke call
check if resp.generatedFault(). Above will generate fault
get FaultCode + String
}
catch (SOAPExeption e)
Good Luck
Joe Brown
-----Original Message-----
From: Ransel Lopez [mailto:rlopez@timeindustrial.com]
Sent: Monday, January 05, 2004 6:49 PM
To: soap-dev@ws.apache.org
Subject: Building custom faults in Java
Hi, everybody
I am a starter with SOAP.
My problem is that I want to modify what I get in the client side when an
exception is raised. I want to get my own faultcode, my own faultstring and
some other information in the detail. Can anyone explain what should I do??
Some examples are going to help, for sure.
I have my own exceptions and I want to modify the standard xml soapfaul
that I receive. Should I serialize a SOAPFaultFactory?? How to do this??
Thank you very much!!!!
Ransel López, Web Services Developer
Time Industrial, Inc.
An Outsourced Contractor Time and Cost Tracking Service.
-------------------------------------------------------------------------
----------------
tel: 780.413.1521 fax: 780.413.0474
http://www.TimeIndustrial.com
-------------------------------------------------------------------------
----------------
This message and attached files, if any, is (are) intended only for the
addressee(s) and may
contain privileged or confidential information. Any unauthorized
disclosure is strictly prohibited.
If destined to our legal counsel, this transmission is privileged
communication as between an
attorney and its client.
If you have received this message in error, please notify us immediately
so that we may correct
our internal records. Please then delete the original message. Thank you.