@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()); }
@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; }
@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; }
/** * The operation name of this web method. * * @return The operation name of this web method. */ public String getOperationName() { String operationName = getSimpleName().toString(); if ((annotation != null) && (!"".equals(annotation.operationName()))) { return annotation.operationName(); } return operationName; }
/** * The operation name of this web method. * * @return The operation name of this web method. */ public String getOperationName() { String operationName = getSimpleName(); if ((annotation != null) && (!"".equals(annotation.operationName()))) { return annotation.operationName(); } return operationName; }
/** * The operation name of this web method. * * @return The operation name of this web method. */ public String getOperationName() { String operationName = getSimpleName(); if ((annotation != null) && (!"".equals(annotation.operationName()))) { return annotation.operationName(); } return operationName; }
protected GWTEndpointImpl(Object serviceBean) { this.serviceBean = serviceBean; for (Method method : getServiceInterface().getMethods()) { String operationName = method.getName(); WebMethod webMethodInfo = method.getAnnotation(WebMethod.class); if ((webMethodInfo != null) && (!"".equals(webMethodInfo.operationName()))) { operationName = webMethodInfo.operationName(); } this.operationNames2Methods.put(operationName, method); } }
public String getOperationName(ServiceInfo service, Method method) { Annotation[] annotations = method.getAnnotations(); for (int i = 0; i < annotations.length; i++) { if (annotations[i] instanceof WebMethod) { if (((WebMethod) annotations[i]).operationName() != null) { String name = ((WebMethod) annotations[i]).operationName(); if (name != null && name.length() > 0) { return name; } } } } return super.getOperationName(service, method); }
public String getOperationName() { if (null != webMethodAnnotation && !"".equals(webMethodAnnotation.operationName())) { return webMethodAnnotation.operationName(); } if (getMethod() == null) { return ""; } return getMethod().getName(); }
@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()); }
protected AMFEndpointImpl(Object serviceBean) { this.serviceBean = serviceBean; this.operationNames2Methods.clear(); for (Method method : getServiceInterface().getMethods()) { String operationName = method.getName(); WebMethod webMethodInfo = method.getAnnotation(WebMethod.class); // If the annotation exclude the method, don't add it to the possible operations. if ((webMethodInfo != null) && (webMethodInfo.exclude())) { continue; } else if ((webMethodInfo != null) && (!"".equals(webMethodInfo.operationName()))) { operationName = webMethodInfo.operationName(); } this.operationNames2Methods.put(operationName, method); } }
/** * Returns the WSDL name for an operation following JAX-WS rules. Namely, if present the <code>@WebMethod.operationName()</code> attribute value is used, * otherwise the default operation name is returned. * * @param operation the operation definition * @param serviceClass the implementation class * @return the WSDL operation name */ private static String getWsdlName(Operation operation, Class<?> serviceClass) { Method method = findMethod(operation, serviceClass); WebMethod annotation = method.getAnnotation(WebMethod.class); if (annotation == null || annotation.operationName().length() < 1) { return operation.getName(); } return annotation.operationName(); }
private static String determineOperationName(Method javaMethod) { String operationName = null; if (javaMethod == null) { return null; } WebMethod wmAnnotation = (WebMethod) getAnnotation(javaMethod,WebMethod.class); // Per JSR-181 MR Sec 4.2 "Annotation: javax.jws.WebMethod" pg 17, // if @WebMethod specifies and operation name, use that. Otherwise // default is the Java method name if (wmAnnotation != null && !DescriptionUtils.isEmpty(wmAnnotation.operationName())) { operationName = wmAnnotation.operationName(); } else { operationName = javaMethod.getName(); } return operationName; }
private static String determineOperationName(Method javaMethod) { String operationName = null; if (javaMethod == null) { return null; } WebMethod wmAnnotation = (WebMethod) getAnnotation(javaMethod,WebMethod.class); // Per JSR-181 MR Sec 4.2 "Annotation: javax.jws.WebMethod" pg 17, // if @WebMethod specifies and operation name, use that. Otherwise // default is the Java method name if (wmAnnotation != null && !DescriptionUtils.isEmpty(wmAnnotation.operationName())) { operationName = wmAnnotation.operationName(); } else { operationName = javaMethod.getName(); } return operationName; }
private static String determineOperationName(MethodDescriptionComposite mdc) { String operationName = null; if (mdc == null) { return null; } WebMethod wmAnnotation = mdc.getWebMethodAnnot(); if (wmAnnotation != null && !DescriptionUtils.isEmpty(wmAnnotation.operationName())) { operationName = wmAnnotation.operationName(); } else { operationName = mdc.getMethodName(); } return operationName; }
private static String determineOperationName(MethodDescriptionComposite mdc) { String operationName = null; if (mdc == null) { return null; } WebMethod wmAnnotation = mdc.getWebMethodAnnot(); if (wmAnnotation != null && !DescriptionUtils.isEmpty(wmAnnotation.operationName())) { operationName = wmAnnotation.operationName(); } else { operationName = mdc.getMethodName(); } return operationName; }
@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; }
public WebMethodAnnotation getWebMethodAnnotation(Method method) { WebMethod webMethod = (WebMethod) method.getAnnotation(WebMethod.class); if (webMethod != null) { WebMethodAnnotation annotation = new WebMethodAnnotation(); annotation.setAction(webMethod.action()); annotation.setOperationName(webMethod.operationName()); annotation.setExclude(webMethod.exclude()); return annotation; } else { return null; } }
@Override public WrapperBeanClass getWrapperBeanClass(final Method method) { javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class); javax.jws.WebMethod webMethod = method.getAnnotation(javax.jws.WebMethod.class); String methName = webMethod == null ? null : webMethod.operationName(); if (StringUtils.isEmpty(methName)) { methName = method.getName(); } String reqClassName = getClassName(); String reqNs = null; if (reqWrapper != null) { reqClassName = reqWrapper.className().length() > 0 ? reqWrapper.className() : reqClassName; reqNs = reqWrapper.targetNamespace().length() > 0 ? reqWrapper.targetNamespace() : null; } if (reqClassName == null) { reqClassName = getPackageName(method) + ".jaxws." + StringUtils.capitalize(methName); } WrapperBeanClass jClass = new WrapperBeanClass(); jClass.setFullClassName(reqClassName); jClass.setNamespace(reqNs); return jClass; }
@Test public void testAnnotation() throws Exception { Class<PutLastTradedPricePortType> claz = PutLastTradedPricePortType.class; TradePriceData priceData = new TradePriceData(); Holder<TradePriceData> holder = new Holder<>(priceData); Method method = claz.getMethod("sayHi", holder.getClass()); assertNotNull("Can not find SayHi method in generated class ", method); Annotation ann = method.getAnnotation(WebMethod.class); WebMethod webMethod = (WebMethod)ann; assertEquals(webMethod.operationName(), "SayHi"); Annotation[][] paraAnns = method.getParameterAnnotations(); for (Annotation[] paraType : paraAnns) { for (Annotation an : paraType) { if (an.annotationType() == WebParam.class) { WebParam webParam = (WebParam)an; assertNotSame("", webParam.targetNamespace()); } } } }