You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Janvier F <jm...@hotmail.com> on 2009/09/22 17:17:21 UTC

Using @WebFaul annotation

Hey People,
I browsed CXF web site in order to get an example usage of JAX-WS @Webfault annotation, but with no luck.
Does anyone of you know a pointer to a sample annotated interface that makes use of this.
I writing a java-first sample webservice and I would like to be able to return a soap fault segment.
Any idea?
Thanks in advance!
J. 		 	   		  
_________________________________________________________________
Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger !
http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx

RE: Using @WebFaul annotation

Posted by Janvier F <jm...@hotmail.com>.
Thanks Christian!
The article is clear about @WebFaut usage.
As a complementary information, I would like to mention that one has to provide the constructors with the following signatures for the Exception class:YourExceptionClassName (String message, FaultBean faultInfo)YourExceptionClassName (String message, FaultBean faultInfo, Throwable cause)
And implement the getFaultInfo() method. 
FaultBean being any bean you write to manage your exception.
Cheers,
J.

> Date: Tue, 22 Sep 2009 18:47:12 +0200
> From: chris@die-schneider.net
> To: users@cxf.apache.org
> Subject: Re: Using @WebFaul annotation
> 
> Hi,
> 
> you can look at the following article:
> http://cxf.apache.org/docs/defining-contract-first-webservices-with-wsdl-generation-from-java.html
> 
> The NoSuchCustomerException shows how to use the Webfault annotation. 
> You have to use it on the Exception class not on the interface.
> 
> Greetings
> 
> Christian
> 
> 
> Pydipati, Karuna schrieb:
> >  
> > This is what I am using...
> >
> > import javax.jws.WebMethod;
> > import javax.jws.WebParam;
> > import javax.jws.WebResult;
> > import javax.jws.WebService;
> > import javax.jws.soap.SOAPBinding;
> > import javax.xml.ws.WebFault;
> >
> > import com.xxx.webservices.common.XXXFault;
> >
> > @WebService(targetNamespace = "http://user.api.xxxx.com/", name = "Internal")
> > @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> > @WebFault(targetNamespace = "http://user.api.xxx.com/", name = "XXXFault", faultBean = "XXXFault")
> > public interface Internal { 
> >
> > 	@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> > 	@WebResult(targetNamespace = "http://user.api.xxx.com/", partName = "parameters", name = "GetUserIdResponse")
> > 	@WebMethod
> > 	public GetUserIdResponse getUserId(
> > 			@WebParam(targetNamespace = "http://user.api.xxx.com/", partName = "parameters", name = "GetUserIdRequest")
> > 			com.xxx.api.user.GetUserIdRequest parameters,
> > 			@WebParam(targetNamespace = "http://user.api.xxx.com/", name="AuthHeader", header=true, partName="AuthHeader")
> > 			com.xxx.webservices.common.AuthHeader authHeader)throws XXXFault;
> > 		
> >
> > }
> >
> > Regards
> > Karuna Pydipati
> > StubHub/eBay - Platform & Services
> > Phone: (415)222-8752
> > Email: kpydipati@ebay.com
> >
> >  
> >
> >
> > -----Original Message-----
> > From: Janvier F [mailto:jmfansi@hotmail.com] 
> > Sent: Tuesday, September 22, 2009 8:17 AM
> > To: cxf users
> > Subject: Using @WebFaul annotation
> >
> >
> > Hey People,
> > I browsed CXF web site in order to get an example usage of JAX-WS @Webfault annotation, but with no luck.
> > Does anyone of you know a pointer to a sample annotated interface that makes use of this.
> > I writing a java-first sample webservice and I would like to be able to return a soap fault segment.
> > Any idea?
> > Thanks in advance!
> > J. 		 	   		  
> > _________________________________________________________________
> > Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger !
> > http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx
> >
> >   
> 
> 
> -- 
> 
> Christian Schneider
> ---
> http://www.liquid-reality.de
> 
 		 	   		  
_________________________________________________________________
Téléphonez gratuitement à tous vos proches avec Windows Live Messenger  !  Téléchargez-le maintenant ! 
http://www.windowslive.fr/messenger/1.asp

