public TemplateModel get(String key) throws TemplateModelException { if ("name".equals(key)) { return this.wrapper.wrap(result.getName()); } else if ("targetNamespace".equals(key)) { return this.wrapper.wrap(result.getTargetNamespace()); } else if ("partName".equals(key)) { return this.wrapper.wrap(result.getPartName()); } else if ("webMethod".equals(key)) { return this.wrapper.wrap(result.getWebMethod()); } else { return ((TemplateHashModel) this.wrapper.wrap(result.getType())).get(key); } }
/** * 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()); } }
if (webMethod.getWebResult().isHeader()) { javax.lang.model.element.Element conflict = paramsByName.put(webMethod.getWebResult().getElementName(), webMethod); if (conflict != null) { warn("%s: C# requires that all header parameters defined in the same endpoint interface have unique names. This return parameter conflicts with the one at %s.", positionOf(webMethod), positionOf(conflict)); if (webMethod.getWebResult().getType() instanceof MapType) { warn("%s: C# can't handle return types that are maps.", positionOf(webMethod)); usesUnmappableElements = true;
/** * 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; }
@Override public TypeMirror getClientConvertibleType() { return getType(); } }
protected void addReferencedTypeDefinitions(WebMethod webMethod, LinkedList<Element> contextStack) { contextStack.push(webMethod); try { WebResult result = webMethod.getWebResult(); this.jaxbModule.getJaxbContext().addReferencedTypeDefinitions(result.isAdapted() ? result.getAdapterType() : result.getType(), contextStack); for (WebParam webParam : webMethod.getWebParameters()) { this.jaxbModule.getJaxbContext().addReferencedTypeDefinitions(webParam.isAdapted() ? webParam.getAdapterType() : webParam.getType(), contextStack); } for (WebFault webFault : webMethod.getWebFaults()) { addReferencedTypeDefinitions(webFault, contextStack); } } finally { contextStack.pop(); } }
/** * 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; }
/** * 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.oneWay = getAnnotation(Oneway.class) != null; this.endpointInterface = endpointInterface; this.webResult = new WebResult(getReturnType(), this, context); if (webResult.isHeader()) { messages.add(webResult); if (!isOneWay() && getReturnType().getKind() != TypeKind.VOID && !webResult.isHeader()) { messages.add(webResult);
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) { warn("%s: C# requires that all header parameters defined in the same endpoint interface have unique names. This return parameter conflicts with the one at %s.", positionOf(webMethod), positionOf(conflict)); if (webMethod.getWebResult().getType() instanceof MapType) { warn("%s: C# can't handle return types that are maps.", positionOf(webMethod)); usesUnmappableElements = true;
/** * 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 xml type of this result. * * @return The xml type of this result. */ public XmlType getXmlType() { XmlType xmlType = XmlTypeFactory.findSpecifiedType(this, this.context.getJaxbContext()); if (xmlType == null) { xmlType = XmlTypeFactory.getXmlType(getType(), this.context.getJaxbContext()); } return xmlType; }
/** * 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); }
public TemplateModel get(String key) throws TemplateModelException { if ("name".equals(key)) { return this.wrapper.wrap(result.getName()); } else if ("targetNamespace".equals(key)) { return this.wrapper.wrap(result.getTargetNamespace()); } else if ("partName".equals(key)) { return this.wrapper.wrap(result.getPartName()); } else if ("webMethod".equals(key)) { return this.wrapper.wrap(result.getWebMethod()); } else { return ((TemplateHashModel) this.wrapper.wrap(result.getType())).get(key); } }
/** * 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; }