use of javax.jws.WebMethod in project cxf by apache.
the class JaxWsServiceConfiguration method getAction.
@Override
public String getAction(OperationInfo op, Method method) {
method = getDeclaredMethod(method);
WebMethod wm = method.getAnnotation(WebMethod.class);
String action = "";
if (wm != null) {
action = wm.action();
}
if (StringUtils.isEmpty(action)) {
Action act = method.getAnnotation(Action.class);
if (act != null) {
action = act.input();
}
}
return action;
}
use of javax.jws.WebMethod in project cxf by apache.
the class JaxWsServiceConfiguration method getRequestWrapperName.
@Override
public QName getRequestWrapperName(OperationInfo op, Method method) {
Method m = getDeclaredMethod(method);
RequestWrapper rw = m.getAnnotation(RequestWrapper.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(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 JaxWsServiceConfiguration method isOperation.
@Override
public Boolean isOperation(final Method method) {
if (Object.class.equals(method.getDeclaringClass())) {
return false;
}
if (method.getDeclaringClass() == implInfo.getSEIClass()) {
WebMethod wm = method.getAnnotation(WebMethod.class);
if (wm != null && wm.exclude()) {
Message message = new Message("WEBMETHOD_EXCLUDE_NOT_ALLOWED", LOG, method.getName());
throw new JaxWsConfigurationException(message);
}
}
Class<?> implClz = implInfo.getImplementorClass();
Method m = getDeclaredMethod(implClz, method);
if (m != null) {
WebMethod wm = m.getAnnotation(WebMethod.class);
if (wm != null && wm.exclude()) {
return Boolean.FALSE;
}
}
if (isWebMethod(m)) {
return true;
}
return isWebMethod(getDeclaredMethod(method));
}
use of javax.jws.WebMethod in project cxf by apache.
the class JaxWsServiceConfiguration method isWebMethod.
public Boolean isWebMethod(final Method method) {
if (method == null || method.getReturnType().equals(Future.class) || method.getReturnType().equals(Response.class) || method.isSynthetic()) {
return Boolean.FALSE;
}
WebMethod wm = method.getAnnotation(WebMethod.class);
Class<?> cls = method.getDeclaringClass();
if ((wm != null) && wm.exclude()) {
return Boolean.FALSE;
}
if ((wm != null && !wm.exclude()) || (implInfo.getSEIClass() != null && cls.isInterface() && cls.isAssignableFrom(implInfo.getSEIClass()))) {
return Boolean.TRUE;
}
if (method.getDeclaringClass().isInterface()) {
return hasWebServiceAnnotation(method);
}
if (implInfo.getSEIClass() == null) {
return hasWebServiceAnnotation(method) && !Modifier.isFinal(method.getModifiers()) && !Modifier.isStatic(method.getModifiers());
}
return implInfo.getSEIClass().isAssignableFrom(method.getDeclaringClass());
}
use of javax.jws.WebMethod in project cxf by apache.
the class CodeGenTest method testAsyncMethod.
@Test
public void testAsyncMethod() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world_async.wsdl"));
processor.setContext(env);
processor.execute();
assertNotNull(output);
File org = new File(output, "org");
assertTrue(org.exists());
File apache = new File(org, "apache");
assertTrue(apache.exists());
File cxf = new File(apache, "cxf");
assertTrue(cxf.exists());
File w2j = new File(cxf, "w2j");
assertTrue(w2j.exists());
File async = new File(w2j, "hello_world_async_soap_http");
assertTrue(async.exists());
File[] files = async.listFiles();
assertEquals(4, files.length);
Class<?> clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterAsync");
Method method1 = clz.getMethod("greetMeSometimeAsync", new Class[] { java.lang.String.class, javax.xml.ws.AsyncHandler.class });
WebMethod webMethodAnno1 = AnnotationUtil.getPrivMethodAnnotation(method1, WebMethod.class);
assertEquals(method1.getName() + "()" + " Annotation : WebMethod.operationName ", "greetMeSometime", webMethodAnno1.operationName());
java.lang.reflect.Method method2 = clz.getMethod("greetMeSometimeAsync", new Class[] { java.lang.String.class });
WebMethod webMethodAnno2 = AnnotationUtil.getPrivMethodAnnotation(method2, WebMethod.class);
assertEquals(method2.getName() + "()" + " Annotation : WebMethod.operationName ", "greetMeSometime", webMethodAnno2.operationName());
}
Aggregations