Hi Billie,

If I do not get wrong, you did not define a fault for your operation in
WSDL and also did not generate the service skeleton from the WSDL by
using WSDL2Java.

For my application, I generate the code from WSDL and the generator
adds exception inner class in stub and skeleton successfully.

You may find excerpt from my codes below.

Hope this helps.

Ali Sadik Kumlali



-------------------------------------------------
XSD
-------------------------------------------------
...
<xs:element name="BusinessException" type="tns:BusinessExceptionType"
/>
<xs:complexType name="BusinessExceptionType">
  <xs:sequence>
    <xs:element name="errorCode" type="tns:ErrorCodeType" />
    <xs:element name="errorMessage" type="tns:DescriptionType" />
    <xs:element name="stackTrace" type="tns:LongDescriptionType"
minOccurs="0" />
  </xs:sequence>
</xs:complexType>
...


-------------------------------------------------
WSDL
-------------------------------------------------
  ...
  <message name="BusinessExceptionSoapFault">
    <part name="parameters" element="t:BusinessException" />
  </message>
  ...
  <portType name="AccountServicesPortType">
    <operation name="OpenAccount">
        <input message="tns:OpenAccountSoapIn" />
        <output message="tns:OpenAccountSoapOut" />
        <fault name="BusinessException"
            message="tns:BusinessExceptionSoapFault" />
    </operation>
  ...


-------------------------------------------------
Skeleton (auto-generated and manually customized)
-------------------------------------------------
// Not auto-generated. I added this to the skeleton file.
protected BusinessExceptionSoapFaultException createBusinessException
(MyAppException e) {
  BusinessExceptionDocument doc = BusinessExceptionDocument.Factory
                                .newInstance();
  BusinessExceptionType type = BusinessExceptionType.Factory
                                .newInstance();
  type.setErrorCode(e.getCode());
  type.setErrorMessage(e.getSimpleMessage());
  type.setStackTrace(Tools.stackTraceToString(e));
  doc.setBusinessException(type);

  BusinessExceptionSoapFaultException ex = new
BusinessExceptionSoapFaultException();
  ex.setFaultMessage(doc);
  return ex;
}

// Auto generated signature. I filled inside.
public acme.schemas.account.OpenAccountResponseDocument OpenAccount(
                              acme.account.OpenAccountDocument param4)
throws
acme.definitions.account.AccountServicesSkeleton.BusinessExceptionSoapFaultException
{
  try {
     // make call to the backend application
  } catch (MyAppException e) {
    throw createBusinessException (e);
  }
}

// Auto generated. I did nothing here.
public static class BusinessExceptionSoapFaultException extends
  java.rmi.RemoteException {
  private acme.schemas.types.BusinessExceptionDocument faultMessage;
  public void
setFaultMessage(acme.schemas.types.BusinessExceptionDocument msg){
    faultMessage = msg;
  }
  public acme.schemas.types.BusinessExceptionDocument getFaultMessage()
{
    return faultMessage;
  }
}


-------------------------------------------------
In-out message receiver (auto-generated)
-------------------------------------------------
...

public void invokeBusinessLogic(org.apache.axis2.context.MessageContext
msgContext, org.apache.axis2.context.MessageContext newMsgContext)
        throws org.apache.axis2.AxisFault {
  try {
    ...
  } catch
(acme.definitions.account.AccountServicesSkeleton.BusinessExceptionSoapFaultException
e) {
    org.apache.axis2.AxisFault f =
                    new
org.apache.axis2.AxisFault("BusinessExceptionSoapFaultException");
    f.setDetail(toOM(e.getFaultMessage(),false));
    throw f;
  } catch (Exception e) {
    throw org.apache.axis2.AxisFault.makeFault(e);
  }
}


