You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by vickatvuuch <vl...@gmail.com> on 2009/12/03 22:54:42 UTC

Re: CXF 2.2.5 code-first WSDL exceptions problem

Dan,

I see you are back, could you tell how to properly propagate Runtime
execption to the client?
I think I have tried most everything and no matter if my port declater my
WSAuthFault if the interceptor throws it, the client get genertic SoapFault.
Something is there with WSDL generator not making it apparent for the client
what kind of exception is coming its way.. For now I ended up using
faultcode
for everything, which is kind of lame, but it works for all clients at least

Thanks,
-Vitaly


vickatvuuch wrote:
> 
> Hi All,
> 
> I have this small Fault handling issue, which is hopefully me doing it
> wrong somewhere..
> So, I have defined a class WSAuthFault which is thrown by a IN interceptor
> and Auth port as well. 
> The server side exception hierarchy is defined like this:
> 
> @WebFault(name="AuthFault")
> @XmlAccessorType( XmlAccessType.FIELD )
> public class WSAuthFault extends WSBaseFault {
> 
> @WebFault(name="BaseFault")
> @XmlAccessorType( XmlAccessType.FIELD )
> public class WSBaseFault extends WebServiceException
> 
> I have a Auth port with a method that explicitly throws this exception as
> to make it explicitly available in the code-first generated WSDL, ie:
> 
> @WebService(endpointInterface =
> "com.foo.sl.webservices.v1.ports.auth.AuthWService")
> @Path("/Auth")
> @Produces({"application/xml", "application/json"})
> @Consumes({"application/xml", "application/json"})
> public class AuthWServiceImpl extends AbstractAuthServiceImpl implements
> AuthWService
> ..
> ..
>   @GET
>   @Path("/login")
>   public WSSessionInfo login(@QueryParam("") WSAuthRequest auth) throws
> WSAuthFault
>   
> This produces a WSDL like one attached below.
> 
> The Soap response looks like this (ignore faultcode as I have changed it a
> bit to have is more useful):
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode
> xmlns:ns1="http://cxf.apache.org/faultcode">ns1:ErrorCode.ACCESS_DENIED_ERROR</faultcode>
>          <faultstring>Auth.login failed</faultstring>
>          <detail>
>             <ns1:AuthFault
> xmlns:ns1="http://auth.ports.v1.webservices.sl.foo.com/">
>                <message xsi:nil="true"
> xmlns:ns2="http://auth.ports.v1.webservices.sl.foo.com/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
>             </ns1:AuthFault>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
> 
> The problem is that once I use this code-first WSDL, on the CXF client
> side, it all works, but instead of an expected WSAuthFault exception a
> generic SOAPFaultException is thrown instead. I also tried the same from
> C# and I also get a generic exception of type
> System.Web.Services.Protocols.SoapException.
> 
> Anybody can tell what may be wrong and why the client is getting generic
> exceptions?
> 
> Any help is much appreciated.
> 
> Thanks,
> -Vitaly
>  http://old.nabble.com/file/p26566528/auth.wsdl auth.wsdl 
> 

-- 
View this message in context: http://old.nabble.com/CXF-2.2.5-code-first-WSDL-exceptions-problem-tp26566528p26633898.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF 2.2.5 code-first WSDL exceptions problem

Posted by Daniel Kulp <dk...@apache.org>.
It should just be automatic if the client code is generated from the WSDL (and 
the fault actually matches the description in the wsdl).   Any chance of 
creating a small test case and attaching to a JIRA?

Dan


On Thu December 3 2009 4:54:42 pm vickatvuuch wrote:
> Dan,
> 
> I see you are back, could you tell how to properly propagate Runtime
> execption to the client?
> I think I have tried most everything and no matter if my port declater my
> WSAuthFault if the interceptor throws it, the client get genertic
>  SoapFault. Something is there with WSDL generator not making it apparent
>  for the client what kind of exception is coming its way.. For now I ended
>  up using faultcode
> for everything, which is kind of lame, but it works for all clients at
>  least
> 
> Thanks,
> -Vitaly
> 
> vickatvuuch wrote:
> > Hi All,
> >
> > I have this small Fault handling issue, which is hopefully me doing it
> > wrong somewhere..
> > So, I have defined a class WSAuthFault which is thrown by a IN
> > interceptor and Auth port as well.
> > The server side exception hierarchy is defined like this:
> >
> > @WebFault(name="AuthFault")
> > @XmlAccessorType( XmlAccessType.FIELD )
> > public class WSAuthFault extends WSBaseFault {
> >
> > @WebFault(name="BaseFault")
> > @XmlAccessorType( XmlAccessType.FIELD )
> > public class WSBaseFault extends WebServiceException
> >
> > I have a Auth port with a method that explicitly throws this exception as
> > to make it explicitly available in the code-first generated WSDL, ie:
> >
> > @WebService(endpointInterface =
> > "com.foo.sl.webservices.v1.ports.auth.AuthWService")
> > @Path("/Auth")
> > @Produces({"application/xml", "application/json"})
> > @Consumes({"application/xml", "application/json"})
> > public class AuthWServiceImpl extends AbstractAuthServiceImpl implements
> > AuthWService
> > ..
> > ..
> >   @GET
> >   @Path("/login")
> >   public WSSessionInfo login(@QueryParam("") WSAuthRequest auth) throws
> > WSAuthFault
> >
> > This produces a WSDL like one attached below.
> >
> > The Soap response looks like this (ignore faultcode as I have changed it
> > a bit to have is more useful):
> > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> >    <soap:Body>
> >       <soap:Fault>
> >          <faultcode
> > xmlns:ns1="http://cxf.apache.org/faultcode">ns1:ErrorCode.ACCESS_DENIED_E
> >RROR</faultcode> <faultstring>Auth.login failed</faultstring>
> >          <detail>
> >             <ns1:AuthFault
> > xmlns:ns1="http://auth.ports.v1.webservices.sl.foo.com/">
> >                <message xsi:nil="true"
> > xmlns:ns2="http://auth.ports.v1.webservices.sl.foo.com/"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
> >             </ns1:AuthFault>
> >          </detail>
> >       </soap:Fault>
> >    </soap:Body>
> > </soap:Envelope>
> >
> > The problem is that once I use this code-first WSDL, on the CXF client
> > side, it all works, but instead of an expected WSAuthFault exception a
> > generic SOAPFaultException is thrown instead. I also tried the same from
> > C# and I also get a generic exception of type
> > System.Web.Services.Protocols.SoapException.
> >
> > Anybody can tell what may be wrong and why the client is getting generic
> > exceptions?
> >
> > Any help is much appreciated.
> >
> > Thanks,
> > -Vitaly
> >  http://old.nabble.com/file/p26566528/auth.wsdl auth.wsdl
> 

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