Getting 415 Error: Unsupported Media Type as response while converting SOAP to REST service in WSO2
Getting 415 Error: Unsupported Media Type as response while converting SOAP to REST service in WSO2
我正在尝试使用 WSO2 将 SOAP 端点转换为 REST 端点。在 API Manager 中创建和发送请求时,我收到 415 Error: Unsupported Media Type 作为响应。有人可以帮忙吗?
更新:我已经获取了 WIRE 日志,下面是调试
TID: [-1] [] [2021-07-07 14:07:17,216] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,216] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "443[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,217] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://fcubs.ofss.com/service/FCUBSSMService"><soapenv:Body><web:QUERYUSERMAINT_IOFS_REQ><web:FCUBS_HEADER><web:FUNCTIONID>2gg</web:FUNCTIONID><web:SOURCE_USERID>ggg</web:SOURCE_USERID><web:ACTION>234</web:ACTION><web:ENTITY/><web:MODULEID>gg</web:MODULEID><web:MSGSTAT>ggg</web:MSGSTAT><web:PASSWORD>234</web:PASSWORD><web:MULTITRIPID>234</web:MULTITRIPID><web:MSGID>ggg</web:MSGID><web:SERVICE>ggg</web:SERVICE><web:SNAPSHOTID>gg</web:SNAPSHOTID><web:OPERATION>234</web:OPERATION><web:SOURCE>gg</web:SOURCE><web:SOURCE_OPERATION>gg</web:SOURCE_OPERATION><web:CORRELID>gg</web:CORRELID><web:DESTINATION>ggggg</web:DESTINATION><web:BRANCH>gg</web:BRANCH><web:UBSCOMP>gg</web:UBSCOMP><web:USERID>FCUBS</web:USERID></web:FCUBS_HEADER><web:FCUBS_BODY><web:USR-IO><web:ALERTS_ON_HOME>gg</web:ALERTS_ON_HOME><web:DASHBOARD_REQD>FCUBS</web:DASHBOARD_REQD><web:USRID>gg</web:USRID></web:USR-IO></web:FCUBS_BODY></web:QUERYUSERMAINT_IOFS_REQ></soapenv:Body></soapenv:Envelope>[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,217] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "0[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,217] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,369] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "HTTP/1.1 415 Unsupported Media Type[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,370] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "Date: Wed, 07 Jul 2021 08:37:17 GMT[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,371] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "Transfer-Encoding: chunked[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,371] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "X-ORACLE-DMS-ECID: a5d4445f-1bb3-4a74-8fe4-444f37d101af-000004e4[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,372] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "X-ORACLE-DMS-RID: 0[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,373] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,374] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "0000[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,375] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,382] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "HTTP/1.1 415 Unsupported Media Type[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,383] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "activityid: 3400c7fd-005b-4a12-9934-24dadddd56c0[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,384] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "Access-Control-Expose-Headers: [\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,388] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "Access-Control-Allow-Origin: *[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,390] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "Access-Control-Allow-Methods: POST[\r][\n]"
415
当 Content-Type 和负载不匹配时抛出状态代码。根据共享的 WIRE
日志,415
状态代码是从您的实际 Oracle 后端服务器填充的。
要验证导致此行为的原因,您可以 cross-check 从 API Manager
发出的请求以及 SOAPUI 请求来验证和验证 [=24] 中是否存在任何不匹配=] 或有效载荷。验证后,对 SOAP 进行相同的更改以实现相同的 REST API 资源 in-mediation 序列。
希望本说明能帮助您解决问题并修复它。
我正在尝试使用 WSO2 将 SOAP 端点转换为 REST 端点。在 API Manager 中创建和发送请求时,我收到 415 Error: Unsupported Media Type 作为响应。有人可以帮忙吗?
更新:我已经获取了 WIRE 日志,下面是调试
TID: [-1] [] [2021-07-07 14:07:17,216] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,216] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "443[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,217] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://fcubs.ofss.com/service/FCUBSSMService"><soapenv:Body><web:QUERYUSERMAINT_IOFS_REQ><web:FCUBS_HEADER><web:FUNCTIONID>2gg</web:FUNCTIONID><web:SOURCE_USERID>ggg</web:SOURCE_USERID><web:ACTION>234</web:ACTION><web:ENTITY/><web:MODULEID>gg</web:MODULEID><web:MSGSTAT>ggg</web:MSGSTAT><web:PASSWORD>234</web:PASSWORD><web:MULTITRIPID>234</web:MULTITRIPID><web:MSGID>ggg</web:MSGID><web:SERVICE>ggg</web:SERVICE><web:SNAPSHOTID>gg</web:SNAPSHOTID><web:OPERATION>234</web:OPERATION><web:SOURCE>gg</web:SOURCE><web:SOURCE_OPERATION>gg</web:SOURCE_OPERATION><web:CORRELID>gg</web:CORRELID><web:DESTINATION>ggggg</web:DESTINATION><web:BRANCH>gg</web:BRANCH><web:UBSCOMP>gg</web:UBSCOMP><web:USERID>FCUBS</web:USERID></web:FCUBS_HEADER><web:FCUBS_BODY><web:USR-IO><web:ALERTS_ON_HOME>gg</web:ALERTS_ON_HOME><web:DASHBOARD_REQD>FCUBS</web:DASHBOARD_REQD><web:USRID>gg</web:USRID></web:USR-IO></web:FCUBS_BODY></web:QUERYUSERMAINT_IOFS_REQ></soapenv:Body></soapenv:Envelope>[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,217] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "0[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,217] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 << "[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,369] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "HTTP/1.1 415 Unsupported Media Type[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,370] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "Date: Wed, 07 Jul 2021 08:37:17 GMT[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,371] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "Transfer-Encoding: chunked[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,371] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "X-ORACLE-DMS-ECID: a5d4445f-1bb3-4a74-8fe4-444f37d101af-000004e4[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,372] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "X-ORACLE-DMS-RID: 0[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,373] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,374] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "0000[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,375] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Sender I/O dispatcher-7 >> "[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,382] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "HTTP/1.1 415 Unsupported Media Type[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,383] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "activityid: 3400c7fd-005b-4a12-9934-24dadddd56c0[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,384] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "Access-Control-Expose-Headers: [\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,388] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "Access-Control-Allow-Origin: *[\r][\n]"
TID: [-1] [] [2021-07-07 14:07:17,390] DEBUG {org.apache.synapse.transport.http.wire} - HTTPS-Listener I/O dispatcher-12 << "Access-Control-Allow-Methods: POST[\r][\n]"
415
当 Content-Type 和负载不匹配时抛出状态代码。根据共享的 WIRE
日志,415
状态代码是从您的实际 Oracle 后端服务器填充的。
要验证导致此行为的原因,您可以 cross-check 从 API Manager
发出的请求以及 SOAPUI 请求来验证和验证 [=24] 中是否存在任何不匹配=] 或有效载荷。验证后,对 SOAP 进行相同的更改以实现相同的 REST API 资源 in-mediation 序列。
希望本说明能帮助您解决问题并修复它。