use of javax.jws.WebMethod in project cxf by apache.
the class JaxWsServiceConfiguration method getOperationName.
@Override
public QName getOperationName(InterfaceInfo intf, Method method) {
method = getDeclaredMethod(method);
WebMethod wm = method.getAnnotation(WebMethod.class);
if (wm != null) {
String name = wm.operationName();
if (name.length() == 0) {
name = method.getName();
}
return new QName(intf.getName().getNamespaceURI(), name);
}
return new QName(intf.getName().getNamespaceURI(), method.getName());
}
use of javax.jws.WebMethod in project cxf by apache.
the class JaxWsServiceConfiguration method getResponseWrapperName.
@Override
public QName getResponseWrapperName(OperationInfo op, Method method) {
Method m = getDeclaredMethod(method);
ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class);
String nm = null;
String lp = null;
if (rw != null) {
nm = rw.targetNamespace();
lp = rw.localName();
}
WebMethod meth = m.getAnnotation(WebMethod.class);
if (meth != null && StringUtils.isEmpty(lp)) {
lp = meth.operationName();
if (!StringUtils.isEmpty(lp)) {
lp += "Response";
}
}
if (StringUtils.isEmpty(nm)) {
nm = op.getName().getNamespaceURI();
}
if (!StringUtils.isEmpty(nm) && !StringUtils.isEmpty(lp)) {
return new QName(nm, lp);
}
return null;
}
use of javax.jws.WebMethod 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));
}
}
}
}
use of javax.jws.WebMethod in project cxf by apache.
the class CustomerService method getCustomers.
@WebMethod
@WebResult(name = "customers")
public Customers getCustomers(@WebParam(name = "GetCustomers") GetCustomers req) {
Customers cbean = new Customers();
cbean.setCustomer(customers.values());
if (context == null || context.getMessageContext() == null) {
throw new WebServiceException("WebServiceContext is null!");
}
return cbean;
}
use of javax.jws.WebMethod in project cxf by apache.
the class AbstractNotificationBroker method getCurrentMessage.
/**
* @param getCurrentMessageRequest
* @return returns org.oasis_open.docs.wsn.b_1.GetCurrentMessageResponse
* @throws MultipleTopicsSpecifiedFault
* @throws TopicNotSupportedFault
* @throws InvalidTopicExpressionFault
* @throws ResourceUnknownFault
* @throws TopicExpressionDialectUnknownFault
* @throws NoCurrentMessageOnTopicFault
*/
@WebMethod(operationName = "GetCurrentMessage")
@WebResult(name = "GetCurrentMessageResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "GetCurrentMessageResponse")
public GetCurrentMessageResponse getCurrentMessage(@WebParam(name = "GetCurrentMessage", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "GetCurrentMessageRequest") GetCurrentMessage getCurrentMessageRequest) throws // CHECKSTYLE:OFF - WS-Notification spec throws a lot of faults
InvalidTopicExpressionFault, MultipleTopicsSpecifiedFault, NoCurrentMessageOnTopicFault, ResourceUnknownFault, TopicExpressionDialectUnknownFault, TopicNotSupportedFault {
// CHECKSTYLE:ON
LOGGER.finest("GetCurrentMessage");
NoCurrentMessageOnTopicFaultType fault = new NoCurrentMessageOnTopicFaultType();
throw new NoCurrentMessageOnTopicFault("There is no current message on this topic.", fault);
}
Aggregations