简体   繁体   中英

Import a Web Service Client from a WSDL in Java

Im trying to use a web service.

My project is Java 6, using Jboss 4.3.2.GA. I've tryied to import the web service using the New-> Web Service Client in Eclipse. Like this tutorial http://www.craigsprogramming.com/2011/03/tutorial-consume-any-web-service-using.html

But when i try to get the Soap Client in this code:

WebServiceEscolaSoapStub service = (WebServiceEscolaSoapStub)new WebServiceEscolaLocator().getWebServiceEscolaSoap();

I get the following error.

org.apache.commons.discovery.DiscoveryException: Class org.apache.commons.logging.impl.SLF4JLogFactory does not implement org.apache.commons.logging.LogFactory
at org.apache.commons.discovery.tools.ClassUtils.verifyAncestory(ClassUtils.java:180)
at org.apache.commons.discovery.tools.SPInterface.verifyAncestory(SPInterface.java:201)
at org.apache.commons.discovery.tools.SPInterface.newInstance(SPInterface.java:195)
at org.apache.commons.discovery.tools.DiscoverClass.newInstance(DiscoverClass.java:579)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:418)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:378)
at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:41)
at org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java:33)
at org.apache.axis.handlers.BasicHandler.<clinit>(BasicHandler.java:43)
at org.apache.axis.client.Service.getAxisClient(Service.java:104)
at org.apache.axis.client.Service.<init>(Service.java:113)
at br.com.portalpitagorasdeeducacao.gestaodeusuarios.Service.WebServiceEscolaLocator.<init>(WebServiceEscolaLocator.java:12)...

The error is pretty clear.

You are mixing two jars slf4j and commons-logging. Get rid of commons-logging.jar file. On second thought remove all logging for now and just a run webservice client to see if you get an output. Later you can add the logging. This error has nothing to do with webservice error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM