wsa:Action customisation does not work for fault messages
---------------------------------------------------------
Key: CXF-3109
URL: https://issues.apache.org/jira/browse/CXF-3109
Project: CXF
Issue Type: Bug
Components: WS-* Components
Affects Versions: 2.3.0
Environment: Jdk 1.5.0_22 + geronimo-jaxws_2.2_spec-1.0.jar,
geronimo-ws-metadata_2.0_spec-1.1.3.jar, jaxb-api-2.2.1.jar,
jaxb-impl-2.2.1.1.jar maven dependencies (same as with jdk 1.6.0 + endorsed
jars)
Reporter: Milan Duriancik
Priority: Minor
When cutomising wsa:Action sent with faults,
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 OK but when calling the service, the falt message is sent with the
default wsa:Action value and the @FaultAction annotation is ignored.
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))
the variable faultMsgName defaults to the exception class name (because there's
no messageName in @WebFault)
this means: FaultInfo.name==FaultInfo.messageName == <fault exception class
name>
But when MAPAgregator is trying to determine actionUri for the fault, 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.
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
problem )
3) or maybe both 1) and 2) should be done ?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.