1

grailsでcxfwsdlWebサービスが正常に作成されました。次に、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.xmlを作成する代わりに、resource.groovyDSLファイルで同じcxfエンドポイント構成が必要です。

誰かがこれについて考えていますか?

4

1 に答える 1

1

要素importBeansの代わりに使用できます<import>

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

また、<simple:server>これをDSLで直接複製することもできます(ユーザーガイドのこのセクションの最後にある「Spring名前空間の使用」を参照してください) 。

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

FaxSignupServiceクラス自体にSpringによる依存関係の注入が必要な場合は、クラスをトップレベルのBeanとして宣言する必要もあります。

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")

(NBFaxSignupServiceが本物のGrailsサービスであるgrails-app/services場合、デフォルトですでにBeanとして登録されており、追加のBean定義は必要ありません。にを追加するだけserviceBean:'#faxSignupService'simple.server十分です。)

于 2012-11-20T10:31:29.553 に答える