1

我在 grails 中成功创建了 cxf wsdl web-services。现在我想配置 cxf 简单的前端端点。

我在 grails 项目的 resource.xml 文件中成功配置了 cxf 端点。

喜欢..

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:simple="http://cxf.apache.org/simple"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.xsd
http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <!--create CXF service-->
<simple:server serviceClass="com.j2.signup.FaxSignupService" address="/FaxSignupService">

</simple:server>
</beans>

但我希望在 resource.groovy DSL 文件中使用相同的 cxf 端点配置,而不是创建新的 resource.xml。

有人对此有想法吗?

4

1 回答 1

1

You can use importBeans in place of the <import> elements

importBeans('classpath:META-INF/cxf/cxf.xml')

and for the <simple:server> you can duplicate this directly in the DSL (see "using Spring namespaces" at the end of this section of the user guide)

xmlns simple:'http://cxf.apache.org/simple'
simple.server(serviceClass:"com.j2.signup.FaxSignupService",
              address:"/FaxSignupService")

If your FaxSignupService class itself needs dependencies injecting by Spring then you need to declare it as a top-level bean too

faxSignupService(com.j2.signup.FaxSignupService) { bean ->
  bean.autowire = "byName"
}
xmlns simple:'http://cxf.apache.org/simple'
simple.server(serviceClass:"com.j2.signup.FaxSignupService",
              serviceBean:"#faxSignupService",
              address:"/FaxSignupService")

(NB if FaxSignupService is a genuine Grails service under grails-app/services then it is already registered as a bean by default and the extra bean definition is not required, just adding the serviceBean:'#faxSignupService' to the simple.server is enough.)

于 2012-11-20T10:31:29.553 回答