gpt4 book ai didi

java - Spring WS : Soap fault not identified as Fault

转载 作者:行者123 更新时间:2023-11-29 05:03:40 32 4
gpt4 key购买 nike

我正在使用 Spring-WS,当我通过 webServiceTemplate 中的 marshalSendAndReceive 调用 Web 服务时,我收到错误代码为 500 的 SOAP 错误。不幸的是,响应没有被识别为 SOAP 错误(它抛出 WebServiceTransportException)。理论上,当有错误响应时,如果错误代码与 2xx 不同,WebServiceTemplate 将抛出 WebServiceTransportException,除非http 错误为 500 且内容为 soap 错误。以下是我收到的响应示例:

    HTTP/1.1 500 Internal Server Error[\r][\n]"
Content-Length: 887[\r][\n]"
Connection: keep-alive[\r][\n]"

2015-07-01 10:38:22,873 DEBUG [o.s.ws.client.core.WebServiceTemplate] Received error for request [SaajSoapMessage {http://www.example.com/schema/front}use]
2015-07-01 10:38:22,874 DEBUG [org.apache.http.wire] << "<?xml version="1.0" encoding="UTF-8"?>[\n]"
2015-07-01 10:38:22,874 DEBUG [org.apache.http.wire] << "[\n]"
2015-07-01 10:38:22,874 DEBUG [org.apache.http.wire] << "<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">[\n]"
2015-07-01 10:38:22,874 DEBUG [org.apache.http.wire] << " <SOAP-ENV:Body>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " <SOAP-ENV:Fault>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " <faultcode>SOAP-ENV:Server</faultcode>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " <faultstring>Request service/operation version not supported</faultstring>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " <faultactor>Server</faultactor>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " <detail>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " <ns0:serviceException xmlns:ns0="http://www.example.com/facade/interface/v1_1">[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " <ns1:message xmlns:ns1="http://www.example.com/common/v1_3">InternalCode01</ns1:messageId>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " <ns1:text xmlns:ns1="http://www.example.com/common/v2_1">Request service/operation version not supported</ns1:text>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " </ns0:serviceException>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " </detail>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " </SOAP-ENV:Fault>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << " </SOAP-ENV:Body>[\n]"
2015-07-01 10:38:22,875 DEBUG [org.apache.http.wire] << "</SOAP-ENV:Envelope>"

有人知道为什么会这样吗?有没有办法将其视为 SOAP 错误?

最佳答案

checkConnectionForFault WebServiceTemplate 中的属性应该允许您解决此问题。

关于java - Spring WS : Soap fault not identified as Fault,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31163151/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com