[英]Interfaces as return types with JAX-WS + JAXB
I think I'm just missing something simple here but here is what I am working from... 我想我只是在这里遗漏了一些简单的东西,但这就是我正在做的事情...
@WebService
public interface MyService {
public AnInterface doStuff();
}
Here is some of what I have tried. 这是我尝试过的一些方法。 All with CXF 2.5.2 + Spring on Weblogic 10.3.4... 在Weblogic 10.3.4上全部使用CXF 2.5.2 + Spring ...
AnInterfaceImpl
class. 在MyService接口和AnInterface上使用@XmlSeeAlso,将JAXB指向AnInterfaceImpl
类。 This still resulted in the infamous JAXB can't handle interfaces exception. 这仍然导致臭名昭著的JAXB无法处理接口异常。 I'm guessing there is some way to easily annotate that AnInterface
should be exposed via 我猜想有某种方法可以轻松地注释AnInterface
应该通过以下方式公开
AnInterfaceImpl
from the MyService
class pretty easily but I'm missing some crucial and simple step. MyService
类中的AnInterfaceImpl
非常容易,但是我缺少一些关键而简单的步骤。
The trick appears to be the use of @XmlJavaTypeAdapter
on the target interfaces as described here . 诀窍似乎是使用@XmlJavaTypeAdapter
所描述的目标接口在这里 。 It is not obvious to me why this works where other methods seem to fail. 对于我来说,这还不明显,为什么在其他方法似乎失败的情况下,这种方法仍然有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.