Spring Integration webservice outbound gateway - capturing request and response to DB with additional values - spring

I am using Spring integration WS 2.2 outbound gateway to invoke a webservice.
One of our requirement is to capture the soap request and response xmls to the database in addition to some other values like transaction id etc.
If i use ClientInterceptor to save the request/response to DB, it only has access to the soap request and the response but not to the values like transaction Id. So is there a way to retrieve and return the soap request and response from the interceptor OR a way to pass custom values to the interceptor?
Thanks

Related

Why spring cloud gateway always returns response in JSON format if no Accept Header is specified in the HTTP request?

We have migrated our in house gateway to spring cloud gateway for routing the requests to respective down-stream micro-services. Whenever a call is made without Accept header, the existing service was returning the response in the XML format(this is the behaviour of the downstream micro-services if we don't pass any Accept headers) - However, when the same call is made without Accept header to spring cloud gateway, the response is returned in JSON format.
How to configure spring cloud gateway to not take the application/json as the Accept header if not passed by the client?
spring-cloud-gateway-starter-version: 3.0.0

In a Spring Cloud Gateway server, is it necessary to build a WebClient for sending request manually?

If I want to send some request to a microservice under the gateway (for example, trigger by a timer), should I build a new WebClient, or just use an existing bean?

Spring Reactive Rest Log Complete Request Response Body

We have a requirement to log the complete request and response to our JSON based REST endpoints. We are going to use Spring Reactive. Is there a recommended solution that works out of the box? If not, what's the best approach to log request and response?

Send Mock response for Soap Request

We have created an soap request and sending the request using WebServiceTemplate
WebServiceTemplate.marshalSendAndReceive(request)
As my client is not ready with the server. I am trying to handle this request in my local and planning to post some dummy response.
Can you help me how I can mock this response?
If you are using CXF, see my JUnit Rule utility project. It creates an Endpoint using JaxWsServerFactoryBean.

Spring Integration - HTTP gateway and JMS

I have a requirement where client sends an HTTP requests, our application processes it and generates response and sends back the HTTP response. The request and response need to be persisted on JMS queues. In order for us to leverage Spring integration in this scenario, can we use spring integration HTTP gateways in place of our current MVC controllers ? Would I need separate gateways for each different uri mapping ? Can the HTTP gateway be integrated with JMS channels ? I would appreciate some ideas on the high level architecture using Spring Integration for this scenario.
Thanks.
The fastest on-ramp would probably to inject a Messaging Gateway (<gateway/>) into your existing controller; if you are simply archiving the request/response, you just need a simply gateway method that returns void and in the Spring Integration flow, wire the <gateway/> to a <jms:outbound-channel-adapter/>.

Resources