2011-08-17 19 views
0

我對Web應用程序有以下配置。spring httpinvoker客戶端找不到服務地址

的web.xml

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value> 
     classpath:mail-application-context.xml 
.... 
    </context-param> 
.... 
<servlet> 
<servlet-name>mailbox</servlet-name> 
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 
<servlet-mapping> 
    <servlet-name>mailbox</servlet-name> 
     <url-pattern>*.htm</url-pattern> 
</servlet-mapping> 

郵箱servlet.xml中

<bean name="remoteProvisioningServiceImpl" class="pw.domain.service.RemoteProvisioningServiceImpl"/> 

<bean name="/remote/domain/provision.htm" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"> 
    <property name="service" ref="remoteProvisioningServiceImpl" /> 
    <property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" /> 
</bean> 

我已經正確配置的客戶端,如以下,在郵件應用程序的context.xml

<bean id="remoteProvisioningService1" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> 
    <property name="serviceUrl" value="http://${mailapp.dc.host.1.url}/remote/domain/provision.htm" /> 
    <property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" /> 
</bean> 

<bean id="remoteProvisioningService2" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> 
    <property name="serviceUrl" value="http://${mailapp.dc.host.2.url}/remote/domain/provision.htm" /> 
    <property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" /> 
</bean> 

現在...問題。 在適當的事件上,客戶通過httpinvoker工具正確地調用服務,但響應是http-404。在nginx日誌中,我跟蹤該彈簧對http:// {host} /remote/domain/provision.htm進行POST調用。

問題:

  1. 我是否需要創建httpInvoker位一個單獨的應用程序上下文?我的意思是,我已經有一個Web上下文來處理正常的Web操作。我需要在web.xml中爲httpInvoker工具聲明{another-context}並擁有服務配置。在{another-context} -servlet.xml中定義?

  2. 如果不是1,我的配置有什麼問題?

回答

1

明白了..上面的問題1有附加的答案。我需要爲HTTP調用工具創建一個單獨的Web上下文來工作。

這是因爲,在我正常的webapp上下文(郵箱)中,我已經定義了SimpleUrlHandlerMapping,它將適當的URL映射到控制器。在那裏找不到我想要定義的http-invoker-serivce的地方。當我分離網絡上下文時,它就像一個魅力! :D

快樂編碼! :)

相關問題