RE: Building custom faults in Java

"Joe Brown" <[email protected]>
Newsgroups gmane.text.xml.soap.devel
Message-ID <[email protected]>
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:[email protected]]
  Sent: Monday, January 05, 2004 6:49 PM
  To: [email protected]
  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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.