简体   繁体   English

使用返回自定义类型的函数创建Web服务(JAX-WS)

[英]Creating webservice (JAX-WS) with functions which return custom types

I read many threads about this issue and i did find some that deal with it - but unfortunately I couldn't really understand how to solve my problem. 我阅读了许多有关此问题的主题,但确实找到了一些相关的主题-但不幸的是,我无法真正理解如何解决问题。

Right now i'm creating WebService (using Tomcat 7), and I want to share interfaces. 现在,我正在创建WebService(使用Tomcat 7),并且我想共享接口。 I have about 8 interfaces that relate to each other. 我有大约8个相互关联的接口。 for example: 例如:

@WebService
@SOAPBinding(style = Style.RPC)
interface A {
  public String method1();
}

@WebService
@SOAPBinding(style = Style.RPC)
interface B {
  public String method1();
  public A getA();
}

@WebService
@SOAPBinding(style = Style.RPC)
interface C {
  public A getA();
  public B getB();
}

The problem is that after i create the WAR (for interface C) file and i'm trying to deploy the webservice in tomcat, I get an error from tomcat which looks like that: 问题是,在我创建WAR(用于接口C)文件并尝试在tomcat中部署Web服务之后,我从tomcat收到了一个错误,看起来像这样:

SEVERE: WSSERVLET11: failed to parse runtime descriptor: com.sun.xml.ws.spi.db.DatabindingException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions com.mkyong.ws.ITest is an interface, and JAXB can't handle interfaces. 严重:WSSERVLET11:无法解析运行时描述符:com.sun.xml.ws.spi.db.DatabindingException:com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:1个IllegalAnnotationExceptions计数com.mkyong.ws.ITest是接口,而JAXB无法处理接口。 this problem is related to the following location: at com.mkyong.ws.ITest 此问题与以下位置有关:com.mkyong.ws.ITest

com.sun.xml.ws.spi.db.DatabindingException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions com.mkyong.ws.ITest is an interface, and JAXB can't handle interfaces. com.sun.xml.ws.spi.db.DatabindingException:com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:1个IllegalAnnotationExceptions计数com.mkyong.ws.ITest是一个接口,JAXB无法处理接口。 this problem is related to the following location: at com.mkyong.ws.ITest 此问题与以下位置有关:com.mkyong.ws.ITest

Does anyone have an idea how to solve it? 有人知道如何解决吗? Thanks. 谢谢。

You cannot return an interface type using JAX-WS. 您不能使用JAX-WS返回接口类型。 Return-types and parameters must be an actual class. 返回类型和参数必须是实际的类。 RMI would support interfaces for that. RMI将为此支持接口。 JAX-WS doesn't. JAX-WS没有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM