2009-12-01 3 views
1

내 cxf.xml 파일 내에 cxf webservice를 만들었습니다. 다음 태그가 있습니다. bean id = "videoStatsTable"class = "com.company.auth.dataobjects.VideoStatsTable"webservice에서 스프링 빈에 액세스하는 중입니까?

나는 Spring이이 객체를 생성해야한다는 것을 알고 있습니다. 문제는 액세스 권한을 얻지 못하는 것입니다. 마치 servletContext가 필요한 것처럼 보이지만 WS에서 서블릿에 없는데 어떻게해야할지 모르겠다.

W

답변

2

봄 웹 서비스를 (사랑의 CXF를) 선언의 simplifed 방법이있다.

<!-- 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를 구현을 선언한다 : 당신의 applicationContext.xml 추가 그런 다음 schemaLocation

에 루트 태그 (<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 

xmlns:jaxws="http://cxf.apache.org/jaxws" 추가에

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

여기에서 #MyWebServiceImpl은 사용자 bean의 ID입니다. 다른 빈 의존성을 빈에 자유롭게 삽입 할 수 있습니다.

그러면 웹 서비스는 http://yourhost/cxfuri/myWebServiceAddress (여기서 cxfuri는 CXF 서블릿의 매핑 임)

을 통해 액세스 할 수 있습니다.
관련 문제