2

I have a web service that was exposed using a combination of Spring and JAX-WS. I've managed to convert it to a POJO and expose it using Spring Integration as a service activator behind a web service inbound gateway that is set as a default endpoint for UriEndpointMapping. Since there are other legacy web services that need to be exposed, I've changed the inbound gateway from the default endpoint to a different mapping. Unfortunately, this change makes the spring-integration service unreachable. I've tried mapping it by url and by endpoint designation, to no effect. Here is the relevant xml and code - am I just missing something?

<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;
}
}
Darshan Patel
  • 2,839
  • 2
  • 25
  • 38
Alex
  • 133
  • 1
  • 12

1 Answers1

1

Looks like the answer for you is in the 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.

So, you must use endpointMap property, not mappings.

And further:

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

That's for the case when you really don't need to use that full URL with host/port.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Unfortunately, I have tried that already. A further complication is that I don't know what class Spring Integration uses by default as the gateway bean to map the url to. Maybe that's my problem - I'm trying to map the gateway as the endpoint rather than the service activator, which is the real endpoint. Using the gateway as the default endpoint bean, the service is correctly invoked in the service activator because it listens to the same input channel that the gateway does. – Alex Apr 15 '15 at 16:23
  • That's correct: a `request-channel` of any `inbound-gateway` is an input for the integration flow and the message from that is sent exactly to your service-activator – Artem Bilan Apr 15 '15 at 18:14