如何解決xfire調(diào)用cxf的webrvice問(wèn)題
1、cfx調(diào)用webrvice時(shí)需要加載
cxf-2.2.10.jar
jetty-6.1.21.jar
jetty-util-6.1.21.jar
rvlet-2_5-api.jar
wsdl4j-1.6.2.jar
XmlSchema-1.4.5.jar
這些包。
服務(wù)端代碼代碼如下:
Server impl=new Server();
JaxWsServerFactoryBean factoryBean=new JaxWsServerFactoryBean();
factoryBean.tAddress("http://ip地址/hello");
factoryBean.tServiceClass(HelloWorldServiceInf.class);
factoryBean.tServiceBean(impl);
factoryBean.getInInterceptors().add(new LoggingInInterceptor());
factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());
factoryBean.create();
客戶端代碼
JaxWsProxyFactoryBean factoryBean=new JaxWsProxyFactoryBean();
factoryBean.getInInterceptors().add(new LoggingInInterceptor());
factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());
factoryBean.tServiceClass(HelloWorldServiceInf.class);
factoryBean.tAddress("http://***/hello");
HelloWorldServiceInf impl=(HelloWorldServiceInf) factoryBean.create();
System.out.println(impl.sayHello("hello"));
怎么使用xfire 調(diào)用.net做的webrvice
1、引入xfire依賴的jar包;
2、獲取服務(wù)端的wsdl,通過(guò)wsdl2java生成客戶端代碼;(以什么形式放入工程不限,建議打成jar包)
3、在web服務(wù)中創(chuàng)建客戶端調(diào)用遠(yuǎn)端服務(wù)
xfire生成webrvice客戶端參數(shù)設(shè)置問(wèn)題。
CXF+Spring 配參考
<jaxws:rver id="toolService"
rviceClass="com.toolServer.rvice.ToolService"
address="toolService">
<jaxws:rver id="urService"
rviceClass="com.toolServer.rvice.UrService"
address="/urService">
Xfire Webrvice 參數(shù)類型不能有int或者Integer嗎
如果你用axis2那返回值只支持一種類型,xfire好用一些,也廣泛了一些,但是建議你webrvice最好不要用復(fù)雜類型,都拼裝成簡(jiǎn)單類型或者List就好。因?yàn)樽远x類型在webrvice中有可能引起未知的錯(cuò)誤。到時(shí)候就不好調(diào)試了。