<bdo id='o0B1k'></bdo><ul id='o0B1k'></ul>

  1. <tfoot id='o0B1k'></tfoot>

    <small id='o0B1k'></small><noframes id='o0B1k'>

  2. <legend id='o0B1k'><style id='o0B1k'><dir id='o0B1k'><q id='o0B1k'></q></dir></style></legend>
  3. <i id='o0B1k'><tr id='o0B1k'><dt id='o0B1k'><q id='o0B1k'><span id='o0B1k'><b id='o0B1k'><form id='o0B1k'><ins id='o0B1k'></ins><ul id='o0B1k'></ul><sub id='o0B1k'></sub></form><legend id='o0B1k'></legend><bdo id='o0B1k'><pre id='o0B1k'><center id='o0B1k'></center></pre></bdo></b><th id='o0B1k'></th></span></q></dt></tr></i><div id='o0B1k'><tfoot id='o0B1k'></tfoot><dl id='o0B1k'><fieldset id='o0B1k'></fieldset></dl></div>

      内容类型 'text/xml;charset=utf-8' 不是预期的类

      时间:2023-05-22

        <small id='hMUPK'></small><noframes id='hMUPK'>

          <tbody id='hMUPK'></tbody>
          <tfoot id='hMUPK'></tfoot>
          <legend id='hMUPK'><style id='hMUPK'><dir id='hMUPK'><q id='hMUPK'></q></dir></style></legend>

            <i id='hMUPK'><tr id='hMUPK'><dt id='hMUPK'><q id='hMUPK'><span id='hMUPK'><b id='hMUPK'><form id='hMUPK'><ins id='hMUPK'></ins><ul id='hMUPK'></ul><sub id='hMUPK'></sub></form><legend id='hMUPK'></legend><bdo id='hMUPK'><pre id='hMUPK'><center id='hMUPK'></center></pre></bdo></b><th id='hMUPK'></th></span></q></dt></tr></i><div id='hMUPK'><tfoot id='hMUPK'></tfoot><dl id='hMUPK'><fieldset id='hMUPK'></fieldset></dl></div>
                <bdo id='hMUPK'></bdo><ul id='hMUPK'></ul>
                本文介绍了内容类型 'text/xml;charset=utf-8' 不是预期的类型 'application/soap+xml;字符集=utf-8'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我一直在尝试向soap服务器发送正确的请求.我不断收到错误消息.

                这是我的 xml

                获取最后一个请求(添加换行符):

                得到最后的回应:

                请求头:

                POST/DPWebService/CardsService.svc/ICardsService HTTP/1.1主机:d67v7tg1连接:保持活动用户代理:PHP-SOAP/5.2.9-1内容类型:文本/xml;字符集=utf-8SOAPAction:http://tempuri.org/ICardsService/TestData1"内容长度:254

                这是回复.

                object(SoapFault)#2 (8) {[消息:受保护"]=>string(142) "无法处理消息,因为内容类型 'text/xml; charset=utf-8' 不是预期的类型 'application/soap+xml; charset=utf-8'."[字符串:私人"]=>字符串(0)"[代码:受保护"]=>整数(0)[文件:受保护"]=>string(32) "C:localhostwww	est5index.php"[行:受保护"]=>整数(208)["trace:private"]=>数组(3){[0]=>数组(4){[功能"]=>字符串(11)__doRequest"[类"]=>字符串(10)SoapClient"[类型"]=>字符串(2)->"[参数"]=>数组(5){[0]=>字符串(254)1"[1]=>字符串(59)http://d67v7tg1/DPWebService/CardsService.svc/ICardsService"[2]=>字符串(42)http://tempuri.org/ICardsService/TestData1"[3]=>整数(1)[4]=>整数(0)}}[1]=>数组(4){[功能"]=>字符串(6)__call"[类"]=>字符串(10)SoapClient"[类型"]=>字符串(2)->"[参数"]=>数组(2){[0]=>字符串(9)测试数据1"[1]=>数组(1){[0]=>数组(2){[iVal"]=>整数(1)[strVal"]=>字符串(5)Proba"}}}}[2]=>数组(6){[文件"]=>string(32) "C:localhostwww	est5index.php"[行"]=>整数(208)[功能"]=>字符串(9)测试数据1"[类"]=>字符串(10)SoapClient"[类型"]=>字符串(2)->"[参数"]=>数组(1){[0]=>数组(2){[iVal"]=>整数(1)[strVal"]=>字符串(5)Proba"}}}}[故障字符串"]=>string(142) "无法处理消息,因为内容类型 'text/xml; charset=utf-8' 不是预期的类型 'application/soap+xml; charset=utf-8'."[故障代码"]=>字符串(4)HTTP"}

                得到最后的回应:

                请求头:

                POST/DPWebService/CardsService.svc/ICardsService HTTP/1.1主机:d67v7tg1连接:保持活动用户代理:PHP-SOAP/5.2.9-1内容类型:文本/xml;字符集=utf-8SOAPAction:http://tempuri.org/ICardsService/TestData1"内容长度:254

                解决方案

                PHP 的原生 SOAP 扩展是一个不可调试的二进制大块.

                根据 PHP 手册中的此注释,它被硬编码为使用 MIME 内容类型 application/soap+xml 发送 SOAP 请求.

                您的 SOAP 服务器似乎拒绝这种内容类型,只需要 text/xml.

                根据这个 SOAP 1.2 标准文档,关于 SOAP over HTTP 的第 7.1.4 节:

                <块引用>

                符合此绑定的实现:

                1. 必须能够发送和接收使用媒体类型application/soap+xml"序列化的消息,A.应用程序/soap+xml 媒体类型.

                您使用的 SOAP 服务器不符合 1.2 标准.

                (根据记录,这是我第一次看到有人对 PHP SOAP 扩展提出问题,而问题不是与扩展本身有关!)>

                I've been trying for a long time to send right request to soap server. I'm keep getting error message.

                Here is my xml

                GET LAST REQUEST (newlines added):

                <?xml version="1.0" encoding="UTF-8"?>
                <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
                <SOAP-ENV:Body><ns1:TestData1><ns1:iVal>1</ns1:iVal></ns1:TestData1></SOAP-ENV:Body>
                </SOAP-ENV:Envelope>
                

                GET LAST RESPONSE :

                REQUEST HEADERS:

                POST /DPWebService/CardsService.svc/ICardsService HTTP/1.1
                Host: d67v7tg1
                Connection: Keep-Alive
                User-Agent: PHP-SOAP/5.2.9-1
                Content-Type: text/xml; charset=utf-8
                SOAPAction: "http://tempuri.org/ICardsService/TestData1"
                Content-Length: 254
                

                Here is the response.

                object(SoapFault)#2 (8) { 
                ["message:protected"]=> string(142) "Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'." 
                ["string:private"]=> string(0) "" 
                ["code:protected"]=> int(0) 
                ["file:protected"]=> string(32) "C:localhostwww	est5index.php" 
                ["line:protected"]=> int(208) 
                ["trace:private"]=> array(3) { 
                    [0]=> array(4) { 
                        ["function"]=> string(11) "__doRequest" 
                        ["class"]=> string(10) "SoapClient" 
                        ["type"]=> string(2) "->" 
                        ["args"]=> array(5) { 
                            [0]=> string(254) " 1 " 
                            [1]=> string(59) "http://d67v7tg1/DPWebService/CardsService.svc/ICardsService" 
                            [2]=> string(42) "http://tempuri.org/ICardsService/TestData1" 
                            [3]=> int(1) 
                            [4]=> int(0) 
                        }
                    } 
                    [1]=> array(4) { 
                        ["function"]=> string(6) "__call" 
                        ["class"]=> string(10) "SoapClient" 
                        ["type"]=> string(2) "->" 
                        ["args"]=> array(2) { 
                            [0]=> string(9) "TestData1" 
                            [1]=> array(1) { 
                                [0]=> array(2) { 
                                    ["iVal"]=> int(1) 
                                    ["strVal"]=> string(5) "Proba" 
                                } 
                            } 
                        } 
                    } 
                    [2]=> array(6) { 
                        ["file"]=> string(32) "C:localhostwww	est5index.php" 
                        ["line"]=> int(208) 
                        ["function"]=> string(9) "TestData1" 
                        ["class"]=> string(10) "SoapClient" 
                        ["type"]=> string(2) "->" 
                        ["args"]=> array(1) { 
                            [0]=> array(2) { 
                                ["iVal"]=> int(1) 
                                ["strVal"]=> string(5) "Proba" 
                            } 
                        } 
                    } 
                } 
                ["faultstring"]=> string(142) "Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'." 
                ["faultcode"]=> string(4) "HTTP" 
                } 
                

                GET LAST RESPONSE :

                REQUEST HEADERS:

                POST /DPWebService/CardsService.svc/ICardsService HTTP/1.1
                Host: d67v7tg1
                Connection: Keep-Alive
                User-Agent: PHP-SOAP/5.2.9-1
                Content-Type: text/xml; charset=utf-8
                SOAPAction: "http://tempuri.org/ICardsService/TestData1"
                Content-Length: 254
                

                解决方案

                PHP's native SOAP extension is an undebuggable binary blob of horrors.

                According to this comment in the PHP manual, it is hard-coded to send SOAP requests with the MIME content type application/soap+xml.

                Your SOAP server seems to reject this content type, expecting only text/xml.

                According to this SOAP 1.2 standard document, section 7.1.4 on SOAP over HTTP:

                Conforming implementations of this binding:

                1. MUST be capable of sending and receiving messages serialized using media type "application/soap+xml" whose proper use and parameters are described in A. The application/soap+xml Media Type.

                The SOAP server you are using is not complaint with the 1.2 standard.

                (For the record, this is the first time I've ever, ever seen anyone with a question about the PHP SOAP extension where the problem wasn't with the extension itself!)

                这篇关于内容类型 'text/xml;charset=utf-8' 不是预期的类型 'application/soap+xml;字符集=utf-8'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  <tbody id='3IZyX'></tbody>
                  <bdo id='3IZyX'></bdo><ul id='3IZyX'></ul>
                • <small id='3IZyX'></small><noframes id='3IZyX'>

                  1. <i id='3IZyX'><tr id='3IZyX'><dt id='3IZyX'><q id='3IZyX'><span id='3IZyX'><b id='3IZyX'><form id='3IZyX'><ins id='3IZyX'></ins><ul id='3IZyX'></ul><sub id='3IZyX'></sub></form><legend id='3IZyX'></legend><bdo id='3IZyX'><pre id='3IZyX'><center id='3IZyX'></center></pre></bdo></b><th id='3IZyX'></th></span></q></dt></tr></i><div id='3IZyX'><tfoot id='3IZyX'></tfoot><dl id='3IZyX'><fieldset id='3IZyX'></fieldset></dl></div>
                    <tfoot id='3IZyX'></tfoot>

                      • <legend id='3IZyX'><style id='3IZyX'><dir id='3IZyX'><q id='3IZyX'></q></dir></style></legend>