teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

エラーメッセージを追記

2020/03/10 12:37

投稿

fishStory
fishStory

スコア10

title CHANGED
File without changes
body CHANGED
@@ -44,8 +44,10 @@
44
44
  ```
45
45
 
46
46
  #実行結果/エラー内容
47
- > ] with org.springframework.http.converter.StringHttpMessageConverter
48
- 2020-03-10 19:39:15.146 [ERROR] [scheduling-1doSecondaryResponse:659] org.springframework.web.client.HttpClientErrorException$UnsupportedMediaType: 415 Unsupported Media Type: [<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
47
+ > 2020-03-10 21:35:44.478 [DEBUG] [scheduling-1Accept=[text/plain, application/json, application/*+json, */*]
48
+ 2020-03-10 21:35:44.478 [DEBUG] [scheduling-1Writing [<id>100</id>
49
+ ] with org.springframework.http.converter.StringHttpMessageConverter
50
+ 2020-03-10 21:35:45.014 [ERROR] [scheduling-1doSecondaryResponse:684] org.springframework.web.client.HttpClientErrorException$UnsupportedMediaType: 415 Unsupported Media Type: [<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
49
51
  <error>
50
52
  <error-message>Unsupported media type: text/plain ; Should be one of: application/yang-data+xml, application/yang-data+json.</error-message>
51
53
  <error-tag>malformed-message</error-tag>
@@ -56,7 +58,6 @@
56
58
 
57
59
 
58
60
 
59
-
60
61
  #環境
61
62
  java8
62
63
  tomcat9
@@ -93,7 +94,8 @@
93
94
 
94
95
 
95
96
 
96
- 他にも、明示的にxmlになるようにしてみましたが、同様のエラーが出ます
97
+ 他にも、明示的にxmlになるようにしてみましたが、xmlではなくyang-data+xmlで指定するようにとのエラーが出ます
98
+ MediaTypeではyang-data+xmlが指定できません。
97
99
  ```java
98
100
  public HttpStatus distribute(String xml,String url) throws Exception {
99
101
 
@@ -104,4 +106,16 @@
104
106
 
105
107
  final ResponseEntity<String> response = rest.postForEntity(url, request, String.class);
106
108
  }
107
- ```
109
+ ```
110
+
111
+ > 2020-03-10 21:23:11.488 [DEBUG] [scheduling-1Accept=[text/plain, application/json, application/*+json, */*]
112
+ 2020-03-10 21:23:11.488 [DEBUG] [scheduling-1Writing [<?xml version="1.0" encoding="utf-8"?><id>100</id>
113
+ ] as "application/xml"
114
+ 2020-03-10 21:23:11.945 [ERROR] [scheduling-1doSecondaryResponse:684] org.springframework.web.client.HttpClientErrorException$UnsupportedMediaType: 415 Unsupported Media Type: [<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
115
+ <error>
116
+ <error-message>Unsupported media type: application/xml ; Should be one of: application/yang-data+xml, application/yang-data+json.</error-message>
117
+ <error-tag>malformed-message</error-tag>
118
+ <error-type>application</error-type>
119
+ </error>
120
+ </errors>
121
+ ]