Re: Java-Exceptions -- WSDL-Fault Mapping

2007-09-07 Thread Luciano Resende
Couple questions :

   - What SCA version of the code are you using ?
   - Are you using wsdl2java to generate your java code from wsdl ?

Also, if you are using trunk, have you tried :

 public String getGreetings(String name) throws SimpleException;

 }

On 9/7/07, Dietrich, Björn [EMAIL PROTECTED] wrote:
 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 

Java-Exceptions -- WSDL-Fault Mapping

2007-09-07 Thread Dietrich , Björn
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