java - Spring Web Service和Spring集成配置?

标签 java spring-integration spring-ws

我有一个使用 Spring 和 JAX-WS 的组合公开的 Web 服务。我设法将它转换为 POJO,并使用 Spring Integration 作为 Web 服务入站网关后面的服务激活器公开它,该网关设置为 UriEndpointMapping 的默认端点。由于还有其他遗留 Web 服务需要公开,我已将入站网关从默认端点更改为不同的映射。不幸的是,此更改使 spring-integration 服务无法访问。我试过通过 url 和端点指定来映射它,但没有效果。这是相关的 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;
}
}

最佳答案

看起来您的答案在 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.

这是针对您确实不需要使用带有主机/端口的完整 URL 的情况。

关于java - Spring Web Service和Spring集成配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29494605/

相关文章:

java - Spring-WS SecurityInterceptor操作级别

java - 是否可以对 InetAddress 类型的变量使用 toString

java - 如何修复除法以获得正确的输出?

java - 无法使用 spring-data JPA 获取多对多关联的关系,

c# - 相当于 C# Action.BeginInvoke 的 Java

json - Spring集成,如何使用@Transformer从/到JSON转换?

java - 从服务异常中检索 Spring Integration 中的消息

java - Spring 集成: retry configuration with multi-instances

wsdl - 来自 WSDL 的 Spring-ws 客户端

java - 访问 Web 服务::模式问题