Для приведенного ниже кода я получаю 400 неверных запросов
public String saveQuoteCall(String jsonObjectStr) {
try {
preparePostHttpEntity(jsonObjectStr);
response = restTemplate.exchange(CREATE_QUOTE_URL, HttpMethod.POST, entity, String.class);
log.info("Response : " + response.getStatusCode());
if (response.getStatusCode() == HttpStatus.OK) {
return response.getBody();
}
} catch (Exception e) {
log.error("Error in saveQuoteCall : ", e);
}
return "No Data";
}
private void preparePostHttpEntity(String sendingStr) {
try {
headers = new HttpHeaders();
log.info("request in checkCDBalance preparePostHttpEntity: " + sendingStr);
headers.set(HttpHeaders.WWW_AUTHENTICATE, ServiceSecurity.getHeaderValue());
// log.info("request in checkCDBalance preparePostHttpEntity:
// "+HttpHeaders.WWW_AUTHENTICATE);
headers.setAccept(Arrays.asList(new MediaType[] { MediaType.TEXT_PLAIN }));
headers.setContentType(MediaType.TEXT_PLAIN);
entity = new HttpEntity<String>(sendingStr, headers);
log.info("entity value: " + entity);
restTemplate = new RestTemplate();
} catch (Exception e) {
log.error("Error in preparePostHttpEntity : ", e);
}
}
Ниже приводится трассировка стека
org.springframework.web.client.HttpClientErrorException $ BadRequest: 400 плохихЗапрос по адресу org.springframework.web.client.HttpClientErrorException.create (HttpClientErrorException.java:79) ~ [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] по адресу org.springframework.web.clientError.handleError (DefaultResponseErrorHandler.java:122) ~ [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at org.springframework.web.client.DefaultResponseErrorHandler.handleError (DefaultResponse ~ler.jr:spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.client.ResponseErrorHandler.handleError (ResponseErrorHandler.java:63) ~ [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.client.RestTemplate.handleResponse (RestTemplate.java:778) ~ [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.client.RestTemplate.doExecute (RestTemplate.java:736) ~ [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.client.RestTemplate.execute (RestTemplate.java:670) ~ [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at org.springframework.web.client.RestTemplate.exchange (RestTemplate.java:579) ~ [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] на com.hcl.nic.portal.restful.WebServiceCall.saveQuoteCall (WebServiceCall.java:58) ~ [_wl_cls_gen.jar: na] на com.hcl.nic.portal.quote.QuoteServices.saveQuoteService (QuoteSerer.java: 45) [_wl_cls_gen.jar: na] в com.hcl.nic.portal.quote.QuoteServices $$ FastClassBySpringCGLIB $$ 4a211456.invoke () [_wl_cls_gen.jar: na] в org.springframework.xyg.bli.invoke (MethodProxy.java:218) [spring-core-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.aop.framework.CglibAopProxy $ DynamicAdvisedInterceptor.intercept (CglibAopProxy.java:684) [spring-aop-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at com.hcl.nic.portal.quote.QuoteServices $$ EnhancerBySpringCGLIB $$ ad148a87.saveQuoteService() [_wl_cls_gen.jar: na] в com.hcl.nic.portal.quote.QuoteController.saveQuote (QuoteController.java:52) [_wl_cls_gen.jar: na] в sun.reflect.GeneratedMethodAccessor1920.invoke (неизвестно)[na: na] at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:55) ~ [na: 1.8.0-internal] в java.lang.reflect.Method.invoke (Method.java:507) ~ [нет: 2.6 (07-22-2015)] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke (InvocableHandlerMethod.java:189) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE]в org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest (InvocableHandlerMethod.java:138) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.mv.b.Метод.invokeHandlerMethod (RequestMappingHandlerAdapter.java:895) [spring-webmvc-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal (RequestMappingHandlerAd8ter)[spring-webmvc-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle (AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet.java:1038) [spring-webmvc-5.1.5.RELEASE.jar: 5.1.5.RELEASE] вorg.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet.java:942) [spring-webmvc-5.1.5.RELEASE.jar: 5.1.5.RELEASE] вorg.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java:1005) [spring-webmvc-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.servlet.FrameworkSostvdo (FrameworkServlet.java:908) [spring-webmvc-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в javax.servlet.http.HttpServlet.service (HttpServlet.java:707) [javax.servlet.javax.servlet-api.jar: 3.1.0] в org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet.java:882) [spring-webmvc-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в javax.servlet.http.HttpServlet.service (HttpServlet.java:790) [javax.servlet.javax.servlet-api.jar: 3.1.0] по адресу weblogic.servlet.internal.StubSecurityHelper $ ServletServiceAction.run (StubSecavaHel6)[com.oracle.weblogic.servlet.jar: 12.2.1.0] at weblogic.servlet.internal.StubSecurityHelper $ ServletServiceAction.run (StubSecurityHelper.java:260) [com.oracle.weblogic.servlet.jar: 12.2.1.0] вweblogic.servlet.internal.StubSecurityHelper.invokeServlet (StubSecurityHelper.java: 137) [com.oracle.weblogic.servlet.jar: 12.2.1.0] at weblogic.servlet.internal.ServletStubImpl.execute (ServletStubImpl.java:350) [com.oracle.weblogic.servlet.jar: 12.2.1.0]на weblogic.servlet.internal.TailFilter.doFilter (TailFilter.java:25) [com.oracle.weblogic.servlet.jar: 12.2.1.0] на weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:101) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] at org.springframework.boot.actuate.web.trace.servlet.Fter.doFilterInternal (HttpTraceFilter.java:90) [spring-boot-activator-2.1.3.RELEASE.jar: 2.1.3.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:7)spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] по адресу weblogic.servlet.internal.FilterChainImpl.-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor.java:127) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter (FilterSecurityInterceptor.java:91) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] вorg.springframework.security.web.access.ExceptionTranslationFilter.doFilter (ExceptionTranslationFilter.java:119) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.FilterChainProxy $ ВиртualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] по адресу org.springframework.security.web.session.SessionManagementFilter.doFilter (SessionManagementFilter.137) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter (AnonymousAuthenticationFilter.java:111) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] вorg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter (SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASEf.work.ra.pr.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doF.java: 63) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в com.hcl.nic.portal.security.jwt.JwtOncePerRequestFilter.doFilterInternal (JwtOncePerRequestFilter.java:65) [_wl_cls_gen.jar. na]springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.authentication.logout.LogoutFilter.doFilter (LogoutFilter.java:116) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [весна]-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] at org.springframework.web.filter.CorsFilter.doFilterInternal (CorsFilter.java:96) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal (HeaderWriterFilter.java:74) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE]в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web,.java: 334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] на org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal (WebAsyncManagerIntegrationFilter.jpg).) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilterInternal (FilterChainProxy.java:215) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] в org.springframework.security.web.FilterChainProxy.doFilter (FilterChainProxy.java:178) [spring-security-web-5.1.4.RELEASE.jar: 5.1.4.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy.jav) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] по адресу org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:270) [spring-web-5.1.5.RELEASE.jar: 5.1.5. RELEASE] вweblogic.servlet.internal.[spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] в org.springframework.web.filter.FormContentFilter.doFilterInternal (FormContentFilter.java:92) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] в орг.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal (HiddenHttpMethodFilter.java:93) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) spring-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] в орг.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter (ErrorPageFilter.java:130) [spring-boot-2.1.3.RELEASE.jar: 2.1.3.RELEASE] в org.springframework.boot.web.servlet.support.ErrorPageFilter.access $ 000 (ErrorPageFilter.java:66) [spring-boot-2.1.3.RELEASE.jar: 2.1.3.RELEASE] в org.springframework.boot.web.servlet.support.ErrorPageFilter $ 1.doFilterInternal (ErrorPageFilter.java:105) [spring-boot-2.1.3.RELEASE.jar: 2.1.3.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter (ErrorPageFilter.java:123) [spring-boot-2.1.3.RELEASE.jar: 2.1.3.RELEASE] в weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics (WebMvcMetricsFilter.java:117) [spring-boot-activator-2.1.3.RELEASE.jar.jpg.3.RELEASE] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal (WebMvcMetricsFilter.java:106) [spring-boot-actator-2.1.3.RELEASE.jar: 2.1.3.RELASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] в weblogic.servlet.internal.FilterChainImplF (FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] в org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter.java:200) [spring-web-5.1.5.RELE.jar: 5.1.5.RELEASE] на org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpljj)[com.oracle.weblogic.servlet.jar: 12.2.1.0] в oracle.security.jps.ee.http.JpsAbsFilter $ 1.run (JpsAbsFilter.java:141) [jps-ee.jar: na] в java.security.AccessController.doPrivileged (AccessController.java:595) [na: 1.8.0-internal] в oracle.security.jps.util.JpsSubject.doAsPrivileged (JpsSubject.java:315) [jps-api.jar: na] в оракуле.security.jps.ee.util.jps-ee.jar: na] в oracle.security.jps.ee.http.JpsAbsFilter.doFilter (JpsAbsFilter.java:232) [jps-ee.jar: na] вoracle.security.jps.ee.http.JpsFilter.doFilter (JpsFilter.java:94) [jps-ee.jar: na] в weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] в oracle.security.wls.filter.SSOSessionSynchronizationFilter.doFilter (SSOSessionSynchronizationFilter.java:294) [ssofilter.jar: na] в weblogic.servlet.internal.FilterChainImpljava: 78) [com.oracle.weblogic.servlet.jar: 12.2.1.0] at oracle.dms.servlet.DMSServletFilter.doFilter (DMSServletFilter.java:224) [dms.jar: 1.1.0-150927.0310] в веб-журнале.servlet.internal..oracle.weblogic.servlet.jar: 12.2.1.0] at weblogic.servlet.internal.WebAppServletContext $ ServletInvocationAction.run (WebAppServletContext.java:3620) [com.oracle.weblogic.servlet.jar: 12.2.1.0] webogic.security.acl.internal.AuthenticatedSubject.doAs (AuthenticatedSubject.java:326) [com.oracle.weblogic.security.subject.jar: 12.2.1.0] в weblogic.security.service.SecurityManager.runAsForUserCode (SecurityManager.j)196) [com.oracle.weblogic.security.subject.jar: 12.2.1.0] по адресу weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode (WlsSecurityProvider.java:203) [com.oracle.weblogic.servlet.jar: 12.2.1.0] по адресу[com.oracle.weblogic.servlet.jar: 12.2.1.0] at weblogic.servlet.internal.WebAppServletContext.securedExecute (WebAppServletContext.java:2280) [com.oracle.weblogic.servlet.jar: 12.2.1.0] в weblogic.servlet.internal.WebAppServletContext.execute (WebAppServletContext.java:2258) [com.oracle.weblogic.servlet.jar: 12.2.1.0] на weblogic.servlet.internal.ServletRequestImpl.runВнутренний (ServletRequestImpl.java:1626) [com.oracle.weblogic.servlet.jar: 12.2.1.0] в weblogic.servlet.internal.ServletRequestImpl.run (ServletRequestImpl.java:1586) [com.oracle.weblogic.servlet.jar: 12.2.1.0] по адресу weblogic.servlet.provider.ContainerSupportProviderImpl $ WlsRequestExecutor.run (ContainerSupportProviderImpl.java:270) [com.oracle.weblogic.servlet.jar: 12.2.1.0] по веб-компоненту.java: 348) [com.bea.core.utils.full.jar: 12.2.1.0] at weblogic.invocation.ComponentInvocationContextManager.runAs (ComponentInvocationContextManager.java:333) [com.bea.core.utils.full.jar: 12.1.0] в weblogic.work.LivePartitionUtility.doRunWorkUnderContext (LivePartitionUtility.java:54) [com.oracle.weblogic.work.jar: 12.2.1.0] в weblogic.work.PartitionUtility.runWorkUnderContext (PartitionUtility.java:41).bea.core.weblogic.workmanager.jar: 12.2.1.0] at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext (SelfTuningWorkManagerImpl.java:617) [com.bea.core.weblogic.workmanager.jar: 12.2.1.0] в weblogic.work.ExecuteThread.execute (ExecuteThread.java:397) [com.bea.core.weblogic.workmanager.jar: 12.2.1.0] at weblogic.work.ExecuteThread.run (ExecuteThread.java:346) [com.bea.core.weblogic.workmanager.jar: 12.2.1.0]