gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 11:05:49 26 4
gpt4 key购买 nike

我有一个使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com