You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Peter Mihalik <pe...@gmail.com> on 2011/02/15 20:28:42 UTC

Throwing a fault from a payload type JAX-WS dispatcher service

Hello, is it possible to throw a fault from a payload type JAX-WS dispatcher
service?

--
Peter

Re: Throwing a fault from a payload type JAX-WS dispatcher service

Posted by Peter Mihalik <pe...@gmail.com>.
Thanx

On Wed, Feb 16, 2011 at 5:47 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> You would need to throw a SOAPFaultException.   Somewhat like:
>
> SOAPFactory f = SOAPFactory.newInstance();
>                    SOAPFault soapFault = f.createFault();
>
>                    soapFault.setFaultString("Test Fault String ****");
>
>                    Detail detail = soapFault.addDetail();
>                    detail = soapFault.getDetail();
>
>                    QName qName = new QName("http://www.Hello.org/greeter",
> "TestFault", "ns");
>                    DetailEntry de = detail.addDetailEntry(qName);
>
>                    qName = new QName("http://www.Hello.org/greeter",
> "ErrorCode", "ns");
>                    SOAPElement errorElement = de.addChildElement(qName);
>                    errorElement.setTextContent("errorcode");
>
>                    throw new SOAPFaultException(soapFault);
>
>
>
> Dan
>
>
> On Wednesday 16 February 2011 2:21:11 AM Peter Mihalik wrote:
> > Correction: i mean provider service of course, not dispatcher. For
> example:
> >
> > @WebServiceProvider
> > @ServiceMode(value = Service.Mode.PAYLOAD)
> > public class XYProvider implements Provider<Source> {
> >
> > ...
> >
> > }
> >
> > --
> > Peter
> >
> > On Tue, Feb 15, 2011 at 8:28 PM, Peter Mihalik <pe...@gmail.com>
> wrote:
> > > Hello, is it possible to throw a fault from a payload type JAX-WS
> > > dispatcher service?
> > >
> > > --
> > > Peter
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Re: Throwing a fault from a payload type JAX-WS dispatcher service

Posted by Daniel Kulp <dk...@apache.org>.
You would need to throw a SOAPFaultException.   Somewhat like:

SOAPFactory f = SOAPFactory.newInstance(); 
                    SOAPFault soapFault = f.createFault(); 
                    
                    soapFault.setFaultString("Test Fault String ****"); 
       
                    Detail detail = soapFault.addDetail(); 
                    detail = soapFault.getDetail(); 
       
                    QName qName = new QName("http://www.Hello.org/greeter", 
"TestFault", "ns"); 
                    DetailEntry de = detail.addDetailEntry(qName); 
       
                    qName = new QName("http://www.Hello.org/greeter", 
"ErrorCode", "ns"); 
                    SOAPElement errorElement = de.addChildElement(qName); 
                    errorElement.setTextContent("errorcode"); 
                               
                    throw new SOAPFaultException(soapFault);



Dan


On Wednesday 16 February 2011 2:21:11 AM Peter Mihalik wrote:
> Correction: i mean provider service of course, not dispatcher. For example:
> 
> @WebServiceProvider
> @ServiceMode(value = Service.Mode.PAYLOAD)
> public class XYProvider implements Provider<Source> {
> 
> ...
> 
> }
> 
> --
> Peter
> 
> On Tue, Feb 15, 2011 at 8:28 PM, Peter Mihalik <pe...@gmail.com> wrote:
> > Hello, is it possible to throw a fault from a payload type JAX-WS
> > dispatcher service?
> > 
> > --
> > Peter

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

Re: Throwing a fault from a payload type JAX-WS dispatcher service

Posted by Peter Mihalik <pe...@gmail.com>.
Correction: i mean provider service of course, not dispatcher. For example:

@WebServiceProvider
@ServiceMode(value = Service.Mode.PAYLOAD)
public class XYProvider implements Provider<Source> {

...

}

--
Peter


On Tue, Feb 15, 2011 at 8:28 PM, Peter Mihalik <pe...@gmail.com> wrote:

> Hello, is it possible to throw a fault from a payload type JAX-WS
> dispatcher service?
>
> --
> Peter
>