[問題] 請問Web Service的問題?

看板java作者 (世事難料)時間10年前 (2014/01/09 09:57), 編輯推噓3(307)
留言10則, 8人參與, 最新討論串1/1
最近需要使用到Web Service,結果搞了好多天都沒有搞定。 先自學一下,建立和使用... 網路上找了很多資料來看,最基本的利用tomcat建立Web Service 並用wsimport -keep 建立可以使用的java檔 這些都沒問題 (另外還有看到一種要下載很多.jar檔的方法,看起來太複雜。我就沒有深入研究了) 但接收到的URL在接上WSDL描述檔的格式看起來頗複雜 直接wsimport會出現 [ERROR] Property "Any" is already defined. Use &lt;jaxb:property> to resolve this conflict. 是因為描述檔裡的結構是長這樣的... <wsdl:definitions .....> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="" rel="nofollow">http://tempuri.org/"> <s:element name="getResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="getsResult"> <s:complexType> <s:sequence> <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/> <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/> </s:sequence> </s:complexType> </s:element> </s:sequence> </s:complexType> </s:element> </s:schema> <wsdl:types> </wsdl:definitions> 有兩個s:any ...從網路上爬文是寫說須要寫binding檔,但問題是我寫了這個binding檔 <jxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.1"> <jxb:bindings schemaLocation="s:schema"> <jxb:bindings node="//s:element[@name='getResponse']/s:complexType/s:sequence/ s:element[@name='getResult']/s:complexType/s:sequence/ s:any[@namespace='urn:schemas-microsoft-com:xml-diffgram-v1']"> <jxb:property name="any2" /> </jxb:bindings> </jxb:bindings> </jxb:bindings> 結果出現 "s:schema" is not a part of this compilation. 請問這個問題是...出在哪? 請各位高手指點一二 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.67.28

01/09 11:17, , 1F
可以用用看Axis2
01/09 11:17, 1F

01/09 12:52, , 2F
java VS .net 齁~ 請愛用 JAXB的XJC
01/09 12:52, 2F

01/09 13:46, , 3F
WebService WSDL,這兩者是等價關係嗎?
01/09 13:46, 3F

01/09 15:12, , 4F
雖然貓比較可愛,但是玻璃魚不好嗎QQ?
01/09 15:12, 4F

01/09 15:51, , 5F
我不喜歡公貓...
01/09 15:51, 5F

01/09 15:58, , 6F
試過用netbean(glassfish?)建立client 但遇到一樣的問題
01/09 15:58, 6F

01/10 11:10, , 7F
不要檢查xml的格式?
01/10 11:10, 7F

01/10 16:27, , 8F
請問[URL]?wsdl所產生的描述檔可以copy下來用wsimport
01/10 16:27, 8F

01/10 16:29, , 9F
-b binding.xml 下載.wsdl 產生對應java package嗎?
01/10 16:29, 9F

01/11 17:09, , 10F
用eclipse的create web service(axis2) 最快
01/11 17:09, 10F
文章代碼(AID): #1IpW8Xs3 (java)