【问题标题】:PHP : SOAP-ERROR: Parsing WSDLPHP:SOAP 错误:解析 WSDL
【发布时间】:2016-12-01 12:54:33
【问题描述】:

我正在尝试使用 soapClient() 访问 SOAP API,但遇到以下错误。

SoapFault Object
(
    [message:protected] => SOAP-ERROR: Parsing WSDL: No  element with name '10100/Processes/OrderView/OrderView_v1_0?wsdl'
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => C:\xampp\htdocs\api\soap\client.php
    [line:protected] => 37
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => C:\xampp\htdocs\api\soap\client.php
                    [line] => 37
                    [function] => SoapClient
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => https://example.com:443/orders/v1/orderview?wsdl
                            [1] => Array
                                (
                                    [trace] => 1
                                    [stream_context] => Resource id #4
                                    [cache_wsdl] => 0
                                )

                        )

                )

        )

    [previous:Exception:private] => 
    [faultstring] => SOAP-ERROR: Parsing WSDL: No  element with name '10100/Processes/OrderView/OrderView_v1_0?wsdl'
    [faultcode] => WSDL
)

下面是我的代码:

$header = 'Authorization:'.$tokenType.' '.$accessToken;
$streamContext = array('http' => array("header" => $header , 'user_agent' => 'PHPSoapClient' ));
$streamContext['ssl'] = array(
    "verify_peer" => false,
    "verify_peer_name" => false,
    "allow_self_signed" => false
);
try{
    $client = new SoapClient('https://example.com:443/orders/v1/orderview?wsdl', array(
                                "trace" => 1,                
                                "stream_context" => stream_context_create($streamContext),
                                'cache_wsdl' => WSDL_CACHE_NONE
                            ));
    var_dump($client->__getFunctions());
    exit;

使用 php_curl() 可以正常工作并获得响应,但在尝试连接soapClient 时出错。

【问题讨论】:

    标签: php web-services soap wsdl soap-client


    【解决方案1】:

    C:\xampp\htdocs\api\soap\client.php 的第 37 行是做什么的?这可能不是问题所在,但它可能有助于理解错误消息。

    从参数数组中删除 stream_context 参数是否有效?

    【讨论】:

    • 第 37 行是 soapClient() 函数。我们试过没有 stream_context 也仍然遇到同样的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-04
    • 1970-01-01
    • 2019-04-04
    • 2013-04-04
    • 1970-01-01
    • 2012-06-20
    相关资源
    最近更新 更多