【发布时间】:2014-01-17 01:50:59
【问题描述】:
我使用 cxf-codegen maven 插件创建了一个 web 服务客户端,然后像这样实例化该服务:
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setEndpointName(SERVICE_NAME);
factory.setAddress("some address");
factory.setServiceClass(Service.class);
this.port = (Service) factory.create();
一切正常,我可以调用网络服务。但是我在 Weblogic(XmlSchemaException: Top-level attributes may not have a 'use') 上运行它时遇到问题,作为一种可能的解决方案,我正在尝试提供 WSDL 文件以便它不会重新生成。 但是当我添加 wsdl 时:
factory.setWsdlLocation("service.wsdl");
我得到了这个例外:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for port {namespace}Service.
at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:179)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:428)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:548)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:214)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:155)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:156)
我无法修改 wsdl,我想知道,如果我提供生成服务的 wsdl,服务构造会失败。
我使用 CXF 2.6.11
【问题讨论】:
标签: java web-services wsdl weblogic cxf