CXF是否可以将wsdls和xsd发布为原始的独立文件,而不是一个大文件?

CXF是否可以将wsdls和xsd发布为原始的独立文件,而不是一个大文件?,cxf,soapui,Cxf,Soapui,我已经使用WSDL和几个XSD文件(自顶向下的方法)生成了一个CXF Web服务 但是当我打开一个指向我的cxfwebservice的浏览器时,它返回一个大的WSDL文件(原始XSD对象都包含在这个文件中) 是否可以配置CXF,将原始WSDL和XSD文件发布到单独的文件中(使用),而不是一个大文件 对于大文件,我在SoapUI“验证”中遇到以下错误: 期望元素'someElement@someNamespace“而不是”someElement@someOtherNamespace“在元素中 看起

我已经使用WSDL和几个XSD文件(自顶向下的方法)生成了一个CXF Web服务

但是当我打开一个指向我的cxfwebservice的浏览器时,它返回一个大的WSDL文件(原始XSD对象都包含在这个文件中)

是否可以配置CXF,将原始WSDL和XSD文件发布到单独的文件中(使用
),而不是一个大文件

对于大文件,我在SoapUI“验证”中遇到以下错误: 期望元素'someElement@someNamespace“而不是”someElement@someOtherNamespace“在元素中

看起来名称空间在某种程度上是混合的(无论是在CXF生成的WDSL中,还是在SoapUI的“验证”函数中)


但是问题只存在于CXF返回的WSDL(url以“?WSDL”结尾),因为如果我从硬盘将原始WSDL和XSD导入到SoapUI中,问题就不存在了。

如果调用
org.apache.CXF.jaxws.EndpointImpl.setWsdlLocation
通过类路径上的WSDL路径,服务将发布导入XML模式文件的WSDL

例如,使用Spring注释:

@Configuration
public class ExampleWebServiceConfiguration {

    private static final String BASE_URL = "/*";
    private static final String SERVICE_NAME_LOCAL_PART = "ExampleService";
    private static final String SERVICE_NAME_NAMESPACE_URI = "http://www.example.org/webservices/1.0/ExampleService";

    protected ExampleServicePortType ExampleServicePortType;

    @Value("${ws.endpoint.address}")
    String wsEndpointAddress;

    @Autowired
    public ExampleWebServiceConfiguration(ExampleServicePortType ExampleServicePortType) {
        this.ExampleServicePortType = ExampleServicePortType;
    }

    @Bean
    public ServletRegistrationBean cxfServlet() {
        return new ServletRegistrationBean(new CXFServlet(), BASE_URL);
    }

    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }

    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), ExampleServicePortType);
        endpoint.setServiceName(new QName(SERVICE_NAME_NAMESPACE_URI, SERVICE_NAME_LOCAL_PART));
        endpoint.setWsdlLocation("/wsdl/exampleservices/ExampleService.wsdl");
        endpoint.publish(wsEndpointAddress);
        return endpoint;
    }
}

如果调用
org.apache.cxf.jaxws.EndpointImpl.setWsdlLocation
通过类路径上的WSDL路径,服务将发布导入XML模式文件的WSDL

例如,使用Spring注释:

@Configuration
public class ExampleWebServiceConfiguration {

    private static final String BASE_URL = "/*";
    private static final String SERVICE_NAME_LOCAL_PART = "ExampleService";
    private static final String SERVICE_NAME_NAMESPACE_URI = "http://www.example.org/webservices/1.0/ExampleService";

    protected ExampleServicePortType ExampleServicePortType;

    @Value("${ws.endpoint.address}")
    String wsEndpointAddress;

    @Autowired
    public ExampleWebServiceConfiguration(ExampleServicePortType ExampleServicePortType) {
        this.ExampleServicePortType = ExampleServicePortType;
    }

    @Bean
    public ServletRegistrationBean cxfServlet() {
        return new ServletRegistrationBean(new CXFServlet(), BASE_URL);
    }

    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }

    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), ExampleServicePortType);
        endpoint.setServiceName(new QName(SERVICE_NAME_NAMESPACE_URI, SERVICE_NAME_LOCAL_PART));
        endpoint.setWsdlLocation("/wsdl/exampleservices/ExampleService.wsdl");
        endpoint.publish(wsEndpointAddress);
        return endpoint;
    }
}