![JAR search and dependency download from the Maven repository](/logo.png)
org.codehaus.enunciate.modules.xml.wsdl.fmt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of enunciate-xml Show documentation
Show all versions of enunciate-xml Show documentation
The Enunciate XML module generates the XML artifacts (schema, WSDL) for the Enunciated project.
The newest version!
[#ftl]
[#--
Template library for WSDL.
--]
[#--
The processWsdl macro outputs a given WSDL.
@param wsdl The WSDL to output. (Instance of org.codehaus.enunciate.config.WsdlInfo)
--]
[#import "schema.fmt" as libSchema/]
[#macro processWsdl wsdl]
[#-- assign the prefix variable for the "this" namespace --]
[#assign tns=prefix(wsdl.targetNamespace)]
[#-- assign the prefix variable for the "wsdl" namespace --]
[#assign wsdldef=prefix("http://schemas.xmlsoap.org/wsdl/")]
[#-- assign the prefix variable for the "http" namespace --]
[#assign http=prefix("http://schemas.xmlsoap.org/wsdl/http/")]
[#-- assign the prefix variable for the "mime" namespace --]
[#assign mime=prefix("http://schemas.xmlsoap.org/wsdl/mime/")]
[#-- assign the prefix variable for the "soap" namespace --]
[#assign soap=prefix("http://schemas.xmlsoap.org/wsdl/soap/")]
[#-- assign the prefix variable for the "soapenc" namespace --]
[#assign soapenc=prefix("http://schemas.xmlsoap.org/soap/encoding/")]
[#-- assign the prefix variable for the schema namespace --]
[#assign xs=prefix("http://www.w3.org/2001/XMLSchema")]
[#t]
<${wsdldef}:definitions targetNamespace="${wsdl.targetNamespace}"
[#list wsdl.importedNamespaces as importedNamespace]
[#if importedNamespace?exists && importedNamespace?length > 0]
xmlns:${prefix(importedNamespace)}="${importedNamespace}"
[/#if]
[/#list]
>
<${wsdldef}:types>
[@processSchema wsdl=wsdl/]
${wsdldef}:types>
[#-- output the web messages --]
[@forEachWebMessage wsdl=wsdl considerFacets="true"]
[@processMessage webMessage=webMessage/]
[/@forEachWebMessage]
[@forEachEndpointInterface wsdl=wsdl considerFacets="true"]
[@processPortType endpointInterface=endpointInterface/]
[/@forEachEndpointInterface]
[#t]
[@forEachEndpointInterface wsdl=wsdl considerFacets="true"]
[@processBindings endpointInterface=endpointInterface/]
[/@forEachEndpointInterface]
[@forEachEndpointInterface wsdl=wsdl considerFacets="true"]
[@processServices endpointInterface=endpointInterface/]
[/@forEachEndpointInterface]
${wsdldef}:definitions>
[/#macro]
[#--
The processSchema macro outputs a schema element for a specified wsdl.
@param wsdl The WSDL to output. (Instance of org.codehaus.enunciate.config.WsdlInfo)
--]
[#macro processSchema wsdl]
<${xs}:schema targetNamespace="${wsdl.targetNamespace}"[#if wsdl.associatedSchema?? && wsdl.associatedSchema.elementFormDefault??] elementFormDefault="${wsdl.associatedSchema.elementFormDefault}" [/#if][#if wsdl.associatedSchema?? && wsdl.associatedSchema.attributeFormDefault??] attributeFormDefault="${wsdl.associatedSchema.attributeFormDefault}" [/#if]>
[#list wsdl.importedSchemas as schema]
<${xs}:import[#if schema.namespace?exists && schema.namespace?length > 0] namespace="${schema.namespace}"[/#if][#if schema.location?exists] schemaLocation="${schema.location}"[/#if]/>
[/#list]
[#if wsdl.associatedSchema??]
[#if wsdl.inlineSchema]
[@libSchema.processSchemaBody schema=wsdl.associatedSchema/]
[#elseif wsdl.associatedSchema.location??]
<${xs}:include schemaLocation="${wsdl.associatedSchema.location}"/>
[/#if]
[/#if]
${xs}:schema>
[/#macro]
[#--
The processMessage macro outputs a message element for a specified web message.
@param webMessage The web message to output. (Instance of org.codehaus.enunciate.contract.jaxws.WebMessage)
--]
[#macro processMessage webMessage]
<${wsdldef}:message name="${webMessage.messageName}">
[#if webMessage.messageDocs?exists]
<${wsdldef}:documentation>
${wsdldef}:documentation>
[/#if]
[#list webMessage.parts as part]
<${wsdldef}:part name="${part.partName}" ${part.particleType?lower_case}="${part.particleQName}">
[#if part.partDocs?exists]
<${wsdldef}:documentation>
${wsdldef}:documentation>
[/#if]
${wsdldef}:part>
[/#list]
${wsdldef}:message>
[/#macro]
[#--
The processPortType macro outputs a portType element for a specified endpoint interface.
@param endpointInterface The endpoint interface to output. (Instance of org.codehaus.enunciate.contract.jaxws.EndpointInterface)
--]
[#macro processPortType endpointInterface]
<${wsdldef}:portType name="${endpointInterface.portTypeName}">
[#if endpointInterface.docValue?exists]
<${wsdldef}:documentation>
${wsdldef}:documentation>
[/#if]
[@forEachWebMethod endpointInterface=endpointInterface considerFacets="true"]
[@processOperation webMethod=webMethod/]
[/@forEachWebMethod]
${wsdldef}:portType>
[/#macro]
[#--
The processOperation macro outputs an operation element for a web method.
@param webMethod The web method to output. (Instance of org.codehaus.enunciate.contract.jaxws.WebMethod)
--]
[#macro processOperation webMethod]
<${wsdldef}:operation name="${webMethod.operationName}">
[#if webMethod.docValue?exists]
<${wsdldef}:documentation>
${wsdldef}:documentation>
[/#if]
[@forEachWebMessage webMethod=webMethod var="input" includeHeaders=false includeFaults=false includeOutput=false includeInput=true considerFacets="true"]
<${wsdldef}:input message="${tns}:${input.messageName}"/>
[/@forEachWebMessage]
[@forEachWebMessage webMethod=webMethod var="output" includeHeaders=false includeFaults=false includeOutput=true includeInput=false considerFacets="true"]
<${wsdldef}:output message="${tns}:${output.messageName}"/>
[/@forEachWebMessage]
[@forEachThrownWebFault webMethod=webMethod var="fault"]
<${wsdldef}:fault name="${fault.partName}" message="${tns}:${fault.messageName}"/>
[/@forEachThrownWebFault]
${wsdldef}:operation>
[/#macro]
[#--
The processBindings macro outputs a all binding elements for a specified endpoint interface.
@param endpointInterface The endpoint interface to output. (Instance of org.codehaus.enunciate.contract.jaxws.EndpointInterface)
--]
[#macro processBindings endpointInterface]
[@forEachBindingType]
[#if bindingType.soap11 || bindingType.soap12]
[@processSOAPBinding endpointInterface=endpointInterface/]
[#elseif bindingType.http]
[@processHTTPBinding endpointInterface=endpointInterface/]
[#else]
[#stop "unknown binding type: " + bindingType.namespace]
[/#if]
[/@forEachBindingType]
[/#macro]
[#--todo: figure out whether/if I need to process a MIME SOAP binding for attachments?--]
[#--
The processSOAPBinding macro outputs a soap binding element for a specified endpoint interface.
@param endpointInterface The endpoint interface to output. (Instance of org.codehaus.enunciate.contract.jaxws.EndpointInterface)
--]
[#macro processSOAPBinding endpointInterface]
<${wsdldef}:binding name="${endpointInterface.soapBindingName}" type="${tns}:${endpointInterface.portTypeName}">
<${wsdldef}:documentation>
${wsdldef}:documentation>
<${soap}:binding transport="http://schemas.xmlsoap.org/soap/http" style="${endpointInterface.soapBindingStyle?lower_case}"/>
[@forEachWebMethod endpointInterface=endpointInterface considerFacets="true"]
<${wsdldef}:operation name="${webMethod.operationName}">
<${soap}:operation soapAction="${webMethod.action}"[#if (webMethod.soapBindingStyle?lower_case) != (endpointInterface.soapBindingStyle?lower_case)] style="${webMethod.soapBindingStyle?lower_case}"[/#if]/>
<${wsdldef}:input>
[@forEachWebMessage webMethod=webMethod var="message" includeFaults=false includeOutput=false considerFacets="true"]
[#if message.header]
<${soap}:header message="${tns}:${message.messageName}" part="${message.partName}"/>
[/#if]
[/@forEachWebMessage]
[#-- todo: figure out if this element is valid even if there isn't a body. --]
<${soap}:body use="literal"[#if webMessage.requestWrapper?? && webMethod.soapBindingStyle?lower_case == "rpc"] namespace="${webMessage.requestWrapper.elementNamespace!""}"[/#if]/>
${wsdldef}:input>
<${wsdldef}:output>
[@forEachWebMessage webMethod=webMethod var="message" includeFaults=false includeInput=false considerFacets="true"]
[#if message.header]
<${soap}:header message="${tns}:${message.messageName}" part="${message.partName}"/>
[/#if]
[/@forEachWebMessage]
[#-- todo: figure out if this element is valid even if there isn't a body. --]
<${soap}:body use="literal"[#if webMessage.responseWrapper?? && webMethod.soapBindingStyle?lower_case == "rpc"] namespace="${webMessage.responseWrapper.elementNamespace!""}"[/#if]/>
${wsdldef}:output>
[@forEachThrownWebFault webMethod=webMethod]
<${wsdldef}:fault name="${webFault.partName}">
<${soap}:fault name="${webFault.partName}" use="literal"/>
${wsdldef}:fault>
[/@forEachThrownWebFault]
${wsdldef}:operation>
[/@forEachWebMethod]
${wsdldef}:binding>
[/#macro]
[#--
The processHTTPBinding macro outputs an HTTP binding element for a specified endpoint interface.
@param endpointInterface The endpoint interface to output. (Instance of org.codehaus.enunciate.contract.jaxws.EndpointInterface)
--]
[#macro processHTTPBinding endpointInterface]
<${wsdldef}:binding name="${endpointInterface.simpleName}HTTPBinding" type="${tns}:${endpointInterface.portTypeName}">
<${wsdldef}:documentation>
${wsdldef}:documentation>
<${http}:binding verb="POST"/>
[@forEachWebMethod endpointInterface=endpointInterface considerFacets="true" considerFacets="true"]
<${wsdldef}:operation name="${webMethod.operationName}">
<${http}:operation location="TBD"/>
<${wsdldef}:input>
<${http}:urlEncoded/>
${wsdldef}:input>
<${wsdldef}:output>
<${http}:urlEncoded/>
${wsdldef}:output>
${wsdldef}:operation>
[/@forEachWebMethod]
${wsdldef}:binding>
[/#macro]
[#--
The processServices macro outputs the service element for a specified endpoint interface.
@param endpointInterface The endpoint interface to output. (Instance of org.codehaus.enunciate.contract.jaxws.EndpointInterface)
--]
[#macro processServices endpointInterface]
<${wsdldef}:service name="${endpointInterface.serviceName}">
[@forEachBindingType]
[#if bindingType.soap11 || bindingType.soap12]
[@processSOAPServicePort endpointInterface=endpointInterface/]
[#elseif bindingType.http]
[@processHTTPServicePort endpointInterface=endpointInterface/]
[/#if]
[/@forEachBindingType]
${wsdldef}:service>
[/#macro]
[#--
The processSOAPServicePort macro outputs a soap port element for a specified endpoint interface.
@param endpointInterface The endpoint interface to output. (Instance of org.codehaus.enunciate.contract.jaxws.EndpointInterface)
--]
[#macro processSOAPServicePort endpointInterface]
<${wsdldef}:port name="${endpointInterface.simpleName}Port" binding="${tns}:${endpointInterface.soapBindingName}">
<${soap}:address location="${baseDeploymentAddress}${endpointInterface.metaData.soapPath?default("/soap/" + endpointInterface.serviceName)}"/>
${wsdldef}:port>
[/#macro]
[#--
The processHTTPServicePort macro outputs a http port element for a specified endpoint interface.
@param endpointInterface The endpoint interface to output. (Instance of org.codehaus.enunciate.contract.jaxws.EndpointInterface)
--]
[#macro processHTTPServicePort endpointInterface]
<${wsdldef}:port name="${endpointInterface.simpleName}HTTPPort" binding="${tns}:${endpointInterface.simpleName}HTTPBinding">
[#--todo: make this address a known token so the server-side code can process it.--]
[#--todo: add an option to state this address statically.--]
<${http}:address location="TBD"/>
${wsdldef}:port>
[/#macro]
© 2015 - 2025 Weber Informatics LLC | Privacy Policy