Spring Web Service和Spring集成配置?

时间:2015-04-07 14:53:22

标签: java spring-integration spring-ws

我有一个使用Spring和JAX-WS组合公开的Web服务。我已设法将其转换为POJO并使用Spring Integration作为服务激活器将其公开,该服务激活器位于Web服务入站网关后面,该网关被设置为UriEndpointMapping的默认端点。由于还需要公开其他遗留Web服务,因此我已将入站网关从默认端点更改为其他映射。不幸的是,这种变化使弹簧集成服务无法访问。我尝试通过网址和端点指定来映射,但没有效果。这是相关的xml和代码 - 我只是遗漏了什么?

<int-ws:inbound-gateway id="reconGateway" request-channel="recon-input" marshaller="marshaller" unmarshaller="marshaller"/>

<int:service-activator method="saveArrangementApplicationDetails" input-channel="recon-input">
    <bean id="arrangementApplicationReconService" class="package.ArrangementApplicationReconServiceImpl">
        <constructor-arg ref="reconServiceHelper"/>
    </bean>
</int:service-activator>

<bean class="org.springframework.ws.server.endpoint.mapping.UriEndpointMapping">
    <property name="mappings">
        <props>
            <prop key="http://localhost:8081/intfacade-web/reconService">reconGateway</prop>
        </props>
    </property>
</bean>

ArrangementApplicationReconServiceImpl.java

public class ArrangementApplicationReconServiceImpl {

public ArrangementApplicationReconResponse saveArrangementApplicationDetails(
        ArrangementApplicationReconRequest request)
        throws AOSFaultException {
    String traceId = request.getAosRequestHeader().getTraceId();
    LOGGER.info("548A456D3AED4CF6917B8E238750A0FD - processing recon request trace id: " + traceId + " synchronously");
    ArrangementApplicationReconResponse response = new ArrangementApplicationReconResponse();
    AOSResponseHeader aosHeader = new AOSResponseHeader();
    aosHeader.setTraceId(traceId);
    response.setAosResponseHeader(aosHeader);
    long result = 0L;
    if (null == request.getApplicationId()) {
        result = reconServiceHelper.saveArrangementApplicationDetails(request.getArrangementApplicationContainer(),
                request.getDecisionType());
    } else {
        result = reconServiceHelper.saveArrangementApplicationDetails(request.getArrangementApplicationContainer(),
                request.getDecisionType(), request.getApplicationId());
    }
    response.setApplicationId(result);
    return response;
}
}

1 个答案:

答案 0 :(得分:1)

看起来你的答案在UriEndpointMapping JavaDocs:

* Implementation of the {@code EndpointMapping} interface to map from the full request URI or request URI path to
* endpoint beans. Supports both mapping to bean instances and mapping to bean names: the latter is required for
* prototype handlers.

因此,您必须使用endpointMap属性,而不是mappings

进一步说:

* <p>When the {@link #setUsePath(boolean) usePath} property is enabled, the mapping will be based on the URI path rather
* than the full URI.

对于您真的不需要将该完整网址与主机/端口一起使用的情况。