All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.enunciate.modules.java_client.client-soap-endpoint-impl.fmt Maven / Gradle / Ivy

[#ftl]
[#--template for the client-side endpoint interface.--]
[@file name=(endpointInterface.simpleName + "Impl.java")  package=(packageFor(endpointInterface) + ".impl") charset="utf-8"]
/**
 * ${(generatedCodeLicense!"")?replace("\n", "\n * ")}
 *
 * Generated by Enunciate.
 */
package ${packageFor(endpointInterface) + ".impl"};

import ${packageFor(endpointInterface) + "." + endpointInterface.simpleName};

/**
 * Implementation of the {@link ${endpointInterface.simpleName}}.
 */
public class ${endpointInterface.simpleName}Impl implements ${endpointInterface.simpleName} {

  private final ${endpointInterface.simpleName} proxy;

  /**
   * Construct a ${endpointInterface.simpleName} that points to the default endpoint ("${baseDeploymentAddress}${endpointInterface.metaData.soapPath?default("/soap/" + endpointInterface.serviceName)}").
   *
   * @param features The features to include (e.g. MTOM).
   */
  public ${endpointInterface.simpleName}Impl(javax.xml.ws.WebServiceFeature... features) {
    this("${baseDeploymentAddress}${endpointInterface.metaData.soapPath?default("/soap/" + endpointInterface.serviceName)}", features);
  }

  /**
   * Construct a ${endpointInterface.simpleName} that points to the endpoint at the specified host and port.
   *
[#if !(wsdlFileName??)]
   * @param wsdl The URL to the wsdl describing the interface for which this endpoint is a client.
[/#if]
   * @param host The host.
   * @param port The port.
   * @param features The features (e.g. MTOM).
   */
  public ${endpointInterface.simpleName}Impl([#if !(wsdlFileName??)]java.net.URL wsdl, [/#if]String host, int port, javax.xml.ws.WebServiceFeature... features) {
    this.proxy = javax.xml.ws.spi.Provider.provider().createServiceDelegate([#if wsdlFileName??]getClass().getResource("/${wsdlFileName}")[#else]wsdl[/#if], new javax.xml.namespace.QName("${endpointInterface.targetNamespace}", "${endpointInterface.serviceName}"), javax.xml.ws.Service.class).getPort(${endpointInterface.simpleName}.class, features);
    try {
      java.net.URL baseUrl = new java.net.URL("${baseDeploymentAddress}${endpointInterface.metaData.soapPath?default("/soap/" + endpointInterface.serviceName)}");
      _getBindingProvider().getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, new java.net.URL(baseUrl.getProtocol(), host, port, baseUrl.getFile()).toString());
    }
    catch (java.net.MalformedURLException e) {
      throw new IllegalStateException(e);
    }
  }

  /**
   * Construct a ${endpointInterface.simpleName} that points to the specified endpoint.
   *
[#if !(wsdlFileName??)]
   * @param wsdl The URL to the wsdl describing the interface for which this endpoint is a client.
[/#if]
   * @param endpoint The endpoint to point to.
   * @param features The features (e.g. MTOM).
   */
  public ${endpointInterface.simpleName}Impl([#if !(wsdlFileName??)]java.net.URL wsdl, [/#if]String endpoint, javax.xml.ws.WebServiceFeature... features) {
    this.proxy = javax.xml.ws.spi.Provider.provider().createServiceDelegate([#if wsdlFileName??]getClass().getResource("/${wsdlFileName}")[#else]wsdl[/#if], new javax.xml.namespace.QName("${endpointInterface.targetNamespace}", "${endpointInterface.serviceName}"), javax.xml.ws.Service.class).getPort(${endpointInterface.simpleName}.class, features);
    _getBindingProvider().getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
  }

  /**
   * Get the binding provider supporting this service.
   */
  public javax.xml.ws.BindingProvider _getBindingProvider() {
    return (javax.xml.ws.BindingProvider) this.proxy;
  }

  [@forEachWebMethod endpointInterface=endpointInterface considerFacets="true"]

  // Inherited.
  public ${classnameFor(webMethod.webResult)} ${webMethod.simpleName}([#list webMethod.webParameters as param]${classnameFor(param)} ${param.simpleName}[#if param_has_next], [/#if][/#list]) [#if webMethod.webFaults?size > 0]throws [#list webMethod.webFaults as fault]${classnameFor(fault)}[#if fault_has_next], [/#if][/#list][/#if] {
    [#if !webMethod.returnType.void]return [/#if]proxy.${webMethod.simpleName}([#list webMethod.webParameters as param]${param.simpleName}[#if param_has_next], [/#if][/#list]); 
  }
  [/@forEachWebMethod]
}
[/@file]




© 2015 - 2025 Weber Informatics LLC | Privacy Policy