標籤:分享 代理類 沒有 xsd 代理模式 sch namespace gen main
這個問題找了好多地方都沒有結果,自己暫且總結一下吧,也不算是解決問題的根本途徑,但是也不失為一種辦法。當時用了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小記