You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Bokde, Dhiraj" <DB...@iona.com> on 2008/02/28 22:13:14 UTC
SOAPFaultException from Provider not written to SOAP response
Hi,
I am using CXF version 2.0.4-incubator in an application that implements
the JAX-WS Provider<Source> interface. The application throws a
SOAPFaultException on error, but the client gets the HTTP message below,
which does not have a SOAP Envelope and hence cannot be parsed.
The code snippet that throws the SOAPFaultException is also included.
What's the right way of creating and throwing a SOAPFaultException?
<snip>
Message errMessage = new Message("UNEXPECTED_ERROR", BUNDLE,
e.getMessage());
LOG.error(errMessage, e);
Fault fault = new Fault(errMessage));
SOAPFault soapFault =
SOAPFactory.newInstance().createFault();
soapFault.setFaultCode(fault.getFaultCode());
soapFault.setFaultString(fault.getMessage());
throw new SOAPFaultException(soapFault);
<snip>
<snip>
--------------------------------------
Feb 28, 2008 1:03:57 PM org.apache.cxf.interceptor.LoggingInInterceptor
logging
INFO: Inbound Message
----------------------------
Encoding: UTF-8
Headers: {Content-Length=[342], Server=[Jetty(6.1.6)],
content-type=[text/xml; c
harset=utf-8]}
Messages:
Message:
Payload: <ns1:Fault
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><faultcode
xmlns:ns2="http://cxf.apache.org/faultcode">ns2:server</faultcode><fault
string>Invalid Request Message: [Line: -1, Column: -1: Empty XML
response from validation script:
identity.xslt].</faultstring></ns1:Fault>
--------------------------------------
<snip>
Regards,
Dhiraj.
Dhiraj Bokde
Principal Consultant
dhiraj.bokde@iona.com
----------------------------------------------------------
IONA Technologies PLC
1-800-ORBIX-4U
http://www.iona.com
Making Software Work Together
----------------------------------------------------------
Re: SOAPFaultException from Provider not written to SOAP response
Posted by Daniel Kulp <dk...@apache.org>.
On Monday 03 March 2008, Bokde, Dhiraj wrote:
> Hi Dan,
>
> What change do I need to make to my cxf.xml to use the workaround you
> suggest? I tried just adding the bean, but apparently it doesn't have
> a default ctor.
Right. Add a constructor-arg for it:
<constructor-arg ref="cxf"/>
That should do it.
Dan
>
> Thanks,
> Dhiraj.
>
> > -----Original Message-----
> > From: Daniel Kulp [mailto:dkulp@apache.org]
> > Sent: Friday, February 29, 2008 12:47 PM
> > To: cxf-user@incubator.apache.org
> > Cc: Bokde, Dhiraj
> > Subject: Re: SOAPFaultException from Provider not written to SOAP
>
> response
>
> > It doesn't seem to be working anyway you look at it. I have a fix
>
> I'm
>
> > testing now. :-(
> >
> > The "workaround" right now that MIGHT work would be to use spring
> > configuration to
> > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor
> > to the outFaultChain of the service. That's what my fix is
> > basically doing. Currently, in provider mode, the outFaultChain
> > isn't putting the proper soap:env/body in place cause that
> > interceptor is missing.
> >
> > Dan
> >
> > On Thursday 28 February 2008, Bokde, Dhiraj wrote:
> > > Hi,
> > >
> > > I am using CXF version 2.0.4-incubator in an application that
> > > implements the JAX-WS Provider<Source> interface. The application
> > > throws a SOAPFaultException on error, but the client gets the HTTP
> > > message below, which does not have a SOAP Envelope and hence
> > > cannot
>
> be
>
> > > parsed.
> > >
> > > The code snippet that throws the SOAPFaultException is also
>
> included.
>
> > > What's the right way of creating and throwing a
> > > SOAPFaultException?
> > >
> > > <snip>
> > > Message errMessage = new Message("UNEXPECTED_ERROR",
> > > BUNDLE, e.getMessage());
> > > LOG.error(errMessage, e);
> > > Fault fault = new Fault(errMessage));
> > > SOAPFault soapFault =
> > > SOAPFactory.newInstance().createFault();
> > > soapFault.setFaultCode(fault.getFaultCode());
> > > soapFault.setFaultString(fault.getMessage());
> > > throw new SOAPFaultException(soapFault);
> > > <snip>
> > >
> > > <snip>
> > > --------------------------------------
> > > Feb 28, 2008 1:03:57 PM
> > > org.apache.cxf.interceptor.LoggingInInterceptor logging
> > > INFO: Inbound Message
> > > ----------------------------
> > > Encoding: UTF-8
> > > Headers: {Content-Length=[342], Server=[Jetty(6.1.6)],
> > > content-type=[text/xml; c
> > > harset=utf-8]}
> > > Messages:
> > > Message:
> > >
> > > Payload: <ns1:Fault
> > > xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><faultcode
>
> xmlns:ns2="http://cxf.apache.org/faultcode">ns2:server</faultcode><fau
>
> > >lt string>Invalid Request Message: [Line: -1, Column: -1: Empty XML
> > > response from validation script:
> > > identity.xslt].</faultstring></ns1:Fault>
> > > --------------------------------------
> > > <snip>
> > >
> > >
> > > Regards,
> > > Dhiraj.
> > >
> > > Dhiraj Bokde
> > > Principal Consultant
> > > dhiraj.bokde@iona.com
> > > ----------------------------------------------------------
> > > IONA Technologies PLC
> > > 1-800-ORBIX-4U
> > > http://www.iona.com
> > > Making Software Work Together
> > > ----------------------------------------------------------
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog
RE: SOAPFaultException from Provider not written to SOAP response
Posted by "Bokde, Dhiraj" <DB...@iona.com>.
Hi Dan,
What change do I need to make to my cxf.xml to use the workaround you
suggest? I tried just adding the bean, but apparently it doesn't have a
default ctor.
Thanks,
Dhiraj.
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Friday, February 29, 2008 12:47 PM
> To: cxf-user@incubator.apache.org
> Cc: Bokde, Dhiraj
> Subject: Re: SOAPFaultException from Provider not written to SOAP
response
>
>
> It doesn't seem to be working anyway you look at it. I have a fix
I'm
> testing now. :-(
>
> The "workaround" right now that MIGHT work would be to use spring
> configuration to
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor
> to the outFaultChain of the service. That's what my fix is basically
> doing. Currently, in provider mode, the outFaultChain isn't putting
> the proper soap:env/body in place cause that interceptor is missing.
>
> Dan
>
>
> On Thursday 28 February 2008, Bokde, Dhiraj wrote:
> > Hi,
> >
> > I am using CXF version 2.0.4-incubator in an application that
> > implements the JAX-WS Provider<Source> interface. The application
> > throws a SOAPFaultException on error, but the client gets the HTTP
> > message below, which does not have a SOAP Envelope and hence cannot
be
> > parsed.
> >
> > The code snippet that throws the SOAPFaultException is also
included.
> > What's the right way of creating and throwing a SOAPFaultException?
> >
> > <snip>
> > Message errMessage = new Message("UNEXPECTED_ERROR",
> > BUNDLE, e.getMessage());
> > LOG.error(errMessage, e);
> > Fault fault = new Fault(errMessage));
> > SOAPFault soapFault =
> > SOAPFactory.newInstance().createFault();
> > soapFault.setFaultCode(fault.getFaultCode());
> > soapFault.setFaultString(fault.getMessage());
> > throw new SOAPFaultException(soapFault);
> > <snip>
> >
> > <snip>
> > --------------------------------------
> > Feb 28, 2008 1:03:57 PM
> > org.apache.cxf.interceptor.LoggingInInterceptor logging
> > INFO: Inbound Message
> > ----------------------------
> > Encoding: UTF-8
> > Headers: {Content-Length=[342], Server=[Jetty(6.1.6)],
> > content-type=[text/xml; c
> > harset=utf-8]}
> > Messages:
> > Message:
> >
> > Payload: <ns1:Fault
> > xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><faultcode
> >
xmlns:ns2="http://cxf.apache.org/faultcode">ns2:server</faultcode><fau
> >lt string>Invalid Request Message: [Line: -1, Column: -1: Empty XML
> > response from validation script:
> > identity.xslt].</faultstring></ns1:Fault>
> > --------------------------------------
> > <snip>
> >
> >
> > Regards,
> > Dhiraj.
> >
> > Dhiraj Bokde
> > Principal Consultant
> > dhiraj.bokde@iona.com
> > ----------------------------------------------------------
> > IONA Technologies PLC
> > 1-800-ORBIX-4U
> > http://www.iona.com
> > Making Software Work Together
> > ----------------------------------------------------------
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
Re: SOAPFaultException from Provider not written to SOAP response
Posted by Daniel Kulp <dk...@apache.org>.
It doesn't seem to be working anyway you look at it. I have a fix I'm
testing now. :-(
The "workaround" right now that MIGHT work would be to use spring
configuration to
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor
to the outFaultChain of the service. That's what my fix is basically
doing. Currently, in provider mode, the outFaultChain isn't putting
the proper soap:env/body in place cause that interceptor is missing.
Dan
On Thursday 28 February 2008, Bokde, Dhiraj wrote:
> Hi,
>
> I am using CXF version 2.0.4-incubator in an application that
> implements the JAX-WS Provider<Source> interface. The application
> throws a SOAPFaultException on error, but the client gets the HTTP
> message below, which does not have a SOAP Envelope and hence cannot be
> parsed.
>
> The code snippet that throws the SOAPFaultException is also included.
> What's the right way of creating and throwing a SOAPFaultException?
>
> <snip>
> Message errMessage = new Message("UNEXPECTED_ERROR",
> BUNDLE, e.getMessage());
> LOG.error(errMessage, e);
> Fault fault = new Fault(errMessage));
> SOAPFault soapFault =
> SOAPFactory.newInstance().createFault();
> soapFault.setFaultCode(fault.getFaultCode());
> soapFault.setFaultString(fault.getMessage());
> throw new SOAPFaultException(soapFault);
> <snip>
>
> <snip>
> --------------------------------------
> Feb 28, 2008 1:03:57 PM
> org.apache.cxf.interceptor.LoggingInInterceptor logging
> INFO: Inbound Message
> ----------------------------
> Encoding: UTF-8
> Headers: {Content-Length=[342], Server=[Jetty(6.1.6)],
> content-type=[text/xml; c
> harset=utf-8]}
> Messages:
> Message:
>
> Payload: <ns1:Fault
> xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><faultcode
> xmlns:ns2="http://cxf.apache.org/faultcode">ns2:server</faultcode><fau
>lt string>Invalid Request Message: [Line: -1, Column: -1: Empty XML
> response from validation script:
> identity.xslt].</faultstring></ns1:Fault>
> --------------------------------------
> <snip>
>
>
> Regards,
> Dhiraj.
>
> Dhiraj Bokde
> Principal Consultant
> dhiraj.bokde@iona.com
> ----------------------------------------------------------
> IONA Technologies PLC
> 1-800-ORBIX-4U
> http://www.iona.com
> Making Software Work Together
> ----------------------------------------------------------
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog