joh*_*ohn 2 wsdl web-services cxf jaxb
我有以下问题,无法找到解决方案:
WSDL elementFormDefault="qualified"在我的CXF客户端收到的响应中,所有元素都以命名空间为前缀但JAXB抛出异常
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"unm:ENTSCWS", local:"searchReturn"). Expected elements are
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:661)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:533)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:128) ...
如果我更改了WSDL elementFormDefault="unqualified"它正在工作,但我不允许更改WSDL,它应该具有前缀为命名空间的元素.
package-info.java包含annotaction:
@javax.xml.bind.annotation.XmlSchema(namespace = "unm:ENTSCWS", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package entscws;
Run Code Online (Sandbox Code Playgroud)
响应类包含注释:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"searchReturn"
})
@XmlRootElement(name = "searchResponse")
public class SearchResponse {
Run Code Online (Sandbox Code Playgroud)
你知道为什么我会收到这个错误吗?
你在OSGi上运行吗?我已经看到一些类似的问题,包裹信息没有在那里正确拾取.
另一种选择可能是在增加-xjc-NPA标志中的WSDL2Java命令必须在所有它不使用包的信息,并坚持该命名空间中的所有其他地方.
| 归档时间: |
|
| 查看次数: |
9965 次 |
| 最近记录: |