【发布时间】:2009-11-20 16:03:34
【问题描述】:
我最近发现了一个使用 groovy 和 jax-ws 实现 We3bService 的示例: 问题是@webmethod 注释似乎被忽略了。
这是groovy脚本的源代码:
import javax.jws.soap.*
import javax.jws.*
import javax.xml.ws.*
import javax.xml.bind.annotation.*
@XmlAccessorType(XmlAccessType.FIELD)
class Book {
String name
String author
}
@WebService (targetNamespace="http://predic8.com/groovy-jax/")
@SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
class BookService{
@WebMethod
def add(Book book){
println "Name of the book: ${book.name}"
}
}
Endpoint.publish("http://localhost:9000/book", new BookService())
这是捕获的异常: 捕获:com.sun.xml.internal.ws.model.RuntimeModelerException: 运行时建模器错误:SEI BookService 的方法 setProperty 注释为 BARE,但它有多个绑定到正文的参数。这是无效的。请使用注释对方法进行注释:@SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.WRAPPED) 在 wstest.run(wstest.groovy:21)
【问题讨论】:
-
我知道这是很久以前的事了,但你真的解决了这个问题吗,我遇到了同样的错误,但不知道该怎么办?
标签: groovy jax-ws web-services