Hi ,
Custom exception can be set in the message ,by getting the Current Message 
Context and setting SOAPFault in the Message Context object.

Something like this 
MessageContext inMessageContext=MessageContext.getCurrentMessageContext();    
        


            SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();    
            SOAPEnvelope abc = soapFactory.createSOAPEnvelope();
Once u have Envelope object you can create your own SOAPFault  and set the text 
Nodes.

This should help you out.

-Sriram




________________________________
From: Schlarb Sven <[email protected]>
To: [email protected]
Sent: Mon, 12 July, 2010 5:17:11 PM
Subject: RE: AW: How to pass costum error messages to AxisFault

RE: AW: How to pass costum error messages to AxisFault  
Hi,
 
any exception that is not caught or handled (e.g. a NullPointerException) could 
be the reason for your "unknown" error. 

 
I would suggest you to have a look at the faulthandling sample code of the 
axis2 
distribution (axis2-1.5/samples/faulthandling) and try to create your scenario 
accordingly. 

 
Regards,
 
Sven
-----Original message-----
>From: x-fo.net <[email protected]>
>Sent: Mon 07/12/10 13:19:13
>To: [email protected]; 
>Subject: AW: How to pass costum error messages to AxisFault
>
>Hi,
>
>do you have an example?
>thanks
>
>br
>
>Markus
>
>-----Ursprungliche Nachricht-----
>Von: Meeusen, Christopher W. [mailto:[email protected]]
>Gesendet: Samstag, 10. Juli 2010 16:40
>An: [email protected]
>Cc: [email protected]
>Betreff: Re: How to pass costum error messages to AxisFault
>
>
>In our services we throw a subclass of java.lang.exception, and the
>client sees the exception message.  I'm not sure what extending
>axisfault buys you.
>
>Chris
>
>On Jul 10, 2010, at 6:46, "x-fo.net" <[email protected]> wrote:
>
>> Hi,
>>
>> I tried to pass costum errors to the axisFault, but I always get this:
>>
>> http://schemas.xmlsoap.org/soap/envelope/
>> ">
>> <soapenv:Body>
>> <soapenv:Fault>
>>  <faultcode>soapenv:Server</faultcode>
>>  <faultstring>unknown</faultstring>
>>  <detail />
>>  </soapenv:Fault>
>>  </soapenv:Body>
>>  </soapenv:Envelope>
>>
>> ---- this is my code for extending the AxisFault ----
>>
>> import org.apache.axis2.AxisFault;
>>
>> public class MYerror {
>>    public class MYAxisFault extends AxisFault {
>>
>>          public MYAxisFault(String faultCode, String message) {
>>            super(faultCode, message);
>>          }
>>
>> }
>>
>> }
>>
>> ---- this was in the exception placed ------------
>>
>> private static int registerItem(
>>            Item_type0 antragsstellerType0) throws MYAxisFault {
>> ....
>> } catch (ExcStamm e) {
>>            String error= "";
>>            error +="" + new Date()+"\n";
>>
>>            error +="No item found: " + e.Msg+"\n";
>>            error +="item No: " + e.itemNo+"\n";
>>
>>
>>            try {
>>                throw new AxisFault("ExcStamm", error);
>>            } catch (AxisFault e1) {
>>
>>                e1.printStackTrace();
>>            }
>>        }
>>
>> -----------------------
>>
>> Thanks for your help
>>
>> BR
>> Markus
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>

Reply via email to