简体   繁体   English

我收到错误 org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request

[英]I am getting the Error org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request

I am trying to call a Rest Service with post method.我正在尝试使用 post 方法调用 Rest 服务。 I am getting a bad request Error as mentioned below.我收到一个错误的请求错误,如下所述。 Rest service is developed in WCF, with only one String as request parameter. Rest服务是在WCF中开发的,请求参数只有一个String。

Error Log错误日志

org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: [?xml version="1.0" encoding="utf-8"?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/... (3462 bytes)]

Code代码

System.out.println("Hi.................... I am in ###########################");
String testData="hashcode";

String response = restTemplate().postForObject("https://(...)/Rest/Register",testData, String.class, testData);
        
System.out.println("Hi.................... I am in ########################### "+response);

Can you please suggest me what's wrong in my calling?你能告诉我我的电话有什么问题吗?

Can you use just:你可以只使用:

String response = restTemplate().postForObject("https://(...)/Rest/Register",testData, String.class)

Also if this doesn't work could you post your API also?另外,如果这不起作用,您可以发布您的 API 吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我收到错误消息“ org.springframework.web.client.HttpClientErrorException $ BadRequest:400错误请求” - I'm getting error “org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request” org.springframework.web.client.HttpClientErrorException$BadRequest: 400 错误请求 - org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request binance - org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request binance org.springframework.web.client.HttpClientErrorException:400错误的请求 - org.springframework.web.client.HttpClientErrorException: 400 Bad Request org.springframework.web.client.HttpClientErrorException: 400 错误的 PUT 请求 - org.springframework.web.client.HttpClientErrorException: 400 Bad Request for PUT org.springframework.web.client.HttpClientErrorException:RestTemplate 中的 400 错误请求 - org.springframework.web.client.HttpClientErrorException: 400 Bad Request in RestTemplate RestTemplate.postForObject - 错误:org.springframework.web.client.HttpClientErrorException:400错误请求 - RestTemplate.postForObject - Error: org.springframework.web.client.HttpClientErrorException: 400 Bad Request org.springframework.web.client.HttpClientErrorException:400使用HttpEntity restTemplate.exchange的错误请求 - org.springframework.web.client.HttpClientErrorException: 400 Bad Request using HttpEntity restTemplate.exchange org.springframework.web.client.HttpClientErrorException 400 RestTemplate.postForEntity - org.springframework.web.client.HttpClientErrorException 400 RestTemplate.postForEntity org.springframework.web.client.HttpClientErrorException:400空 - org.springframework.web.client.HttpClientErrorException: 400 null
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM