@Override public QName getOutPartName(OperationInfo op, Method method, int paramNumber) { method = getDeclaredMethod(method); if (paramNumber >= 0) { return getPartName(op, method, paramNumber, op.getOutput(), "return", false); } WebResult webResult = getWebResult(method); String tns = op.getOutput().getName().getNamespaceURI(); String local = null; if (webResult != null) { if (Boolean.TRUE.equals(isRPC(method)) || isDocumentBare(method)) { local = webResult.partName(); } if (local == null || local.length() == 0) { local = webResult.name(); } } if (local == null || local.length() == 0) { if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) { local = "return"; } else { local = getOperationName(op.getInterface(), method).getLocalPart() + "Response"; } } return new QName(tns, local); }
if (webResult != null) { tns = webResult.targetNamespace(); local = webResult.name();
/** * XFire defaults the name of the return value to "out". The JAXWS spec says "return".... * * @param service The service. * @param op The operation. * @param method The method. * @param paramNumber The parameter number. * @param doc Whether its doc-style binding. * @return The out parameter name. */ @Override protected QName getOutParameterName(final Service service, final OperationInfo op, final Method method, final int paramNumber, final boolean doc) { QName parameterName = super.getOutParameterName(service, op, method, paramNumber, doc); if (paramNumber == -1) { WebResult webResult = method.getReturnType().getAnnotation(WebResult.class); if ((webResult == null) || ("".equals(webResult.name()))) { parameterName = new QName(parameterName.getNamespaceURI(), "return"); } } return parameterName; }
/** * XFire defaults the name of the return value to "out". The JAXWS spec says "return".... * * @param service The service. * @param op The operation. * @param method The method. * @param paramNumber The parameter number. * @param doc Whether its doc-style binding. * @return The out parameter name. */ @Override protected QName getOutParameterName(final Service service, final OperationInfo op, final Method method, final int paramNumber, final boolean doc) { QName parameterName = super.getOutParameterName(service, op, method, paramNumber, doc); if (paramNumber == -1) { WebResult webResult = method.getReturnType().getAnnotation(WebResult.class); if ((webResult == null) || ("".equals(webResult.name()))) { parameterName = new QName(parameterName.getNamespaceURI(), "return"); } } return parameterName; }
public QName getWebResultQName() { if (null != webResultAnnotation) { if (getSOAPStyle() == Style.DOCUMENT) { if ("".equals(webResultAnnotation.name())) { return new QName(webResultAnnotation.targetNamespace(), "return"); } return new QName(webResultAnnotation.targetNamespace(), webResultAnnotation.name()); } else { return new QName("", webResultAnnotation.partName()); } } return SOAPConstants.EMPTY_QNAME; }
public QName getWebResultQName() { WebResult res = getWebResult(); if (null != res) { if (getSOAPStyle() == Style.DOCUMENT) { if ("".equals(res.name())) { return new QName(res.targetNamespace(), "return"); } return new QName(res.targetNamespace(), res.name()); } else { return new QName("", res.partName()); } } return new QName("", ""); }
private void writeResponseToContext(Object payload) { WebResult wr = getMethod().getAnnotation(WebResult.class); assert wr != null : "WebResult is null for method " + getMethod(); Object retVal = getAttributeFromWrapper(payload, wr.name()); msgContext.put(ObjectMessageContext.METHOD_RETURN, retVal); }
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; }
protected WebResult(TypeMirror delegate, WebMethod method) { super(delegate); this.method = method; this.annotation = method.getAnnotation(javax.jws.WebResult.class); String partName = "return"; if ((this.annotation != null) && (!"".equals(this.annotation.partName()))) { partName = this.annotation.partName(); } this.partName = partName; this.header = ((this.annotation != null) && (this.annotation.header())); this.adapterType = AdapterUtil.findAdapterType(method); String name = "return"; if ((this.annotation != null) && (this.annotation.name() != null) && (!"".equals(this.annotation.name()))) { name = this.annotation.name(); this.elementName = name; } else if (!isHeader() && isImplicitSchemaElement()) { this.elementName = method.getSimpleName() + "Response"; } else if (this.header) { this.elementName = ""; } else { this.elementName = name; } this.name = name; }
protected WebResult(TypeMirror delegate, WebMethod method) { super(delegate); this.method = method; javax.jws.WebResult annotation = method.getAnnotation(javax.jws.WebResult.class); String name = "return"; if ((annotation != null) && (annotation.name() != null) && (!"".equals(annotation.name()))) { name = annotation.name(); } this.name = name; String targetNamespace = method.getDeclaringEndpointInterface().getTargetNamespace(); if ((annotation != null) && (annotation.targetNamespace() != null) && (!"".equals(annotation.targetNamespace()))) { targetNamespace = annotation.targetNamespace(); } this.targetNamespace = targetNamespace; String partName = "return"; if ((annotation != null) && (!"".equals(annotation.partName()))) { partName = annotation.partName(); } this.partName = partName; this.header = ((annotation != null) && (annotation.header())); this.adapterType = AdapterUtil.findAdapterType(method); }
/** * create a variable from a method's return which is @WebResult annotated */ public static JavaLanguageVariable createVariableFromMethodReturn(Method method) { WebResult webResultAnnotation = method.getAnnotation(WebResult.class); if (webResultAnnotation == null) { throw new IllegalArgumentException(method.getName() + ": return result is not annotated with " + WebResult.class.getSimpleName()); } JavaLanguageVariable variable = new JavaLanguageVariable(); variable.setType(GenericsUtils.getMethodGenericReturnType(method)); variable.setVariableName(webResultAnnotation.name()); variable.setRequired(true); variable.setHeader(webResultAnnotation.header()); Class<?> resultClass = method.getReturnType(); variable.setMultiOccurs(isClassArrayOrCollection(resultClass)); return variable; }
protected WebResult(TypeMirror delegate, WebMethod method, EnunciateJaxwsContext context) { super(delegate, context.getContext().getProcessingEnvironment()); this.context = context; this.method = method; this.annotation = method.getAnnotation(javax.jws.WebResult.class); String partName = "return"; if ((this.annotation != null) && (!"".equals(this.annotation.partName()))) { partName = this.annotation.partName(); } this.partName = partName; this.header = ((this.annotation != null) && (this.annotation.header())); this.adapterType = JAXBUtil.findAdapterType(method, context.getJaxbContext()); String name = "return"; if ((this.annotation != null) && (this.annotation.name() != null) && (!"".equals(this.annotation.name()))) { name = this.annotation.name(); this.elementName = name; } else if (!isHeader() && isImplicitSchemaElement()) { this.elementName = method.getSimpleName() + "Response"; } else if (this.header) { this.elementName = ""; } else { this.elementName = name; } this.name = name; }
@Override public QName getOutPartName(OperationInfo op, Method method, int paramNumber) { method = getDeclaredMethod(method); if (paramNumber >= 0) { return getPartName(op, method, paramNumber, op.getOutput(), "return", false); } WebResult webResult = getWebResult(method); String tns = op.getOutput().getName().getNamespaceURI(); String local = null; if (webResult != null) { if (Boolean.TRUE.equals(isRPC(method)) || isDocumentBare(method)) { local = webResult.partName(); } if (local == null || local.length() == 0) { local = webResult.name(); } } if (local == null || local.length() == 0) { if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) { local = "return"; } else { local = getOperationName(op.getInterface(), method).getLocalPart() + "Response"; } } return new QName(tns, local); }
protected void introspectAnnotations(Annotation[] annotations, DataType targetDataType) { WebResult result = getAnnotation(annotations, WebResult.class); if (result != null) { QName name = new QName(result.targetNamespace(), result.name()); targetDataType.setLogical(new XMLType(name, null)); } WebParam param = getAnnotation(annotations, WebParam.class); if (param != null) { QName name = new QName(param.targetNamespace(), param.name()); targetDataType.setLogical(new XMLType(name, null)); } }
public String getAnnoWebResultName() { if (!isOperationReturningResult()) { return null; } if (webResultName == null) { if (getAnnoWebResult() != null && !DescriptionUtils.isEmpty(getAnnoWebResult().name())) { webResultName = getAnnoWebResult().name(); } else if (getAnnoSoapBindingStyle() == SOAPBinding.Style.DOCUMENT && getAnnoSoapBindingParameterStyle() == SOAPBinding.ParameterStyle.BARE) { // Default for operation style DOCUMENT and paramater style BARE per JSR 181 MR Sec 4.5.1, pg 23 webResultName = getAnnoWebMethodOperationName() + "Response"; } else { // Defeault value is "return" per JSR-181 MR Sec. 4.5.1, p. 22 webResultName = "return"; } } return webResultName; }
public String getAnnoWebResultName() { if (!isOperationReturningResult()) { return null; } if (webResultName == null) { if (getAnnoWebResult() != null && !DescriptionUtils.isEmpty(getAnnoWebResult().name())) { webResultName = getAnnoWebResult().name(); } else if (getAnnoSoapBindingStyle() == SOAPBinding.Style.DOCUMENT && getAnnoSoapBindingParameterStyle() == SOAPBinding.ParameterStyle.BARE) { // Default for operation style DOCUMENT and paramater style BARE per JSR 181 MR Sec 4.5.1, pg 23 webResultName = getAnnoWebMethodOperationName() + "Response"; } else { // Defeault value is "return" per JSR-181 MR Sec. 4.5.1, p. 22 webResultName = "return"; } } return webResultName; }
if (webResult != null) { tns = webResult.targetNamespace(); local = webResult.name();
public WebResultAnnotation getWebResultAnnotation(Method method) { Annotation[][] annotations = method.getParameterAnnotations(); WebResult webResult = (WebResult) method.getAnnotation(WebResult.class); if (webResult != null) { WebResultAnnotation annot = new WebResultAnnotation(); annot.setName(webResult.name()); annot.setTargetNamespace(webResult.targetNamespace()); annot.setHeader(webResult.header()); annot.setPartName(webResult.partName()); return annot; } else { return null; } }
/** * This method will drive the attachment of @WebResult annotation data to the * <code>MethodDescriptionComposite</code> * * @param mdc - <code>MethodDescriptionComposite</code> * @param method - <code>Method</code> */ private void attachWebResultAnnotation(MethodDescriptionComposite mdc, Method method) { WebResult webResult = (WebResult)ConverterUtils.getAnnotation(WebResult.class, method); if (webResult != null) { WebResultAnnot wrAnnot = WebResultAnnot.createWebResultAnnotImpl(); wrAnnot.setHeader(webResult.header()); wrAnnot.setName(webResult.name()); wrAnnot.setPartName(webResult.partName()); wrAnnot.setTargetNamespace(webResult.targetNamespace()); mdc.setWebResultAnnot(wrAnnot); } }
/** * This method will drive the attachment of @WebResult annotation data to the * <code>MethodDescriptionComposite</code> * * @param mdc - <code>MethodDescriptionComposite</code> * @param method - <code>Method</code> */ private void attachWebResultAnnotation(MethodDescriptionComposite mdc, Method method) { WebResult webResult = (WebResult)ConverterUtils.getAnnotation(WebResult.class, method); if (webResult != null) { WebResultAnnot wrAnnot = WebResultAnnot.createWebResultAnnotImpl(); wrAnnot.setHeader(webResult.header()); wrAnnot.setName(webResult.name()); wrAnnot.setPartName(webResult.partName()); wrAnnot.setTargetNamespace(webResult.targetNamespace()); mdc.setWebResultAnnot(wrAnnot); } }