我的cxf网络服务简化如下。我的问题是,如果我注入如下所示的服务,生成的wsdl也将具有setParameterService / getParameterService和getMessageSource / setMessageSource方法。如果我不想将它们作为webservices公开,我该怎么办?
@WebService(portName = "OrganizationPort", serviceName = "OrganizationService", name = "OrganizationService", targetNamespace = "http://akum.compugroup.com")
@SOAPBinding(parameterStyle = ParameterStyle.WRAPPED, use = Use.LITERAL, style = Style.DOCUMENT)
class OrganizationWebService {
def parameterService
def messageSource
static expose = EndpointType.JAX_WS
@WebMethod
@WebResult
Organization kurumSorgulama(@WebParam(partName = "KurumSorgulamaTalep", name = "KurumSorgulamaTalep", targetNamespace = "http://akum.compugroup.com") String kurumKodu) {
return organization
}
@WebMethod
@WebResult
Organization authorize(@WebParam(partName = "KurumSorgulamaTalep", name = "KurumSorgulamaTalep", targetNamespace = "http://akum.compugroup.com") String kurumKodu) {
return organization
}
}
答案 0 :(得分:1)
我简化了一些代码,但这应该让你运行起来。将服务端点设为私有,然后使用@AutoWired
注释它们@WebService(portName = "OrganizationPort", serviceName = "OrganizationService", name = "OrganizationService", targetNamespace = "http://akum.compugroup.com")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED, use = SOAPBinding.Use.LITERAL, style = SOAPBinding.Style.DOCUMENT)
class OrganizationService {
@Autowired
private BoatService boatService
@Autowired
private CarService carService
static expose = EndpointType.JAX_WS
@WebMethod
@WebResult
String goFish(@WebParam(partName = "KurumSorgulamaTalep", name = "KurumSorgulamaTalep", targetNamespace = "http://akum.compugroup.com") String kurumKodu) {
boatService.fish()
}
@WebMethod
@WebResult
String goHonk(@WebParam(partName = "KurumSorgulamaTalep", name = "KurumSorgulamaTalep", targetNamespace = "http://akum.compugroup.com") String kurumKodu) {
carService.honkHorn()
}
}
答案 1 :(得分:0)
我从来没有为Grails应用做过,但通常你可以使用@XmlTransient
。此外,您可能需要在班级使用@XmlAccessorType(XmlAccessType.FIELD)
。
答案 2 :(得分:0)
您可以替换:
@WebService(portName = "OrganizationPort", serviceName = "OrganizationService", name = "OrganizationService", targetNamespace = "http://akum.compugroup.com")
使用:
@GrailsCxfEndpoint
@ GrailsCxfEndpoint 会自动排除所有getter和setter。
但是,您将无法设置 portName , serviceName , name 和 targetNamespace 。这正是我目前遇到的问题。
将 @ GrailsCxfEndpoint 与 @WebService 混合也不是解决方案,因为它再次暴露了getter和setter。