如果需要在web項(xiàng)目中新增或者添加webservice服務(wù)時(shí),小編的資料可以讓你知道如何操作,大家趕快下載來看看哦
在web項(xiàng)目中怎么添加webservice 客戶端
添加webservice客戶端,就和你寫個(gè)模塊是一樣的。只不過webservice是請求外部程序。
web項(xiàng)目不能理解為一種規(guī)范或類別。我們使用 服務(wù)對象,實(shí)現(xiàn)功能來將一類java項(xiàng)目定義為web項(xiàng)目,這樣說的意思就是 這兩者沒有可比較性。
遇到的問題:
報(bào)錯(cuò)一:java.lang.NoClassDefFoundError: org/springframework/beans/factory/support/ReaderContext原來在tomcat上運(yùn)行沒有問題的程序到項(xiàng)目所使用的jboss4.0.3上居然報(bào)錯(cuò)一堆:noclassfound?雌饋硎钦也坏絪pring的類,查了些資料,有人說xbean-spring.jar用2.8的就可以,結(jié)果到xbean網(wǎng)站上只見到最新的2.6沒有發(fā)現(xiàn)2.8,無奈,只好尋找別的方法。
在spring的cvs中查找了spring項(xiàng)目的早期代碼,都沒有發(fā)現(xiàn)這個(gè)類
為排除可能性,下載了別的版本的jboss單獨(dú)部署演示程序沒有問題,于是在項(xiàng)目的jboss上將項(xiàng)目undeploy,演示程序運(yùn)行成功(期間發(fā)現(xiàn)jboss啟動應(yīng)用是按照字母排序啟動的哈)
非常不解,為什么不同的war包還會互相影響
懷疑與spring版本有關(guān):
替換項(xiàng)目中的spring.jar為最新的2.5.5中的jar包,無效
替換項(xiàng)目中的spring.jar為xfire所使用的spring1.2.6.jar,無效
替換xfire中和項(xiàng)目中的的spring.jar為2.5.5中的jar包,無效
無意中,在xfire的最新發(fā)布包中發(fā)現(xiàn)有xbean-spring2.8.jar 替換后果然不再報(bào)這個(gè)錯(cuò)了,卻報(bào)別的錯(cuò):
報(bào)錯(cuò)二:java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name SomeServletName
最后看到這個(gè):
(http://wiki.metawerx.net/wiki/Java.lang.IllegalArgumentException)
your web.xml file has a <servlet-mapping> with no matching <servlet>. Each mapping must include a <servlet-name> that matches a <servlet-name> in a <servlet> element.
your web.xml file has a correctly matched servlet-mapping and servlet element, but the servlet-mapping appears before the servlet. The servlet-mapping must appear below the servlet, because the file is parsed in order.
在web.xml查看了一下,果然是后一種情況,調(diào)整順序后,不報(bào)這個(gè)錯(cuò)了,接著報(bào)下一個(gè)錯(cuò):
報(bào)錯(cuò)三:Unrecognized xbean element mapping: beans in namespace http://xfire.codehaus.org/config/1.0
還好一下子就找到一篇文章說這個(gè):http://www.blogjava.net/XXNiuLang/archive/2007/08/15/136952.html
不過遺憾的是,按照這個(gè)文章做,并沒有解決我的問題
但在另外一篇文章中看到(http://www.jumpingbean.co.za/blogs/mark/xfire_spring_bug):Basically XFire needs an earlier version of spring to work. I ended up using spring 1.2.8 but I assume any spring version before 2.0 would work.
將項(xiàng)目中的spring包替換為xfire發(fā)布包中的1.2.6,哈,成功!