You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2009/06/16 18:11:37 UTC

Re: exception on web-service operations

Hmm....  you hit a bug, but probably not the one you expect.  

Per spec, Oneway operations CANNOT throw a fault.   Thus, the bug that you hit 
is that the generated wsdl is generating faults for oneway operations.    
That's wrong.   

Dan



On Tue June 16 2009 8:56:10 am kr@dossier.no wrote:
> Hi,
>
> Im using apache cxf (version - 2.2.1) to implement web-service on server
> side,. but now im
> facing problem regaring exception.
> On server side i thorow an exception but this is not retrieved on client
> side., the client just invokes the method and return
> as normal., no error is repported either on server or client log. ,
>
>
> I have used gentool to generate code from wsdl to java, did anybody have
> the same problem?
>
> service:
> @Oneway
> @RequestWrapper(localName = "createDivision", targetNamespace =
> "valid-namespace", className = "operationRequest")
> @WebMethod
> public void operationRequest(
> @WebParam(name = "division", targetNamespace = "")
> operationRequest
> ) throws FaultMsg;
>
>
> ---------------
>
> FaultMsg.java class
> @WebFault(name = "faultMsg",
> targetNamespace = "valid-namespace")
> public class FaultMsg extends Exception {
>
>
> ---------------
>
> wsdl:
>
> <wsdl:operation name="operationRequest">
> <soap:operation soapAction="" style="document"/>
> −
> <wsdl:input name="operationRequest">
> <soap:body use="literal"/>
> </wsdl:input>
> −
> <wsdl:fault name="FaultMsg">
> <soap:fault name="FaultMsg" use="literal"/>
> </wsdl:fault>
> </wsdl:operation>
>
> faultMsg type:
> −
> <xs:complexType name="FaultMsg">
> −
> <xs:sequence>
> <xs:element name="errorCode" type="tns:ErrorCode"/>
> <xs:element minOccurs="0" name="description" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> −
> <xs:simpleType name="ErrorCode">
> −
> <xs:restriction base="xs:string">
>
> <xs:enumeration value="INVALID_ARGUMENT"/>
> </xs:restriction>
> </xs:simpleType>

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: exception on web-service operations

Posted by kr...@dossier.no.
Thank you Daniel, 

According to https://issues.apache.org/jira/browse/CXF-2266 , its no fix
for this yet, 

As long as you have oneway request you will never receive the exceptions, 
so i solved this problem by adding empty response messages, porttype,
binding in the wsdl and finally got 
service interface without @oneWay annotation. 

Now im receving the exceptions that occurs on server side

on service interface i got generated: 


- Karan


----- Opprinnelig melding -----
Fra: Daniel Kulp <dk...@apache.org>
Til: users@cxf.apache.org
Kopi: kr@dossier.no
Dato: Tue, 16 Jun 2009 12:11:37 -0400
Emne: Re: exception on web-service operations

> 
> Hmm....  you hit a bug, but probably not the one you expect.  
> 
> Per spec, Oneway operations CANNOT throw a fault.   Thus, the bug that you
> hit 
> is that the generated wsdl is generating faults for oneway operations.	  
> That's wrong.	
> 
> Dan
> 
> 
> 
> On Tue June 16 2009 8:56:10 am kr@dossier.no wrote:
> > Hi,
> >
> > Im using apache cxf (version - 2.2.1) to implement web-service on server
> > side,. but now im
> > facing problem regaring exception.
> > On server side i thorow an exception but this is not retrieved on client
> > side., the client just invokes the method and return
> > as normal., no error is repported either on server or client log. ,
> >
> >
> > I have used gentool to generate code from wsdl to java, did anybody have
> > the same problem?
> >
> > service:
> > @Oneway
> > @RequestWrapper(localName = "createDivision", targetNamespace =
> > "valid-namespace", className = "operationRequest")
> > @WebMethod
> > public void operationRequest(
> > @WebParam(name = "division", targetNamespace = "")
> > operationRequest
> > ) throws FaultMsg;
> >
> >
> > ---------------
> >
> > FaultMsg.java class
> > @WebFault(name = "faultMsg",
> > targetNamespace = "valid-namespace")
> > public class FaultMsg extends Exception {
> >
> >
> > ---------------
> >
> > wsdl:
> >
> > <wsdl:operation name="operationRequest">
> > <soap:operation soapAction="" style="document"/>
> > −
> > <wsdl:input name="operationRequest">
> > <soap:body use="literal"/>
> > </wsdl:input>
> > −
> > <wsdl:fault name="FaultMsg">
> > <soap:fault name="FaultMsg" use="literal"/>
> > </wsdl:fault>
> > </wsdl:operation>
> >
> > faultMsg type:
> > −
> > <xs:complexType name="FaultMsg">
> > −
> > <xs:sequence>
> > <xs:element name="errorCode" type="tns:ErrorCode"/>
> > <xs:element minOccurs="0" name="description" type="xs:string"/>
> > </xs:sequence>
> > </xs:complexType>
> > −
> > <xs:simpleType name="ErrorCode">
> > −
> > <xs:restriction base="xs:string">
> >
> > <xs:enumeration value="INVALID_ARGUMENT"/>
> > </xs:restriction>
> > </xs:simpleType>
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog