Somnath Mukherjee
Somnath Mukherjee

Reputation: 93

Calling a SOAP Web service using spring integration dsl

I need to call a SOAP Webservice from my REST service. I'm using Spring integration in my project. Currently I'm using xml based configuration to achieve the target. But I want to write code in java dsl. Kindly help me how to call a SOAP service from a REST Service using Spring integration DSL.

One example would be really helpful.

Upvotes: 0

Views: 874

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

See the documentation: https://docs.spring.io/spring-integration/docs/current/reference/html/ws.html#webservices-dsl

@Bean
IntegrationFlow outboundMarshalled() {
    return f -> f.handle(Ws.marshallingOutboundGateway()
                    .id("marshallingGateway")
                    .marshaller(someMarshaller())
                    .unmarshaller(someUnmarshalller()))
        ...
}

or

.handle(Ws.simpleOutboundGateway(template)
            .uri(uri)
            .sourceExtractor(sourceExtractor)
            .encodingMode(DefaultUriBuilderFactory.EncodingMode.NONE)
            .headerMapper(headerMapper)
            .ignoreEmptyResponses(true)
            .requestCallback(requestCallback)
            .uriVariableExpressions(uriVariableExpressions)
            .extractPayload(false))
)

Upvotes: 0

Related Questions