Re: Using @WebFaul annotation

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi,

you can look at the following article:
http://cxf.apache.org/docs/defining-contract-first-webservices-with-wsdl-generation-from-java.html

The NoSuchCustomerException shows how to use the Webfault annotation. 
You have to use it on the Exception class not on the interface.

Greetings

Christian


Pydipati, Karuna schrieb:
>  
> This is what I am using...
>
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> import javax.xml.ws.WebFault;
>
> import com.xxx.webservices.common.XXXFault;
>
> @WebService(targetNamespace = "http://user.api.xxxx.com/", name = "Internal")
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> @WebFault(targetNamespace = "http://user.api.xxx.com/", name = "XXXFault", faultBean = "XXXFault")
> public interface Internal { 
>
> 	@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> 	@WebResult(targetNamespace = "http://user.api.xxx.com/", partName = "parameters", name = "GetUserIdResponse")
> 	@WebMethod
> 	public GetUserIdResponse getUserId(
> 			@WebParam(targetNamespace = "http://user.api.xxx.com/", partName = "parameters", name = "GetUserIdRequest")
> 			com.xxx.api.user.GetUserIdRequest parameters,
> 			@WebParam(targetNamespace = "http://user.api.xxx.com/", name="AuthHeader", header=true, partName="AuthHeader")
> 			com.xxx.webservices.common.AuthHeader authHeader)throws XXXFault;
> 		
>
> }
>
> Regards
> Karuna Pydipati
> StubHub/eBay - Platform & Services
> Phone: (415)222-8752
> Email: kpydipati@ebay.com
>
>  
>
>
> -----Original Message-----
> From: Janvier F [mailto:jmfansi@hotmail.com] 
> Sent: Tuesday, September 22, 2009 8:17 AM
> To: cxf users
> Subject: Using @WebFaul annotation
>
>
> Hey People,
> I browsed CXF web site in order to get an example usage of JAX-WS @Webfault annotation, but with no luck.
> Does anyone of you know a pointer to a sample annotated interface that makes use of this.
> I writing a java-first sample webservice and I would like to be able to return a soap fault segment.
> Any idea?
> Thanks in advance!
> J. 		 	   		  
> _________________________________________________________________
> Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger !
> http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx
>
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de


RE: Using @WebFaul annotation

Posted by "Pydipati, Karuna" <kp...@stubhub.com>.
 
This is what I am using...

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.WebFault;

import com.xxx.webservices.common.XXXFault;

@WebService(targetNamespace = "http://user.api.xxxx.com/", name = "Internal")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@WebFault(targetNamespace = "http://user.api.xxx.com/", name = "XXXFault", faultBean = "XXXFault")
public interface Internal { 

	@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
	@WebResult(targetNamespace = "http://user.api.xxx.com/", partName = "parameters", name = "GetUserIdResponse")
	@WebMethod
	public GetUserIdResponse getUserId(
			@WebParam(targetNamespace = "http://user.api.xxx.com/", partName = "parameters", name = "GetUserIdRequest")
			com.xxx.api.user.GetUserIdRequest parameters,
			@WebParam(targetNamespace = "http://user.api.xxx.com/", name="AuthHeader", header=true, partName="AuthHeader")
			com.xxx.webservices.common.AuthHeader authHeader)throws XXXFault;
		

}

Regards
Karuna Pydipati
StubHub/eBay - Platform & Services
Phone: (415)222-8752
Email: kpydipati@ebay.com

 


-----Original Message-----
From: Janvier F [mailto:jmfansi@hotmail.com] 
Sent: Tuesday, September 22, 2009 8:17 AM
To: cxf users
Subject: Using @WebFaul annotation


Hey People,
I browsed CXF web site in order to get an example usage of JAX-WS @Webfault annotation, but with no luck.
Does anyone of you know a pointer to a sample annotated interface that makes use of this.
I writing a java-first sample webservice and I would like to be able to return a soap fault segment.
Any idea?
Thanks in advance!
J. 		 	   		  
_________________________________________________________________
Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger !
http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx