Первый пост-запрос дает ошибку неверного запроса для веб-клиента при первом клике. org.springframework.web.reactive.function.client.WebClientResponseException $ BadRequest: 400 Bad Request from POST
После этого каждый запрос обрабатывается успешно. исключение я получаю ниже
* Submitting xyz
* @param submitFlowRequest
*/
@Override
public Mono<ApiResponse<SubmitResponse>> submitFlow(SubmitFlowRequest submitFlowRequest,
Map<String, String> headers) {
long startTime = System.currentTimeMillis();
String uri = propertyConfig.getAggregationService()
+ propertyConfig.getAggregationSubmitCCInfoURL();
DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(uri);
factory.setEncodingMode(DefaultUriBuilderFactory.EncodingMode.URI_COMPONENT);
MultiValueMap<String, String> clientHeaders = buildHeaders(headers);
return webClientBuilder.uriBuilderFactory(factory).build().post()
.headers(httpHeaders -> httpHeaders.addAll(clientHeaders)).accept(MediaType.APPLICATION_JSON)
.syncBody(submitFlowRequest).retrieve().bodyToMono(ApiResponse.class)
.onErrorMap(ConnectException.class,
error -> new VzwRuntimeException(ErrorCodeEnum.V404.toString(), Constants.OPP_TC_SYSTEM_ERROR,
(Constants.CONNECTION_FAILURE_TEXT + Constants.AGGREGATION)))
.onErrorMap(WebClientResponseException.class,
error -> new VzwRuntimeException(ErrorCodeEnum.V404.toString(), Constants.OPP_TC_SYSTEM_ERROR,
(Constants.CONNECTION_FAILURE_TEXT + Constants.AGGREGATION)))
.flatMap(res -> {
Audit apiAudit = Audit.builder().apiUrl(uri).request(LoggerUtil.asJson(submitFlowRequest))
.response(LoggerUtil.asJson(res))
.executionTime(String.valueOf(System.currentTimeMillis() - startTime))
.headers(LoggerUtil.asJson(clientHeaders)).transactionType(res.getData()!=null?mapper.map(res.getData(), SubmitResponse.class).getTransactionType():"").build();
LoggerUtil.logExternalApiCalls(apiAudit);
return Mono.just((ApiResponse<SubmitResponse>) res);
});
}
исключение :::
org.springframework.web.reactive.function.client.WebClientResponseException$BadRequest: 400 Bad Request from POST http://WKWIN93.global.sangwan.net:9898/payment-ag/v1/creditcard/submitCreditCardInfo
at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:179)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ 400 from POST http://payment-service/payment-ag/v1/creditcard/submitCreditCardInfo [DefaultWebClient]
Stack trace:
at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:179)
at org.springframework.web.reactive.function.client.DefaultClientResponse.lambda$createException$1(DefaultClientResponse.java:209)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:100)
at com.sgw.common.logging.mdc.MDCContextHelper.onNext(MDCContextHelper.java:30)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1630)
at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:100)
at com.sgw.common.logging.mdc.MDCContextHelper.onComplete(MDCContextHelper.java:46)
at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onComplete(FluxHide.java:137)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:144)
at reactor.core.publisher.FluxContextStart$ContextStartSubscriber.onComplete(FluxContextStart.java:122)