0

我有一个简化如下的 cxf Web 服务。我的问题是,如果我像下面这样注入服务,生成的 wsdl 也会有 setParameterService/getParameterService 和 getMessageSource/setMessageSource 方法。如果我不想将它们公开为 Web 服务,我该怎么办?

@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
}

}

4

3 回答 3

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()
    }
}
于 2013-10-16T18:45:17.980 回答
0

我从来没有为 Grails 应用程序做过,但通常你可以使用@XmlTransient. 此外,您可能需要@XmlAccessorType(XmlAccessType.FIELD)在课堂级别使用。

于 2013-07-04T11:39:59.733 回答
0

你可以替换:

@WebService(portName = "OrganizationPort", serviceName = "OrganizationService", name = "OrganizationService", targetNamespace = "http://akum.compugroup.com")

和:

@GrailsCxfEndpoint

@GrailsCxfEndpoint自动排除所有 getter 和 setter。

但是,您将失去设置portNameserviceNamenametargetNamespace的能力。这正是我目前遇到的问题。

将@GrailsCxfEndpoint@WebService混合也不是解决方案,因为它再次暴露了getter 和setter。

于 2013-10-12T15:37:09.587 回答