cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: problem with custom fault wsa:Action in CXF 2.3/jaxws 2.2
Date Fri, 29 Oct 2010 20:01:08 GMT

You definitely aren't wrong about this.   Thus, it is a bug that should be 
logged.

Can you check what CXF generates if you endorse the jaxws 2.2 api jar?   It's 
possible it's not seeing the 2.2 api and thus not outputting the messageName 
param.

That said, in the case where messageName isn't there, we probably should go 
with your first solution if that completely works.  Anyway, please log a bug.


Dan



On Friday 29 October 2010 9:01:51 am Milan Duriancik wrote:
> Hi,
> 
> I'm trying to customise the wsa:Action for some fault messages using the
> contract first approach.
> So, first I add to the wsdl:fault element, a wsam:Action attribute (tested
> on the CustomerService cxf sample):
> 
> ...
> <wsdl:portType... >
>   <wsdl:opertion ...>
>      <wsdl:fault  name="NoSuchCustomerException"
>                        message="tns:NoSuchCustomerException"
>                        wsam:Action="uri:customFaultAction"/> ...
> 
> Generating the java code with maven plugin, I get the operation annotated
> with:
> 
> @Action(fault = {@FaultAction(className = NoSuchCustomerException.class,
> value = "uri:customFaultAction")})
>      ...
> 
> and the fault exception annotated with:
> 
> @WebFault(name = "NoSuchCustomer", targetNamespace = "
> http://customerservice.example.com/")
> public class NoSuchCustomerException extends Exception {
> ...
> 
> 
> It seems greate ...nevertheless when executing the falt message is sent
> with the default wsa:Action and the annotation seems to be ignored :-(
> 
> 
> Am I missunderstanding somthing? Is there an option or a wsdl element
> somewhere I should use to get it working?
> 
> 
> Investigating further, I found :
> 
> 
> When faultInfo is created (ReflectionServiceFactoryBean.addFault)
> 
>     FaultInfo fi = op.addFault(new QName(op.getName().getNamespaceURI(),
> faultMsgName), new QName(op.getName().getNamespaceURI(), faultMsgName))
> 
> and the variable faultMsgName defaults to the exception class name (because
> there's no messageName in @WebFault)
> 
> (=> FaultInfo.name==FaultInfo.messageName == fault exception class name)
> 
> But when MAPAgregator is trying to determine actionUri, it is comparing
> faultName from the actual message and faultName from the FaultInfo which
> are not same (NoSuchCustomer != NoSuchCustomerException) => and so it does
> not use the FaultInfo to build wsa:Action but uses the default.
> 
> 
> If this is a bug I see 2 possible solutions:
> 
> 1) to initialise faultInfo with WebFault.name and WebFault.messageName,
> rather than 2x faultMsgName:
> 
>             (simplified:) op.addFault(  WebFault.name,  faultMsgName )
> 
>   (?? )
> 
> 2) to generate (wsdl4j) @WebFault with messageName parameter
> 
> @WebFault(name = "NoSuchCustomer", targetNamespace = "
> http://customerservice.example.com/", messageName="NoSuchCustomer")
> 
> ( I've tested adding the annotations manualy and this solves temporarily my
> problème)
> 
> 
> If I am not wrong and this is a bug I can report the issue in Jira.
> 
> 
> Milan

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

Mime
View raw message