简体   繁体   English

提供wsdl时,CXF Webservice客户端会中断

[英]CXF Webservice client breaks when providing wsdl

I've created a webservice client using cxf-codegen maven plugin and then instantiate the service like this: 我使用cxf-codegen maven插件创建了一个webservice客户端,然后像这样实例化服务:

    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setEndpointName(SERVICE_NAME);
    factory.setAddress("some address");
    factory.setServiceClass(Service.class);
    this.port = (Service) factory.create();

It all works fine and I can call the webservice. 一切正常,我可以打电话给网络服务。 But I have a problem running this on Weblogic( XmlSchemaException: Top-level attributes may not have a 'use' ) and as a possible solution I'm trying to provide the WSDL file so that it's not regenerated. 但是我在Weblogic上运行它时遇到问题( XmlSchemaException:顶级属性可能没有'use' )并且作为一种可能的解决方案,我正在尝试提供WSDL文件,以便它不会重新生成。 But when I add the wsdl: 但是当我添加wsdl时:

factory.setWsdlLocation("service.wsdl");

I get this exception: 我得到这个例外:

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)

I cannot modify the wsdl and I'd like to know how is it possible, that the service construction fails if I provide the wsdl the service was generated from. 我无法修改wsdl,我想知道如果我提供服务生成的wsdl,服务构造失败是怎么可能的。

I use CXF 2.6.11 我使用CXF 2.6.11

您可能还需要一个factory.setServiceName(...)调用来匹配WSDL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WSDL解析异常,使用CXF JaxWSClientFactoryBean创建Webservice客户端 - WSDL parsing exception creating Webservice client with CXF JaxWSClientFactoryBean 如何使用CXF wsdl2java为在线WSDL URL链接生成WebService客户端 - How to generate WebService client with CXF wsdl2java for online WSDL URL link 从 WSDL 开发 Web 服务客户端时出现异常 - Exception when developing a Webservice Client from a WSDL 如何将@HandlerChain添加到wsdl / xml中,以便mvn / CXF在SOAP Webservice / Client中生成它? - How to add @HandlerChain to wsdl/xml so that mvn/CXF generates it in SOAP Webservice/Client? 如何避免需要在 CXF 或 JAX-WS 生成的 Web 服务客户端中指定 WSDL 位置? - How to avoid the need to specify the WSDL location in a CXF or JAX-WS generated webservice client? WebService客户端失败:Tomcat,CXF - WebService client fails: Tomcat, CXF WSDL使用SOAP 1.2时生成webservice客户端 - Generate webservice client when WSDL uses SOAP 1.2 生成Apache CXF客户端时,为什么在实例化客户端时仍然需要WSDL? - When generated an Apache CXF client, why is the WSDL still needed when instantiating the client? Webservice客户端找不到wsdl - Webservice client cannot find wsdl 从WSDL编写Web服务客户端 - Writing a Webservice Client from a WSDL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM