[ 
https://issues.apache.org/jira/browse/CXF-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663476#action_12663476
 ] 

Jon Miller commented on CXF-1979:
---------------------------------

This is what JAX-WS RI generates for the Service_Service class:

It looks like it mostly fully qualifies things, although it does have some 
imports.

package edu.uchicago.at.transforms;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;


/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.1.4-b01-
 * Generated source version: 2.1
 * 
 */
@WebServiceClient(name = "Service", targetNamespace = 
"http://transforms.at.uchicago.edu/";, wsdlLocation = 
"http://localhost:8084/TransformsWebApplication/Service?wsdl";)
public class Service_Service
    extends javax.xml.ws.Service
{

    private final static URL SERVICE_WSDL_LOCATION;
    private final static Logger logger = 
Logger.getLogger(edu.uchicago.at.transforms.Service_Service.class.getName());

    static {
        URL url = null;
        try {
            URL baseUrl;
            baseUrl = 
edu.uchicago.at.transforms.Service_Service.class.getResource(".");
            url = new URL(baseUrl, 
"http://localhost:8084/TransformsWebApplication/Service?wsdl";);
        } catch (MalformedURLException e) {
            logger.warning("Failed to create URL for the wsdl Location: 
'http://localhost:8084/TransformsWebApplication/Service?wsdl', retrying as a 
local file");
            logger.warning(e.getMessage());
        }
        SERVICE_WSDL_LOCATION = url;
    }

    public Service_Service(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    public Service_Service() {
        super(SERVICE_WSDL_LOCATION, new 
QName("http://transforms.at.uchicago.edu/";, "Service"));
    }

    /**
     * 
     * @return
     *     returns Service
     */
    @WebEndpoint(name = "ServicePort")
    public edu.uchicago.at.transforms.Service getServicePort() {
        return super.getPort(new QName("http://transforms.at.uchicago.edu/";, 
"ServicePort"), Service.class);
    }

    /**
     * 
     * @param features
     *     A list of {...@link javax.xml.ws.WebServiceFeature} to configure on 
the proxy.  Supported features not in the <code>features</code> parameter will 
have their default values.
     * @return
     *     returns Service
     */
    @WebEndpoint(name = "ServicePort")
    public edu.uchicago.at.transforms.Service 
getServicePort(WebServiceFeature... features) {
        return super.getPort(new QName("http://transforms.at.uchicago.edu/";, 
"ServicePort"), Service.class, features);
    }

}


> wsdl2java fails to generate working client code if web service name or 
> serviceName is "Service"
> -----------------------------------------------------------------------------------------------
>
>                 Key: CXF-1979
>                 URL: https://issues.apache.org/jira/browse/CXF-1979
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.1.3
>         Environment: Windows XP, JDK 1.6.0_11, JAX-WS RI for the web service, 
> and CXF for the client
>            Reporter: Jon Miller
>            Priority: Minor
>
> If you create a web service and set the name or serviceName to "Service" like 
> the following, 
> @WebService(name = "Service", serviceName = "Service")
> public class Service {
> ...
> }
> and you use wsdl2java to generate client code for the web service. The 
> generated code won't compile. This is because javax.xml.ws.Service is 
> imported in some of the files and it gets confused between this and the 
> generated classes. It would be better if the generated code fully qualified 
> the class names rather than importing them. Or, if knew to look for conflicts 
> and renamed the classes to something else. i.e. maybe just call it Service2 
> instead.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to