1

cxf.xml ファイル内に cxf Web サービスを作成しました。次のタグがあります。bean id="videoStatsTable" クラス="com.company.auth.dataobjects.VideoStatsTable"

私が理解していることから、Spring は私のためにこのオブジェクトを作成する必要があります。問題は、アクセスする方法がわからないことです。servletContext が必要なようですが、WS のサーブレットにいないので、これを行う方法がわかりませんか?

W

4

1 に答える 1

2

Spring には、Web サービスを宣言する単純化された方法があります (cxf を使用)。

ルートタグに追加applicationContext.xmlする( ) とxmlns:jaxws="http://cxf.apache.org/jaxws"<beans>

http://cxf.apache.org/core
        http://cxf.apache.org/schemas/core.xsd
        http://cxf.apache.org/jaxws
        http://cxf.apache.org/schemas/jaxws.xsd

あなたにschemaLocation

それから加えて:

<!-- Loading CXF modules -->
<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" />

最後に、WebService 実装を宣言します。

<jaxws:endpoint id="MyWebService" implementor="#MyWebServiceImpl"
    address="/myWebServiceAddress" />

#MyWebServiceImplBean の ID はどこにありますか。他の Spring 依存関係をその Bean に自由に注入できます。

次に、Web サービスにアクセスできるようになりますhttp://yourhost/cxfuri/myWebServiceAddress(cxfuri は CXF サーブレットのマッピングです)。

于 2009-12-01T20:47:56.000 に答える