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

Reply via email to