-------------------------------------------------
Stub (auto-generated)
-------------------------------------------------
...
// Auto generated. I did nothing here. Please note that
// this exception inner class also reside in skeleton.
public static class BusinessExceptionSoapFaultException extends
  java.rmi.RemoteException {
  private acme.schemas.types.BusinessExceptionDocument faultMessage;
  public void
setFaultMessage(acme.schemas.types.BusinessExceptionDocument msg){
    faultMessage = msg;
  }
  public acme.schemas.types.BusinessExceptionDocument getFaultMessage()
{
    return faultMessage;
  }
}


-------------------------------------------------
Client test code (auto-generated and manually customized)
-------------------------------------------------
public void testOpenAccount() throws java.lang.Exception {
  try {
    // make call to the service by using the stub.
    ...
  } catch
(acme.definitions.account.AccountServicesStub.BusinessExceptionSoapFaultException)
{
   // Auto-generated stub code also includes 
   ...
  } 
}


--- [EMAIL PROTECTED] wrote:

> Hi Ali Sadik Kumlali,
> 
> I use Axis2 1.0, too.
> Do you have any Sample? Did you find any missing thing in my source
> at first glance ?
> 
> Thanks for your help
> 
> Bille
> 
> > -----Urspr�ngliche Nachricht-----
> > Von: [email protected]
> > Gesendet: 01.06.06 16:00:14
> > An: [email protected]
> > Betreff: Re: [axis2] problem with Userexception and AxisFault
> 
> 
> > Hi Bille,
> > 
> > Which Axis2 version do you use? I don't have any problems with 1.0
> when
> > using custom exceptions.
> > 
> > Regards,
> > 
> > Ali Sadik Kumlali
> > 
> > --- [EMAIL PROTECTED] wrote:
> > 
> > > Hi to the list,
> > > 
> > > I have a service implementation which throws an UserException
> > > (MyException extends RemoteException).
> > > All works fine, but in the response I could not find my
> individual
> > > message and details. It just looks like this:
> > > 
> > > <soapenv:Fault>
> > >             <faultcode>soapenv:Client</faultcode>
> > >             <faultstring>unknown</faultstring>
> > >             <detail>
> > >               <Exception>
> > >                  org.apache.axis2.AxisFault
> > >                  at
> > >
> >
>
org.apache.axis2.receivers.RawXMLINOutMessageReceiver.invokeBusinessLogic(RawXMLINOutMessageReceiver.java:102)
> > >                  at
> > >
> >
>
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
> > >                  at
> > > org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)
> > >                  at
> > >
> >
>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
> > >                  at
> > >
> >
>
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> > >                  at
> > > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > >                  at
> > >
> >
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
> > >                  at
> > >
> >
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> > >                  at
> > >
> >
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> > >                  at
> > >
> >
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> > >                  ....
> > >               </Exception>
> > >             </detail>
> > > </soapenv:Fault>
> > >            ....
> > > 
> > > I debugged the service, and in class
> > > RawXMLINOutMessageReceiver::invokeBusinessLogic() my
> service-method
> > > is called and throws the exception. The exception is of type
> > > InvocationTargetException and has as a member variable called
> > > "target" my userdefined excpetion, with all the details and
> messages
> > > I defined.
> > > invokeBusinessLogic() catches this exception and throws an
> AxisFault
> > > using my userException, like this:
> > > throw new AxisFault(e.getMessage());
> > > The message member of the InvocationTargetException is null !! so
> all
> > > my user definitions are gone.
> > > 
> > > Could someone please shed some light on this. Is there any other
> > > setting I missed.
> > > I nearly grow insane with that.
> > > 
> > > By the way, the strange thing is that the faultCode says
> > > soapenv:Client !!!
> > > 
> > > Thanks a lot for any hints.
> > > I was not able to find any tutorial or HowTo on ErrorHandling in
> > > Axis...?!
> > > 
> > > Bille
> > > ______________________________________________________________
> > > Verschicken Sie romantische, coole und witzige Bilder per SMS!
> > > Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> > > 
> > > 
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around 
> > http://mail.yahoo.com 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
>
______________________________________________________________________
> XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!  
> 
> Jetzt gratis testen!
> http://freemail.web.de/home/landingpad/?mc=021130
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to