1. 程式人生 > >WebService小記

WebService小記

命名空間 cnblogs fin 一個 解決 nts this 實現接口 fine

這個問題找了好多地方都沒有結果,自己暫且總結一下吧,也不算是解決問題的根本途徑,但是也不失為一種辦法。當時用了wsimport wsdl2java xfire 都沒有解決,大牛能解決的話,歡迎留言。

項目調用第三方接口,通過weibservice調用,但是這個東西,是人家用php搞出來的,裏面有一個<xsd:element name="FACTURA" type="xsd:array"/>這個標簽,在命名空間不支持,ecipse提示如下(

src-resolve.4.2: Error resolving component ‘xsd:array‘. It was detected that ‘xsd:array‘ is in namespace ‘http://www.w3.org/2001/XMLSchema‘, but components from
this namespace are not referenceable from schema document ‘file:///D:/workspace2/mpeso/src/main/resources/mpeso_ap.wsdl‘. If this is the incorrect namespace,
perhaps the prefix of ‘xsd:array‘ needs to be changed. If this is the correct namespace, then an appropriate ‘import‘ tag should be added to ‘file:///D:/workspace2/
mpeso/src/main/resources/mpeso_ap.wsdl‘.

導致生成客戶端代碼的時候總是報錯,

IWAB0399E Error in generating Java from WSDL: java.io.IOException: Type {http://www.w3.org/2001/XMLSchema}array is referenced but not defined.
java.io.IOException: Type {http://www.w3.org/2001/XMLSchema}array is referenced but not defined.
at org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined

技術分享

我的解決辦法就是,把這個type註釋掉,然後順藤摸瓜,註釋掉相應的參數和接口,說白了就是我不用這個接口,(因為我的項目用不到這個接口)

這樣沒問題了,但是生成java代碼的時候,代理類實現的接口包名是錯誤的,試了試,自己手動改了就好了,在代理類內實現接口的相應方法就Ok了,(代理模式而已)。

WebService小記