如何使用Web服务起诉Apache CXF客户端API。我已经使用eclispe生成了客户端代码,但我没有发现任何文档指定如何在我的web应用程序中使用生成的代码。
如何配置CXF?我正在使用tomcat来运行我的java web应用程序。如何使用生成的代码?我需要在我的web.xml中添加任何内容吗?
我已经从apacheCXF网站下载了CXF二进制文件,但不知道需要哪些库。我担心最后可能会把所有的罐子都加进去。
我的应用程序使用Tomcat7、Java1.6和平面jsp/Servlet
我是网络服务的新手。提前感谢
一个可能有所帮助的示例代码。
URL wsdlurl=SOAPWebServiceTransport.class.getClassLoader().
getResource("my.wsdl");
// MyService will be one of the service class that you have generated (with different name ofcourse)and which must be extending Service class
//getOnlineServicePort will be a method (with different name ofcourse) in your service class which will give you the interface referrer using which you'll call the webservice method
OnlinePort service= new MyService(wsdlurl).getOnlineServicePort();
Client proxy = ClientProxy.getClient(service);
//configure security user name password as required
//Add interceptors if needed
//Now you can directly call the webservice methods using the service object
service.method(parameter)
你也可以参考一些例子,这里是