0

我想在 AXIS2 框架上编写的 web 服务中使用 spring web-scoped beans。如何配置它?Axis2 和 Spring 文档彼此不一致。

Axis2 文档说

For the purpose of this example, we'll configure Spring via a WAR file's web.xml. Let's add a context-param and a listener:
<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

Spring文档说

When using a Servlet 2.4+ web container, with requests processed outside of Spring's DispatcherServlet (e.g. when using JSF or Struts), you need to add the following javax.servlet.ServletRequestListener to the declarations in your web application's 'web.xml' file.
<web-app>
  ...
  <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener>
  ...
</web-app>

当我将 Axis2 推荐的 ContextLoaderListener 与 Spring web-scoped beans 一起使用时,我开始部署

java.lang.IllegalStateException:未找到线程绑定请求:您是指实际 Web 请求之外的请求属性,还是在原始接收线程之外处理请求?如果您实际上是在 Web 请求中操作并且仍然收到此消息,则您的代码可能在 DispatcherServlet/DispatcherPortlet 之外运行:在这种情况下,请使用 RequestContextListener 或 RequestContextFilter 来公开当前请求。

当我使用 Spring 推荐的 RequestContextListener 时,我运行 Web 服务时出现请求错误:

        <faultstring>The SERVICE_OBJECT_SUPPLIER parameter is not specified.</faultstring>

换句话说:如何使用 Spring 和 RequestContextListener 配置 AXIS2?

4

1 回答 1

0

AXIS2 中没有这样的功能。有关详细信息,请参阅请求https://issues.apache.org/jira/browse/AXIS2-5467 “扩展 Spring 支持以接受 Web 范围的 bean”。

于 2013-02-04T13:07:01.107 回答