我正在尝试使用 CXF 插件在 Grails 中实现 SOAP Web 服务。我的服务类很简单。
package com.ld.api
import com.ld.domain.*
import javax.jws.*
import grails.converters.XML
class CabinetService {
static transactional = true
static expose=['cxf']
String getCabinetList() {
String list = Cabinet.list()
//return list as XML
return "jim"
}
def serviceMethod() {
println "IN serviceMethod"
"Hello...."
}
}
我得到了这个 WSDL:
<wsdl:definitions name="CabinetService" targetNamespace="http://api.ld.com/"><wsdl:types><xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://api.ld.com/"><xsd:element name="serviceMethod" type="tns:serviceMethod"/><xsd:complexType name="serviceMethod"><xsd:sequence/></xsd:complexType><xsd:element name="serviceMethodResponse" type="tns:serviceMethodResponse"/><xsd:complexType name="serviceMethodResponse"><xsd:sequence><xsd:element minOccurs="0" name="return" type="xsd:anyType"/></xsd:sequence></xsd:complexType></xsd:schema></wsdl:types><wsdl:message name="serviceMethodResponse"><wsdl:part element="tns:serviceMethodResponse" name="parameters">
</wsdl:part></wsdl:message><wsdl:message name="serviceMethod"><wsdl:part element="tns:serviceMethod" name="parameters">
</wsdl:part></wsdl:message><wsdl:portType name="CabinetServicePortType"><wsdl:operation name="serviceMethod"><wsdl:input message="tns:serviceMethod" name="serviceMethod">
</wsdl:input><wsdl:output message="tns:serviceMethodResponse" name="serviceMethodResponse">
</wsdl:output></wsdl:operation></wsdl:portType><wsdl:binding name="CabinetServiceSoapBinding" type="tns:CabinetServicePortType"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="serviceMethod"><soap:operation soapAction="" style="document"/><wsdl:input name="serviceMethod"><soap:body use="literal"/></wsdl:input><wsdl:output name="serviceMethodResponse"><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="CabinetService"><wsdl:port binding="tns:CabinetServiceSoapBinding" name="CabinetServicePort"><soap:address location="http://localhost:8080/LucanDOCS2013/services/cabinet"/></wsdl:port></wsdl:service></wsdl:definitions>
自动生成的“serviceMethod”包含在 WSDL 中,但不包含 getCabinetList()。我尝试了各种注释组合,但没有运气。
我在 grails 2.0.3 和插件的 0.9.0 版本上。任何帮助将不胜感激。