0

我需要从部署在apache felix容器中的包中调用外部 Web服务(我不能使用 ServiceMix、fuse...)我添加了包cxf-dosgi(可以从这里下载)并将以下几行放入我的 pom.xml:

                    <Require-Bundle>cxf-dosgi-ri-singlebundle-distribution</Require-Bundle>
                     <Import-Package>
                        javax.jws,
                        javax.xml.bind,
                        javax.xml.bind.annotation,
                        javax.xml.namespace,
                        javax.xml.ws,
                        META-INF.cxf,
                        org.apache.cxf,
                        org.apache.cxf.binding,
                        org.apache.cxf.binding.soap,
                        org.apache.cxf.binding.soap.spring,
                        org.apache.cxf.bus,
                        org.apache.cxf.bus.resource,
                        org.apache.cxf.bus.spring,
                        org.apache.cxf.buslifecycle,
                        org.apache.cxf.catalog,
                        org.apache.cxf.configuration,
                        org.apache.cxf.configuration.spring,
                        org.apache.cxf.endpoint,
                        org.apache.cxf.headers,
                        org.apache.cxf.management,
                        org.apache.cxf.phase,
                        org.apache.cxf.resource,
                        org.apache.cxf.transport,
                        org.apache.cxf.transport.http,
                        org.apache.cxf.transport.http.policy,
                        org.apache.cxf.transport.http_jetty,
                        org.apache.cxf.transports.http,
                        org.apache.cxf.workqueue,
                        org.apache.cxf.ws.policy.builder.jaxb,
                        org.apache.cxf.wsdl,
                        org.apache.cxf.wsdl11,
                        org.apache.cxf.jaxws.*,
                        *
                    </Import-Package>

我使用jaxws方式建立通信:

QName SERVICE_NAME = new QName("http://test.com/", "MockImplService");
Service service = Service.create(new URL(endpointAddress + "?wsdl"), SERVICE_NAME);         
mockService= service.getPort(IMock.class);                                                

当我运行示例时,出现以下异常:

 Caused by: javax.xml.ws.spi.FactoryFinder$ConfigurationError: Provider org.apache.axis2.jaxws.spi.Provider not found
        at javax.xml.ws.spi.FactoryFinder$2.run(FactoryFinder.java:138)
        at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java:282)
        at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:125)
        at javax.xml.ws.spi.FactoryFinder.access$200(FactoryFinder.java:42)
        at javax.xml.ws.spi.FactoryFinder$3.run(FactoryFinder.java:273)
        at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java:282)
        at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:168)
        at javax.xml.ws.spi.Provider.provider(Provider.java:39)
        at javax.xml.ws.Service.<init>(Service.java:36)
        at javax.xml.ws.Service.create(Service.java:116)

有什么想法吗?

4

2 回答 2

0

Apache DOSGi 旨在将服务公开为 Web 服务,而不是用于调用其他 Web 服务。不过,它可能包含一些 api 来调用其他 web 服务。

于 2013-02-20T18:41:10.220 回答
0

不知何故,使用了轴 jaxws 实现。您的类路径中可能有一个axis2-jaxws-xxx.jar。尝试删除它。将改为使用 JRA jaxws(这对于轴来说应该很好,对于 cxf 应该更好)。

于 2016-02-16T08:59:46.580 回答