我最近發現了一個使用groovy和jax-ws實現We3bService的例子: 問題在於@webmethod註釋似乎被忽略。Groovy&Jax-ws:忽略@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)
我知道這是很久以前的事,但你實際上解決了這個問題,我得到了同樣的錯誤,但不知道該怎麼辦呢? – ssayyed 2014-02-13 18:21:50