Hi,

Sorry for the late response as we were heads down on the 1.0 release.

My understanding is that if a java exception representing the business issue (for example, CustomerNotFoundException) is thrown, it should be mapple to a WSDL fault as defined by the WSDL operation. Otherwise, it will be wrapped to a generic fault and propagate back to the client as a system exception.

In the cases of business exceptions, they are usally generated from the WSDL by a tool like WSDL2Java or JAX-WS wsimport. The JAX-WS spec defines the pattern for java exceptions corresponding to the WSDL fault.

Please try our 1.0 release at http://incubator.apache.org/tuscany/sca-java-releases.html. Your feedback will be appreciated. Any contributions are welcome!

Thanks,
Raymond

----- Original Message ----- From: "Dietrich, Björn" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, September 07, 2007 8:05 AM
Subject: Java-Exceptions <--> WSDL-Fault Mapping


Hi All,

Is it possible to throw a java-exception in a Tuscany/SCA-Webservice and catch the exception in the Tuscany/SCA-Webservice-Client.

I tried to extend the HelloWorldws-Example to throw a java exception but there seems to be something wrong with the mapping to the wsdl-fault. Is there any information how to create WS-faults with Tuscany/SCA.

thanks.
Björn

Exception in thread "main" org.apache.axis2.AxisFault: No matching source fault type is found

at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)

at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373)

at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)

at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invokeTarget(Axis2BindingInvoker.java:87)

at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(Axis2BindingInvoker.java:67)

at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInteceptor.invoke(DataTransformationInteceptor.java:68)

at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:270)

at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:114)

at $Proxy5.getGreetings(Unknown Source)

at helloworld.HelloWorldServiceComponent.getGreetings(HelloWorldServiceComponent.java:30)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:91)

at org.apache.tuscany.sca.implementation.java.invocation.PassByValueInvoker.invoke(PassByValueInvoker.java:62)

at org.apache.tuscany.sca.binding.sca.impl.RuntimeSCABindingInvoker.invoke(RuntimeSCABindingInvoker.java:48)

at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:270)

at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:114)

at $Proxy5.getGreetings(Unknown Source)

at helloworld.HelloWorldClient.main(HelloWorldClient.java:37)


@Remotable

@Service

public interface HelloWorldService {

public String getGreetings(String name) throws java.rmi.RemoteException;

}


@Service(HelloWorldService.class)
public class HelloWorldImpl implements HelloWorldService {


   public String getGreetings(String name) throws java.rmi.RemoteException{
    System.out.println("called Server");
    if (true) throw (new java.rmi.RemoteException(1));
       return "Hello 222" + name;

   }

}

<wsdl:definitions targetNamespace="http://helloworld"; xmlns:tns="http://helloworld"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";

name="helloworld">

<wsdl:types>

<schema elementFormDefault="qualified" targetNamespace="http://helloworld"; xmlns="http://www.w3.org/2001/XMLSchema";>

<element name="getGreetings">

<complexType>

<sequence>

<element name="name" type="xsd:string"/>

</sequence>

</complexType>

</element>

<element name="getGreetingsResponse">

<complexType>

<sequence>

<element name="getGreetingsReturn" type="xsd:string"/>

</sequence>

</complexType>

</element>

</schema>

</wsdl:types>

<wsdl:message name="getGreetingsRequest">

<wsdl:part element="tns:getGreetings" name="parameters"/>

</wsdl:message>

<wsdl:message name="getGreetingsResponse">

<wsdl:part element="tns:getGreetingsResponse" name="parameters"/>

</wsdl:message>

<wsdl:message name="SimpleException">

<wsdl:part name="balance" type="xsd:string"/>

</wsdl:message>



<wsdl:portType name="HelloWorld">

<wsdl:operation name="getGreetings">

<wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>

<wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>

<wsdl:fault name="fault" message="tns:SimpleException"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="getGreetings">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="getGreetingsRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="getGreetingsResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="HelloWorldService">

<wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">

<wsdlsoap:address location="http://localhost:8085/HelloWorldServiceComponent"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>



CENIT AG Systemhaus, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.de Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, Muenchen, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Christian Pusch
Aufsichtsratsmitglieder: Falk Engelmann (Vorsitzender des Aufsichtsrats), Hubert Leypoldt, Dr. Dirk Lippold Bankverbindungen: Deutsche Bank (BLZ 600 700 70) Kto. 1661 040, Commerzbank (BLZ 600 400 71) Kto. 532 015 500, BW-Bank (BLZ 600 501 01) Kto. 2 403 313
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777


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

Reply via email to