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

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

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

      SOAP-ERROR:解析 WSDL:无法加载 - 但适用于 WAMP

      时间:2023-05-22

      <legend id='NjjUl'><style id='NjjUl'><dir id='NjjUl'><q id='NjjUl'></q></dir></style></legend>
        <bdo id='NjjUl'></bdo><ul id='NjjUl'></ul>

            <tbody id='NjjUl'></tbody>
              • <small id='NjjUl'></small><noframes id='NjjUl'>

                <tfoot id='NjjUl'></tfoot>
                <i id='NjjUl'><tr id='NjjUl'><dt id='NjjUl'><q id='NjjUl'><span id='NjjUl'><b id='NjjUl'><form id='NjjUl'><ins id='NjjUl'></ins><ul id='NjjUl'></ul><sub id='NjjUl'></sub></form><legend id='NjjUl'></legend><bdo id='NjjUl'><pre id='NjjUl'><center id='NjjUl'></center></pre></bdo></b><th id='NjjUl'></th></span></q></dt></tr></i><div id='NjjUl'><tfoot id='NjjUl'></tfoot><dl id='NjjUl'><fieldset id='NjjUl'></fieldset></dl></div>
              • 本文介绍了SOAP-ERROR:解析 WSDL:无法加载 - 但适用于 WAMP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                这在我的 WAMP 服务器上工作正常,但在 linux 主服务器上不起作用!?

                This works fine on my WAMP server, but doesn't work on the linux master server!?

                try{
                    $client = new SoapClient('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl', ['trace' => true]);
                    $result = $client->checkVat([
                        'countryCode' => 'DK',
                        'vatNumber' => '47458714'
                    ]);
                    print_r($result);
                }
                catch(Exception $e){
                    echo $e->getMessage();
                }
                

                我在这里错过了什么?!:(

                What am I missing here?! :(

                SOAP 已启用

                SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl' : failed to load external entity "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"/taxation_customs/vies/checkVatService.wsdl"
                

                从 PHP 调用 URL

                从 PHP 调用 URL 返回错误

                Call the URL from PHP

                Calling the URL from PHP returns error

                $wsdl = file_get_contents('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl');
                echo $wsdl;
                

                错误

                Warning:  file_get_contents(http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl): failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable
                

                从命令行调用 URL

                从 linux 命令行调用 URL HTTP 200 返回一个 XML 响应

                Call the URL from command line

                Calling the URL from the linux command line HTTP 200 is returned with a XML response

                curl http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
                

                推荐答案

                对于某些版本的 php,SoapClient 不发送 http 用户代理信息.与本地 WAMP 相比,您在服务器上有哪些 php 版本?

                For some versions of php, the SoapClient does not send http user agent information. What php versions do you have on the server vs your local WAMP?

                尝试使用上下文流显式设置用户代理,如下所示:

                Try to set the user agent explicitly, using a context stream as follows:

                try {
                    $opts = array(
                        'http' => array(
                            'user_agent' => 'PHPSoapClient'
                        )
                    );
                    $context = stream_context_create($opts);
                
                    $wsdlUrl = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
                    $soapClientOptions = array(
                        'stream_context' => $context,
                        'cache_wsdl' => WSDL_CACHE_NONE
                    );
                
                    $client = new SoapClient($wsdlUrl, $soapClientOptions);
                
                    $checkVatParameters = array(
                        'countryCode' => 'DK',
                        'vatNumber' => '47458714'
                    );
                
                    $result = $client->checkVat($checkVatParameters);
                    print_r($result);
                }
                catch(Exception $e) {
                    echo $e->getMessage();
                }
                

                编辑

                实际上,您使用的网络服务似乎存在一些问题.基于 IPv6 的 HTTP 和缺少 HTTP 用户代理字符串的组合似乎给 Web 服务带来了问题.

                Edit

                It actually seems to be some issues with the web service you are using. The combination of HTTP over IPv6, and missing HTTP User Agent string, seems to give the web service problems.

                要验证这一点,请在您的 linux 主机上尝试以下操作:

                To verify this, try the following on your linux host:

                curl  -A ''  -6 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
                

                此 IPv6 请求失败.

                this IPv6 request fails.

                curl  -A 'cURL User Agent'  -6 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
                

                此 IPv6 请求成功.

                this IPv6 request succeeds.

                curl  -A ''  -4 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
                curl  -A 'cURL User Agent'  -4 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
                

                这两个 IPv4 请求都成功.

                both these IPv4 request succeeds.

                有趣的案例 :) 我猜您的 linux 主机将 ec.europa.eu 解析为其 IPv6 地址,并且您的 SoapClient 版本默认没有添加用户代理字符串.

                Interesting case :) I guess your linux host resolves ec.europa.eu to its IPv6 address, and that your version of SoapClient did not add a user agent string by default.

                这篇关于SOAP-ERROR:解析 WSDL:无法加载 - 但适用于 WAMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何使用 SoapClient 类进行 PHP SOAP 调用 下一篇:使用具有多个命名空间的 SimpleXML 解析 XML

                相关文章

                最新文章

                <legend id='nveU8'><style id='nveU8'><dir id='nveU8'><q id='nveU8'></q></dir></style></legend>

                  1. <small id='nveU8'></small><noframes id='nveU8'>

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