----- Original Message -----
From: "Olivier Gauwin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 24, 2003 07:01
Subject: Re: user-defined Exceptions


> I've found the beginning of a solution for this problem, but I still
> have questions.
>
> Now my server code looks like :
>
>       try{
>            ...
>       } catch (MyException e) {
>       String code = "Server";
>       String faultString = "The following exception has been raised by
> the server : " + e.getClass().getName();
>       String actor = "Server";
>
>       IIOMetadataNode[] elements = new IIOMetadataNode[1];
>       IIOMetadataNode element1 = new IIOMetadataNode("why");
>       element1.setAttribute("value", e.why);
>       elements[0] = element1;
>       throw new org.apache.axis.AxisFault(code, faultString, actor,
> elements);
>       }
>

> I've also tried to use child nodes for "why" and it works. The only
> thing is that I would like to have :
>     <why>Just to test BadRecord</why>
> instead of :
>     <why value="Just to test BadRecord"/>
> but I can't find a way to do that (I've tried with setUserObject and
> setNodeValue but it doesn't work).

in CVS_HEAD, AxisFault has a method to take a Qname "foo:mydetail" and a
string "not enough data" and create an element <foo:mydetail>not enough
data</foo:mydetail>, then add it to the detail list. If you cant use axis1.1
you can always steal the code and use it in your axis1.0 service. There is
also some code to look up an element in the fault detail given the qname,
which is kind of useful too.

Reply via email to