Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php Saop始终返回NULL_Php_Soap_Wsdl - Fatal编程技术网

php Saop始终返回NULL

php Saop始终返回NULL,php,soap,wsdl,Php,Soap,Wsdl,我正在尝试使soap API正常工作。但我会犯错误。 下面是wsdl文件 https://www.shafafiya.org/v2/webservices.asmx?wsdl 下面是代码 try{ $c = new SoapClient("https://www.shafafiya.org/v2/webservices.asmx?wsdl", array("trace" => 1, "exceptions" => 0)); $x = $c->GetNewTra

我正在尝试使soap API正常工作。但我会犯错误。 下面是wsdl文件

https://www.shafafiya.org/v2/webservices.asmx?wsdl
下面是代码

try{
    $c = new SoapClient("https://www.shafafiya.org/v2/webservices.asmx?wsdl", array("trace" => 1, "exceptions" => 0));
    $x = $c->GetNewTransactions(array("login" => "username", "pwd" => "password"));
    //execution fails from above line
    SoapClient::__getLastResponseHeaders();
 }catch(SoapFault $e){
var_dump($e);
}
根据wsdl文件,假设输出$x具有属性
xmlTransactions
,或者至少具有属性
errorError
。我得到的是一个空值

object(SoapFault)#2 (9) {
  ["message":protected]=>
  string(9) "Not Found"
  ["string":"Exception":private]=>
  string(0) ""
  ["code":protected]=>
  int(0)
  ["file":protected]=>
  string(23) "/var/www/haad/index.php"
  ["line":protected]=>
  int(6)
  ["trace":"Exception":private]=>
  array(3) {
    [0]=>
    array(4) {
      ["function"]=>
      string(11) "__doRequest"
      ["class"]=>
      string(10) "SoapClient"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(5) {
        [0]=>
        string(316) "<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://www.shafafiya.org/v2/"><SOAP-ENV:Body><ns1:GetNewTransactions><ns1:login>User</ns1:login><ns1:pwd>_PASS</ns1:pwd></ns1:GetNewTransactions></SOAP-ENV:Body></SOAP-ENV:Envelope>
"
        [1]=>
        string(44) "http://www.shafafiya.org/v2/webservices.asmx"
        [2]=>
        string(47) "https://www.shafafiya.org/v2/GetNewTransactions"
        [3]=>
        int(1)
        [4]=>
        int(0)
      }
    }
    [1]=>
    array(6) {
      ["file"]=>
      string(23) "/var/www/haad/index.php"
      ["line"]=>
      int(6)
      ["function"]=>
      string(6) "__call"
      ["class"]=>
      string(10) "SoapClient"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(2) {
        [0]=>
        string(18) "GetNewTransactions"
        [1]=>
        array(1) {
          [0]=>
          array(2) {
            ["login"]=>
            string(6) "user"
            ["pwd"]=>
            string(8) "PASS"
          }
        }
      }
    }
    [2]=>
    array(6) {
      ["file"]=>
      string(23) "/var/www/haad/index.php"
      ["line"]=>
      int(6)
      ["function"]=>
      string(18) "GetNewTransactions"
      ["class"]=>
      string(10) "SoapClient"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(1) {
        [0]=>
        array(2) {
          ["login"]=>
          string(6) "User"
          ["pwd"]=>
          string(8) "pass"
        }
      }
    }
  }
  ["previous":"Exception":private]=>
  NULL
  ["faultstring"]=>
  string(9) "Not Found"
  ["faultcode"]=>
  string(4) "HTTP"
}
对象(SoapFault)#2(9){
[“消息”:受保护]=>
字符串(9)“未找到”
[“字符串”:“异常”:私有]=>
字符串(0)”
[“代码”:受保护]=>
int(0)
[“文件”:受保护]=>
字符串(23)“/var/www/haad/index.php”
[“线路”:受保护]=>
国际(6)
[“跟踪”:“异常”:私有]=>
阵列(3){
[0]=>
阵列(4){
[“函数”]=>
字符串(11)“\uuuu doRequest”
[“类”]=>
字符串(10)“SoapClient”
[“类型”]=>
字符串(2)“->”
[“args”]=>
阵列(5){
[0]=>
字符串(316)”
用户通行证
"
[1]=>
字符串(44)”http://www.shafafiya.org/v2/webservices.asmx"
[2]=>
字符串(47)”https://www.shafafiya.org/v2/GetNewTransactions"
[3]=>
int(1)
[4]=>
int(0)
}
}
[1]=>
阵列(6){
[“文件”]=>
字符串(23)“/var/www/haad/index.php”
[“行”]=>
国际(6)
[“函数”]=>
字符串(6)“\uuuu调用”
[“类”]=>
字符串(10)“SoapClient”
[“类型”]=>
字符串(2)“->”
[“args”]=>
阵列(2){
[0]=>
字符串(18)“GetNewTransactions”
[1]=>
阵列(1){
[0]=>
阵列(2){
[“登录”]=>
字符串(6)“用户”
[“pwd”]=>
串(8)“通过”
}
}
}
}
[2]=>
阵列(6){
[“文件”]=>
字符串(23)“/var/www/haad/index.php”
[“行”]=>
国际(6)
[“函数”]=>
字符串(18)“GetNewTransactions”
[“类”]=>
字符串(10)“SoapClient”
[“类型”]=>
字符串(2)“->”
[“args”]=>
阵列(1){
[0]=>
阵列(2){
[“登录”]=>
字符串(6)“用户”
[“pwd”]=>
串(8)“通过”
}
}
}
}
[“先前”:“例外”:私有]=>
无效的
[“faultstring”]=>
字符串(9)“未找到”
[“故障代码”]=>
字符串(4)“HTTP”
}
该api似乎可以与其他语言一起使用

有什么想法吗


谢谢

启用异常,您可能会看到您的问题(当您明显遇到一些问题时,为什么要禁用它们?)。。。或者,如果启用了
跟踪
,为什么不查看上一个原始请求和响应是什么?这可能意味着它无法到达
https://www.shafafiya.org/v2/webservices.asmx?wsdl
url。要尝试的选项,顺序为:(1)是否已启用?(2) 你能
获取文件内容吗(你的wsdl\uurl)?如果没有,连接问题,如果可以。。。wsdl语法问题(但我怀疑)(3)如果全部失败,您可以尝试设置一个
用户\u代理
(某些服务会这样挑剔)(4)。。与网络管理员/系统管理员一起检查连接失败的原因。嗯,然后导入位:客户端的构造或
GetNewTransactions
是否引发异常?(如果是后者:您能否访问
https://www.shafafiya.org/v2/GetNewTransactions
?可能是url行为不当(请检查
\uu getLastResponseHeaders()
输出)。该站点只是不允许ICMP(pings),因此没有问题。您可以访问Web服务器(否则,您将不会得到404,而是“无连接”错误),因此情况也并非如此。我担心服务器端可能存在失败的前提条件或错误。请仔细检查您的有效负载(用户和密码),如果您知道这些是正确的,请联系该soap服务的提供商,了解他们抛出404的原因。最终解决了问题!!!WDSL出现错误。。在wsld文件中,URL是http而不是https