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

org.apache.cxf.tools.wsdlto.frontend.jaxws.template.service.vm Maven / Gradle / Ivy

There is a newer version: 3.0.0-milestone2
Show newest version
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. The ASF licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an
## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
## KIND, either express or implied. See the License for the
## specific language governing permissions and limitations
## under the License.
#if ($service.packageJavaDoc != "")
/*
$service.packageJavaDoc
 */
#end
package $service.PackageName;

import java.net.MalformedURLException;
import java.net.URL;
#if ($mark-generated == "true")
import javax.annotation.Generated;
#end
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
#foreach ($import in ${service.Imports}) 
import ${import};
#end

/**
#if ($service.classJavaDoc != "")
$service.classJavaDoc
 *
#end
 * This class was generated by $fullversion
 * $currentdate
 * Generated source version: $version
 * 
 */
@WebServiceClient(name = "${service.ServiceName}", 
#if ($wsdlLocation != "")
                  wsdlLocation = "$wsdlLocation",
#end
                  targetNamespace = "$service.Namespace") 
#foreach ($annotation in $service.Annotations)
$annotation
#end
#if ($mark-generated == "true")
@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate", comments = "$fullversion")
#end
public class ${service.Name} extends ${serviceSuperclass} {

#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public final static URL WSDL_LOCATION;

#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public final static QName SERVICE = new QName("$service.Namespace", "$service.ServiceName");
#foreach ($port in ${service.Ports})
#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public final static QName $port.Name = new QName("$service.Namespace", "$port.PortName");
#end
    static {
#if ($wsdlLocation == "")
        WSDL_LOCATION = null;
#elseif ($wsdlLocation == "null")       
        WSDL_LOCATION = null;
#elseif ($wsdlLocation.startsWith("classpath:"))
        URL url = ${service.Name}.class.getClassLoader().getResource("$wsdlLocation.substring(10)");
#if ($wsdlLocation.startsWith("classpath:/"))
        if (url == null) {
            url = ${service.Name}.class.getClassLoader().getResource("$wsdlLocation.substring(11)");
        }
#end     
        if (url == null) {
            java.util.logging.Logger.getLogger(${service.Name}.class.getName())
                .log(java.util.logging.Level.INFO, 
                     "Can not initialize the default wsdl from {0}", "$wsdlLocation");
        }       
        WSDL_LOCATION = url;   
#elseif ($useGetResource)
        URL url = ${service.Name}.class.getResource("$wsdlLocation");
        if (url == null) {
            java.util.logging.Logger.getLogger(${service.Name}.class.getName())
                .log(java.util.logging.Level.INFO, 
                     "Can not initialize the default wsdl from {0}", "$wsdlLocation");
        }       
        WSDL_LOCATION = url;
#else
        URL url = null;
        try {
            url = new URL("$wsdlLocation");
        } catch (MalformedURLException e) {
            java.util.logging.Logger.getLogger(${service.Name}.class.getName())
                .log(java.util.logging.Level.INFO, 
                     "Can not initialize the default wsdl from {0}", "$wsdlLocation");
        }
        WSDL_LOCATION = url;
#end
    }

#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public ${service.Name}(URL wsdlLocation) {
        super(wsdlLocation, SERVICE);
    }

#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public ${service.Name}(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public ${service.Name}() {
        super(WSDL_LOCATION, SERVICE);
    }
    
#if ($jaxws22)
    //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
    //compliant code instead.
#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public ${service.Name}(WebServiceFeature ... features) {
        super(WSDL_LOCATION, SERVICE, features);
    }

    //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
    //compliant code instead.
#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public ${service.Name}(URL wsdlLocation, WebServiceFeature ... features) {
        super(wsdlLocation, SERVICE, features);
    }

    //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
    //compliant code instead.
#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public ${service.Name}(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
        super(wsdlLocation, serviceName, features);
    }
#end

#foreach ($port in $service.Ports)
#set($portClassName = ${port.InterfaceClass})
#if ($portClassName == ${service.Name}) 
#set($portClassName = ${port.fullClassName})
#end
    /**
#if ($port.javaDoc != "")
$port.javaDoc
#end
     *
     * @return
     *     returns ${port.InterfaceClass}
     */
    @WebEndpoint(name = "${port.PortName}")
#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public ${portClassName} get${port.Name}() {
        return super.getPort($port.Name, ${portClassName}.class);
    }

    /**
#if ($port.javaDoc != "")
$port.javaDoc
#end
     * 
     * @param features
     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the features parameter will have their default values.
     * @return
     *     returns ${port.InterfaceClass}
     */
    @WebEndpoint(name = "${port.PortName}")
#if ($mark-generated == "true")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
#end
    public ${portClassName} get${port.Name}(WebServiceFeature... features) {
        return super.getPort($port.Name, ${portClassName}.class, features);
    }
#end

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy