use of javax.xml.ws.FaultAction in project cxf by apache.
the class JaxWsServiceFactoryBean method buildWSAActions.
private void buildWSAActions(OperationInfo operation, Method method) {
// nothing
if (method == null) {
return;
}
Action action = method.getAnnotation(Action.class);
Addressing addressing = method.getDeclaringClass().getAnnotation(Addressing.class);
if (action == null && addressing == null) {
return;
}
WebMethod wm = method.getAnnotation(WebMethod.class);
String inputAction = "";
if (action != null) {
inputAction = action.input();
}
if (wm != null && StringUtils.isEmpty(inputAction)) {
inputAction = wm.action();
}
if (StringUtils.isEmpty(inputAction)) {
inputAction = computeAction(operation, "Request");
}
if (action == null && addressing != null) {
operation.getInput().addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, inputAction);
operation.getInput().addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, inputAction);
if (operation.getOutput() != null) {
operation.getOutput().addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, computeAction(operation, "Response"));
operation.getOutput().addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, computeAction(operation, "Response"));
}
} else {
MessageInfo input = operation.getInput();
input.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, inputAction);
if (!StringUtils.isEmpty(action.input())) {
input.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, inputAction);
}
MessageInfo output = operation.getOutput();
if (output != null && !StringUtils.isEmpty(action.output())) {
output.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, action.output());
output.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, action.output());
} else if (output != null) {
output.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, computeAction(operation, "Response"));
}
FaultAction[] faultActions = action.fault();
if (faultActions != null && faultActions.length > 0 && operation.getFaults() != null) {
for (FaultAction faultAction : faultActions) {
FaultInfo faultInfo = getFaultInfo(operation, faultAction.className());
if (faultInfo != null && !StringUtils.isEmpty(faultAction.value())) {
faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, faultAction.value());
faultInfo.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, faultAction.value());
}
if (operation.isUnwrappedCapable()) {
faultInfo = getFaultInfo(operation.getUnwrappedOperation(), faultAction.className());
if (faultInfo != null && !StringUtils.isEmpty(faultAction.value())) {
faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, faultAction.value());
faultInfo.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, faultAction.value());
}
}
}
}
}
for (FaultInfo fi : operation.getFaults()) {
if (fi.getExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME) == null) {
String f = "/Fault/" + fi.getName().getLocalPart();
fi.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, computeAction(operation, f));
if (operation.isUnwrappedCapable()) {
fi = operation.getUnwrappedOperation().getFault(fi.getName());
fi.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, computeAction(operation, f));
}
}
}
}
Aggregations