【webservice】Two classes have the same XML type name(轉)

引言java

須要調用另外一個系統的提供的webservice接口,可是調用以後老是報錯,用SoapUI測試接口卻沒有問題;
那就應該是代碼的問題了,可是一樣的代碼也調用過其餘系統卻沒有問題,不過最終仍是解決了,如今記錄一下;web

 

問題markdown

Exception in thread "main" com.sun.xml.internal.ws.spi.db.DatabindingException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://app.fms.com/}proxyFunction". Use @XmlType.name and @XmlType.namespace to assign different names to them.
    this problem is related to the following location:
        at datasource.rebuild.com.fms.app.ProxyFunction
        at public javax.xml.bind.JAXBElement datasource.rebuild.com.fms.app.ObjectFactory.createProxyFunction(datasource.rebuild.com.fms.app.ProxyFunction)
        at datasource.rebuild.com.fms.app.ObjectFactory
    this problem is related to the following location:
        at com.fms.app.ProxyFunction
Two classes have the same XML type name "{http://app.fms.com/}proxyFunctionResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them.
    this problem is related to the following location:
        at datasource.rebuild.com.fms.app.ProxyFunctionResponse
        at public javax.xml.bind.JAXBElement datasource.rebuild.com.fms.app.ObjectFactory.createProxyFunctionResponse(datasource.rebuild.com.fms.app.ProxyFunctionResponse)
        at datasource.rebuild.com.fms.app.ObjectFactory
    this problem is related to the following location:
        at com.fms.app.ProxyFunctionResponse

 

 

解決app

這裏寫圖片描述

找到報錯圖片裏面的那兩個類,在類上的註解加上namespace = "http://namespace.thats.not.the.same.as.the.generated",以下所示:測試

第一個類:
這裏寫圖片描述ui

第二個類:
這裏寫圖片描述this

 
 

 

轉自:https://blog.csdn.net/Francis123580/article/details/79485138spa

相關文章
相關標籤/搜索