public Collection<WebMessagePart> getParts() { if (!isBare() && !isHeader()) { throw new UnsupportedOperationException("Web result doesn't represent a complex method input/output."); } return new ArrayList<WebMessagePart>(Arrays.asList(this)); }
/** * If the web method style is RPC, the particle type is TYPE. Otherwise, it's ELEMENT. * * @return The particle type. */ public ParticleType getParticleType() { return this.method.getSoapBindingStyle() == SOAPBinding.Style.RPC ? isHeader() ? ParticleType.ELEMENT : ParticleType.TYPE : ParticleType.ELEMENT; }
/** * This web result defines an implicit schema element if it is of DOCUMENT binding style and it is * either BARE or a header. * * @return Whether this web result is an implicit schema element. */ public boolean isImplicitSchemaElement() { return isHeader() || (method.getSoapBindingStyle() != SOAPBinding.Style.RPC && method.getSoapParameterStyle() == SOAPBinding.ParameterStyle.BARE); }
/** * The qname of the particle for this web result. If the {@link #getParticleType() particle type} is * TYPE then it's the qname of the xml type. Otherwise, it's the qname of the implicit schema * element. * * @return The qname of the particle for this web result as a part. */ public QName getParticleQName() { if (method.getSoapBindingStyle() == SOAPBinding.Style.RPC && !isHeader()) { return getTypeQName(); } else { return new QName(getTargetNamespace(), getElementName()); } }
/** * The collection of output parameters for this response. * * @return The collection of output parameters for this response. */ public Collection<ImplicitChildElement> getChildElements() { Collection<ImplicitChildElement> childElements = new ArrayList<ImplicitChildElement>(); if (webMethod.getReturnType().getKind() != TypeKind.VOID) { WebResult webResult = webMethod.getWebResult(); if (!webResult.isHeader()) { childElements.add(webResult); } } for (WebParam webParam : webMethod.getWebParameters()) { if (webParam.isOutput() && !webParam.isHeader()) { childElements.add(webParam); } } return childElements; }
/** * The message name in the case of a document/bare service. * * @return The message name in the case of a document/bare service. */ public String getMessageName() { String messageName = null; if (isBare()) { messageName = method.getDeclaringEndpointInterface().getSimpleName() + "." + method.getSimpleName() + "Response"; } else if (isHeader()) { messageName = method.getDeclaringEndpointInterface().getSimpleName() + "." + method.getSimpleName() + "." + getName(); } return messageName; }
/** * Gets the client-side package for the type, type declaration, package, or their string values. * * @param list The arguments. * @return The string value of the client-side package. */ public Object exec(List list) throws TemplateModelException { if (list.size() < 1) { throw new TemplateModelException("The responseDocumentQName method method must have a web method as a parameter."); } TemplateModel from = (TemplateModel) list.get(0); Object unwrapped = new BeansWrapperBuilder(Configuration.getVersion()).build().unwrap(from); if (!(unwrapped instanceof WebMethod)) { throw new TemplateModelException("A web method must be provided."); } WebMethod webMethod = (WebMethod) unwrapped; if (webMethod.getSoapBindingStyle() != SOAPBinding.Style.DOCUMENT || webMethod.getSoapUse() != SOAPBinding.Use.LITERAL) { throw new TemplateModelException("No response document qname available for a " + webMethod.getSoapBindingStyle() + "/" + webMethod.getSoapUse() + " web method."); } if (webMethod.getResponseWrapper() != null) { return new QName(webMethod.getResponseWrapper().getElementNamespace(), webMethod.getResponseWrapper().getElementName()); } else if (webMethod.getSoapParameterStyle() == SOAPBinding.ParameterStyle.BARE) { WebResult wr = webMethod.getWebResult(); if (!wr.isHeader()) { return new QName(wr.getTargetNamespace(), wr.getElementName()); } } return null; }
/** * Gets the client-side package for the type, type declaration, package, or their string values. * * @param list The arguments. * @return The string value of the client-side package. */ public Object exec(List list) throws TemplateModelException { if (list.size() < 1) { throw new TemplateModelException("The responseDocumentQName method method must have a web method as a parameter."); } TemplateModel from = (TemplateModel) list.get(0); Object unwrapped = new BeansWrapperBuilder(Configuration.getVersion()).build().unwrap(from); if (!(unwrapped instanceof WebMethod)) { throw new TemplateModelException("A web method must be provided."); } WebMethod webMethod = (WebMethod) unwrapped; if (webMethod.getSoapBindingStyle() != SOAPBinding.Style.DOCUMENT || webMethod.getSoapUse() != SOAPBinding.Use.LITERAL) { throw new TemplateModelException("No response document qname available for a " + webMethod.getSoapBindingStyle() + "/" + webMethod.getSoapUse() + " web method."); } if (webMethod.getResponseWrapper() != null) { return new QName(webMethod.getResponseWrapper().getElementNamespace(), webMethod.getResponseWrapper().getElementName()); } else if (webMethod.getSoapParameterStyle() == SOAPBinding.ParameterStyle.BARE) { WebResult wr = webMethod.getWebResult(); if (!wr.isHeader()) { return new QName(wr.getTargetNamespace(), wr.getElementName()); } } return null; }
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; }
if (webMethod.getWebResult().isHeader()) { javax.lang.model.element.Element conflict = paramsByName.put(webMethod.getWebResult().getElementName(), webMethod); if (conflict != null) {
if (webMethod.getWebResult().isHeader()) { javax.lang.model.element.Element conflict = paramsByName.put(webMethod.getWebResult().getElementName(), webMethod); if (conflict != null) {