1。配置XML文件,如果新建一個XML文件需要在applicationContext.xm里面配置一下
<import resource="cxf-client.xml" /> <import resource="cxf-hand.xml" /> <import resource="applicationContext-gxpc.xml" />
2。新建一個XML,xml文件模板如下:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" xmlns:cxf="http://cxf.apache.org/core" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd"> <!--驗證單點登錄令牌--> <jaxws:client id="ISSOService" address="http://172.16.7.107:9090/com.kutesmart.esb.ldap.sso?wsdl"
serviceClass="com.kutesmart.bl.soap.cxf.ldap.ISSOService"> </jaxws:client> </beans>
3。上面的xml文件中的 serviceClass ="com.kutesmart.bl.soap.cxf.ldap.ISSOService",需要在此目錄下新建的service類,這個類把wsdl2Java轉換出來的源文件接口文件ISSOService.java里面的內容需要的復制出來就好,其中
@XmlSeeAlso({ ObjectFactory.class })
刪除就好。
配置這些地方就可以了,然后在 其他類中new一個ISSOService對象傳入相應的參數就可以調用這個webservice接口了。
這是第一次適用調用web service接口,這只是一個簡單的方式,這是我自己弄出來得,肯定還有很多,看起來還是很簡單的, 但是對於新手來說,很多東西是不知道,百度都不知道百度什么,希望這篇能幫助到菜鳥們。我也是菜鳥