But I also get some trouble to use Fault class. I would appreciate if you would comment the following code snippet.
Envelope respEnv = new Envelope(); Body respBody = new Body(); Vector bodyVector = new Vector(); bodyVector.addElement(jbdb.getDoc().getDocumentElement()); respBody.setBodyEntries(bodyVector); respEnv.setBody(respBody); org.apache.soap.util.xml.XMLJavaMappingRegistry xjmr = new org.apache.soap.util.xml.XMLJavaMappingRegistry(); StringWriter sw = new StringWriter(); respEnv.marshall(sw, xjmr); Thanks - Jakob -----Oprindelig meddelelse----- Fra: Scott Nichol [mailto:[EMAIL PROTECTED] Sendt: 1. december 2003 19:57 Til: [EMAIL PROTECTED] Emne: Re: SOAPException The Fault would not be transmitted correctly: the HTTP status would be 200 instead of 500. Some SOAP clients may still handle this as a SOAP fault, but it is not conformant with SOAP 1.1. Scott Nichol Do not send e-mail directly to this e-mail address, because it is filtered to accept only mail from specific mail lists. ----- Original Message ----- From: "Hans Jakob Skovenborg" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 01, 2003 1:54 PM Subject: SV: SOAPException > Hi Scott > It seems to be quite complicated!! > Could I use the Fault class instead, to return a Fault message in the > soap-body. And if I can, then how? > Thanks - Jakob > > > -----Oprindelig meddelelse----- > Fra: Scott Nichol [mailto:[EMAIL PROTECTED] > Sendt: 1. december 2003 18:26 > Til: [EMAIL PROTECTED] > Emne: Re: SOAPException > > > Unfortunately, the current code does not allow you to set those > things. They are handled in the Fault class instead of SOAPException. > You may be able to write a Fault handler that would do what you > desire. The DOMFaultListener is one such handler that comes with > Apache SOAP. You would have to do some trick, such as > > 1. Implement an addFaultInfo(String id, String detail, String actor) > class method in your handler that would put the detail and actor info > in a Hashtable with id as the key. You would call this from your > service. > > 2. Embed the id in the message of your SOAPException. > > 3. Parse out the id from the message in the fault() method of your > handler, look up the info in your Hashtable, change values in the > Fault to what you desire, then remove the entry from your Hashtable. > > This is not pretty, but I think it would work if you really need this > info in your Faults. > > Scott Nichol > > Do not send e-mail directly to this e-mail address, > because it is filtered to accept only mail from > specific mail lists. > ----- Original Message ----- > From: "Hans Jakob Skovenborg" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, December 01, 2003 10:47 AM > Subject: SOAPException > > > > Hi Everybody > > How do I throw an SOAPException containing actor and/or details > > Regards Jakob > > >