![](/img/trans.png)
[英]I'm getting error “org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request”
[英]I am getting the Error org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request
我正在嘗試使用 post 方法調用 Rest 服務。 我收到一個錯誤的請求錯誤,如下所述。 Rest服務是在WCF中開發的,請求參數只有一個String。
錯誤日志
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)]
代碼
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);
你能告訴我我的電話有什么問題嗎?
你可以只使用:
String response = restTemplate().postForObject("https://(...)/Rest/Register",testData, String.class)
另外,如果這不起作用,您可以發布您的 API 嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.