Richard Richter created CXF-5182:
------------------------------------

             Summary: Unused namespaces in WSDL accessed via ?wsdl (java first)
                 Key: CXF-5182
                 URL: https://issues.apache.org/jira/browse/CXF-5182
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.7.6
            Reporter: Richard Richter


When I build a simple service and run it with simple test main program, it 
generates WSDL that starts with:
{noformat}
<wsdl:definitions
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
        xmlns:tns="http://xxx/xxx";
        xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
        xmlns:ns1="http://schemas.xmlsoap.org/soap/http";
        name="XXX_SERVICE"
        targetNamespace="http://xxx/xxx";>
{noformat}

Here {{xmlns:xsd="http://www.w3.org/2001/XMLSchema"}} and 
{{xmlns:ns1="http://schemas.xmlsoap.org/soap/http"}} are reported as unused. 
Also even if used, there could be better namespace instead of ns1.

Classes:
{code}
package xxx;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.soap.MTOM;

@MTOM
@WebService(name = "MY_SERVICE", targetNamespace = "http://xxx/xxx";)
public interface XxxSEI {
        @ResponseWrapper(localName = "dataBack")
        @RequestWrapper(localName = "dataForth")
        @WebMethod(operationName = "sendData")
        int processReport(@WebParam(name = "data") String data);
}
{code}

Test main:
{code}
package xxx;

import javax.jws.WebParam;
import javax.xml.namespace.QName;
import javax.xml.ws.soap.SOAPBinding;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

public class XxxTestServer {
        public static final int PORT = 8080;

        public static void main(String[] args) {
                prepareServer("yyy", XxxSEI.class, new XxxImpl());
        }

        static void prepareServer(String urlContext, Class<?> serviceClass, 
Object implementor) {
                JaxWsServerFactoryBean svrFactory = new 
JaxWsServerFactoryBean();
                svrFactory.setServiceClass(serviceClass);
                svrFactory.setServiceName(new QName("http://xxx/xxx";, 
"XXX_SERVICE"));
                svrFactory.setAddress("http://localhost:"; + PORT + '/' + 
urlContext);
                svrFactory.setServiceBean(implementor);
                svrFactory.setBindingId(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
                svrFactory.getInInterceptors().add(new LoggingInInterceptor());
                svrFactory.getOutInterceptors().add(new 
LoggingOutInterceptor());
                svrFactory.create();
        }
}

class XxxImpl implements XxxSEI {
        @Override
        public int processReport(@WebParam(name = "data") String data) {
                return 47;
        }
}
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to