@Override public String getResponseWrapperClassName(Method selected) { Method m = getDeclaredMethod(selected); ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class); String clsName = ""; if (rw != null) { clsName = rw.className(); } if (clsName.length() > 0) { return clsName; } return null; } public String getRequestWrapperClassName(Method selected) {
+ "Response"; } else { clsName = rw.className();
public String getResponseWrapperType() { if (null != respWrapper) { return respWrapper.className(); } return ""; }
@Override public String getResponseWrapperClassName(Method selected) { Method m = getDeclaredMethod(selected); ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class); String clsName = ""; if (rw != null) { clsName = rw.className(); } if (clsName.length() > 0) { return clsName; } return null; } public String getRequestWrapperClassName(Method selected) {
private boolean isRequestPayload(Object payload) { Method m = getMethod(); RequestWrapper reqWrapper = m.getAnnotation(RequestWrapper.class); ResponseWrapper respWrapper = m.getAnnotation(ResponseWrapper.class); if (reqWrapper != null) { return payload.getClass().getName().equals(reqWrapper.className()); } else if (respWrapper != null) { return !payload.getClass().getName().equals(respWrapper.className()); } return true; }
/** * The name of the JAXWS response bean. * * @return The name of the JAXWS response bean. */ public String getResponseBeanName() { String capitalizedName = this.webMethod.getSimpleName().toString(); capitalizedName = Character.toString(capitalizedName.charAt(0)).toUpperCase() + capitalizedName.substring(1); String responseBeanName = this.webMethod.getDeclaringEndpointInterface().getPackage().getQualifiedName() + ".jaxws." + capitalizedName + "Response"; javax.xml.ws.ResponseWrapper annotation = webMethod.getAnnotation(javax.xml.ws.ResponseWrapper.class); if ((annotation != null) && (annotation.className() != null) && (!"".equals(annotation.className()))) { responseBeanName = annotation.className(); } return responseBeanName; }
/** * The name of the JAXWS response bean. * * @return The name of the JAXWS response bean. */ public String getResponseBeanName() { String capitalizedName = this.webMethod.getSimpleName(); capitalizedName = Character.toString(capitalizedName.charAt(0)).toUpperCase() + capitalizedName.substring(1); String responseBeanName = this.webMethod.getDeclaringEndpointInterface().getPackage().getQualifiedName() + ".jaxws." + capitalizedName + "Response"; javax.xml.ws.ResponseWrapper annotation = webMethod.getAnnotation(javax.xml.ws.ResponseWrapper.class); if ((annotation != null) && (annotation.className() != null) && (!"".equals(annotation.className()))) { responseBeanName = annotation.className(); } return responseBeanName; }
@Override public boolean isWrapperAbsent(final Method method) { javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.class); return getClassName() == null && (resWrapper == null || StringUtils.isEmpty(resWrapper.className())); }
@Override public boolean isWrapperAbsent(final Method method) { javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.class); return getClassName() == null && (resWrapper == null || StringUtils.isEmpty(resWrapper.className())); }
/** * The name of the JAXWS response bean. * * @return The name of the JAXWS response bean. */ public String getResponseBeanName() { String capitalizedName = this.webMethod.getSimpleName(); capitalizedName = Character.toString(capitalizedName.charAt(0)).toUpperCase() + capitalizedName.substring(1); String responseBeanName = this.webMethod.getDeclaringEndpointInterface().getPackage().getQualifiedName() + ".jaxws." + capitalizedName + "Response"; javax.xml.ws.ResponseWrapper annotation = webMethod.getAnnotation(javax.xml.ws.ResponseWrapper.class); if ((annotation != null) && (annotation.className() != null) && (!"".equals(annotation.className()))) { responseBeanName = annotation.className(); } return responseBeanName; }
+ "Response"; } else { clsName = rw.className();
String responseWrapperClassName; ResponseWrapper responseWrapperInfo = method.getAnnotation(ResponseWrapper.class); if ((responseWrapperInfo != null) && (responseWrapperInfo.className() != null) && (responseWrapperInfo.className().length() > 0)) { responseWrapperClassName = responseWrapperInfo.className();
private Object buildPayloadFromResponse() { Method m = (Method)msgContext.get(ObjectMessageContext.METHOD_OBJ); // TODO -- add support for 'out' params // if (!Void.TYPE.equals(m.getReturnType())) { ResponseWrapper ann = m.getAnnotation(ResponseWrapper.class); assert ann != null : "ResponseWrapper is null"; WebResult wr = m.getAnnotation(WebResult.class); assert wr != null : "WebResult is null for method " + m; Object returnVal = msgContext.get(ObjectMessageContext.METHOD_RETURN); // if a handler has aborted the processing sequence, the // return type may be null if (returnVal != null) { Object wrapper = createWrapperInstance(ann.className()); setWrapperValue(wrapper, wr.name(), returnVal); return wrapper; } } return null; }
/** * For wrapped parameter style (based on the annotation and the WSDL), returns the wrapper * value. For non-wrapped (i.e. bare) parameter style, returns null. * * @return */ public String getAnnoResponseWrapperClassName() { if (!isWrappedParameters()) { // A wrapper is only meaningful for wrapped parameters return null; } if (responseWrapperClassName == null) { if (getAnnoResponseWrapper() != null && !DescriptionUtils.isEmpty(getAnnoResponseWrapper().className())) { responseWrapperClassName = getAnnoResponseWrapper().className(); } else { // There is no default for the ResponseWrapper class name. // In such cases the programming layer (JAXWS) may use a programming spec specific // mechanism to find the class, build the class, or operate without the class. responseWrapperClassName = null; } } return responseWrapperClassName; }
/** * For wrapped parameter style (based on the annotation and the WSDL), returns the wrapper * value. For non-wrapped (i.e. bare) parameter style, returns null. * * @return */ public String getAnnoResponseWrapperClassName() { if (!isWrappedParameters()) { // A wrapper is only meaningful for wrapped parameters return null; } if (responseWrapperClassName == null) { if (getAnnoResponseWrapper() != null && !DescriptionUtils.isEmpty(getAnnoResponseWrapper().className())) { responseWrapperClassName = getAnnoResponseWrapper().className(); } else { // There is no default for the ResponseWrapper class name. // In such cases the programming layer (JAXWS) may use a programming spec specific // mechanism to find the class, build the class, or operate without the class. responseWrapperClassName = null; } } return responseWrapperClassName; }
@Override public WrapperBeanClass getWrapperBeanClass(final Method method) { javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.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 resClassName = getClassName(); String resNs = null; if (resWrapper != null) { resClassName = resWrapper.className().length() > 0 ? resWrapper.className() : resClassName; resNs = resWrapper.targetNamespace().length() > 0 ? resWrapper.targetNamespace() : null; } if (resClassName == null) { resClassName = getPackageName(method) + ".jaxws." + StringUtils.capitalize(methName) + "Response"; } WrapperBeanClass jClass = new WrapperBeanClass(); jClass.setFullClassName(resClassName); jClass.setNamespace(resNs); return jClass; } }
@Override public WrapperBeanClass getWrapperBeanClass(final Method method) { javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.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 resClassName = getClassName(); String resNs = null; if (resWrapper != null) { resClassName = resWrapper.className().length() > 0 ? resWrapper.className() : resClassName; resNs = resWrapper.targetNamespace().length() > 0 ? resWrapper.targetNamespace() : null; } if (resClassName == null) { resClassName = getPackageName(method) + ".jaxws." + StringUtils.capitalize(methName) + "Response"; } WrapperBeanClass jClass = new WrapperBeanClass(); jClass.setFullClassName(resClassName); jClass.setNamespace(resNs); return jClass; } }
outputClass = ClassLoaderUtils.loadClass(wrapper.className(), getClass()); String[] outputOrder = ((XmlType) outputClass.getAnnotation(XmlType.class)).propOrder(); BeanInfo outputBeanInfo = Introspector.getBeanInfo(outputClass);
/** * This method will drive the attachment of @ResponeWrapper annotation data to the * <code>MethodDescriptionComposite</code> * * @param mdc - <code>MethodDescriptionComposite</code> * @param method - <code>Method</code> */ private void attachResponseWrapperAnnotation(MethodDescriptionComposite mdc, Method method) { ResponseWrapper responseWrapper = (ResponseWrapper)ConverterUtils.getAnnotation( ResponseWrapper.class, method); if (responseWrapper != null) { ResponseWrapperAnnot rwAnnot = ResponseWrapperAnnot.createResponseWrapperAnnotImpl(); rwAnnot.setClassName(responseWrapper.className()); rwAnnot.setLocalName(responseWrapper.localName()); rwAnnot.setTargetNamespace(responseWrapper.targetNamespace()); try { rwAnnot.setPartName(responseWrapper.partName()); } catch (NoSuchMethodError ex) { // Ignore: we are running on Java 1.6 and the JAX-WS 2.2 libs have not been endorsed } mdc.setResponseWrapperAnnot(rwAnnot); } }
/** * This method will drive the attachment of @ResponeWrapper annotation data to the * <code>MethodDescriptionComposite</code> * * @param mdc - <code>MethodDescriptionComposite</code> * @param method - <code>Method</code> */ private void attachResponseWrapperAnnotation(MethodDescriptionComposite mdc, Method method) { ResponseWrapper responseWrapper = (ResponseWrapper)ConverterUtils.getAnnotation( ResponseWrapper.class, method); if (responseWrapper != null) { ResponseWrapperAnnot rwAnnot = ResponseWrapperAnnot.createResponseWrapperAnnotImpl(); rwAnnot.setClassName(responseWrapper.className()); rwAnnot.setLocalName(responseWrapper.localName()); rwAnnot.setTargetNamespace(responseWrapper.targetNamespace()); try { rwAnnot.setPartName(responseWrapper.partName()); } catch (NoSuchMethodError ex) { // Ignore: we are running on Java 1.6 and the JAX-WS 2.2 libs have not been endorsed } mdc.setResponseWrapperAnnot(rwAnnot); } }