axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "robert lazarski" <robertlazar...@gmail.com>
Subject Re: [Axis2] Howto send custom AxisFault that respect my WSDL ?
Date Wed, 06 Sep 2006 01:50:29 GMT
Can you try the nightlies?

http://people.apache.org/dist/axis2/nightly/

If that does not work, please file a jira and upload your wsdl.

Robert

On 9/5/06, Jérôme Mainaud <jmainaud@kleegroup.com> wrote:
> Hello,
>
> The context :
> I'm using Axis2 1.0
> I have a service defined in wsdl (see the attachement : upload.wsdl)
> I call the operation initUpload.
> When a javaException occurs in the method, I send a AxisFault build with
> this method :
>
>     public static AxisFault newErreurJava(Exception e) {
>         AxisFault ex = new AxisFault(e.toString(), new
> QName(WsConstantes.NS_UPLOAD_SERVICE, "erreurJava"));
>
>         // Extraction de la pile d'erreur
>         StringWriter sw = new StringWriter();
>         PrintWriter pw = new PrintWriter(sw);
>         e.printStackTrace(pw);
>         pw.close();
>
>         // Création du détail
>         OMFactory factory = OMAbstractFactory.getOMFactory();
>         OMNamespace nsUpl =
> factory.createOMNamespace(WsConstantes.NS_UPLOAD_TYPES, "upl");
>         OMElement detail = factory.createOMElement("javaException", nsUpl);
>         factory.createOMElement("class", nsUpl,
> detail).setText(e.getClass().getName());
>         factory.createOMElement("stack", nsUpl,
> detail).setText(sw.toString());
>         ex.setDetail(detail);
>
>         return ex;
>     }
>
> I naively thought that I would get a correct SOAP:Fault answer with
> this. Instead, I get what is in response.xml
>
>
> I have seen in org.apache.axis2.receivers.RawXMLINOutMessageReceiver
>
>     public void invokeBusinessLogic(MessageContext msgContext,
> MessageContext newmsgContext)
>             throws AxisFault {
>         try {
>
>                 /* .... */
>
>                 OMElement result;
>                 try {
>                     result = (OMElement) method.invoke(obj, args);
>                 } catch (Exception e) {
>                     throw new AxisFault(e.getMessage());
>                 }
>
>                 /* ... */
>
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>     }
>
> And in AxisFault :
>     public static AxisFault makeFault(Exception e) {
>         if (e instanceof InvocationTargetException) {
>             Throwable t = ((InvocationTargetException)
> e).getTargetException();
>
>             if (t instanceof Exception) {
>                 e = (Exception) t;
>             }
>         }
>
>         if (e instanceof AxisFault) {
>             return (AxisFault) e;
>         }
>
>         return new AxisFault(e);
>     }
>
> It seams that the catch around the refective invokation kills the
> InvocationTargetException that would be dealed by AxisFault.makeFault()
> otherwise.
>
> But because Axis and webservices in general are new for me, I'm not sure
> about it.
>
> What can I do to get a SOAP:Fault that is conform to my wsdl ?
> Thank you !
>
> --
> Jérôme Mainaud               Klee Group
> jmainaud@kleegroup.com      <http://www.kleegroup.com/>
> + 33 146 295 825            Tel: + 33 146 292 525
>                             Fax: + 33 146 292 529
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message