簡體   English   中英

提供wsdl時,CXF Webservice客戶端會中斷

[英]CXF Webservice client breaks when providing wsdl

我使用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();

一切正常,我可以打電話給網絡服務。 但是我在Weblogic上運行它時遇到問題( XmlSchemaException:頂級屬性可能沒有'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

您可能還需要一個factory.setServiceName(...)調用來匹配WSDL。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM