致命错误:未捕获的SoapFault异常:[WSDL] SOAP-ERROR:解析WSDL

时间:2014-01-22 11:13:01

标签: php web-services soap wsdl

我正在尝试使用PHP SOAP客户端发送测试消息。我正在使用BeSimpleSoap库,因为我遇到了标准PHP SOAP calss和NuSOAP类的问题。这是我的剧本:

<?php

function __autoload($class_name) {
    include "C:\\xampp\\htdocs\\NIAS\\BeSimpleSoap-master\\src\\" .$class_name . '.php';
}


$full_path="C:\\xampp\\htdocs\\NIAS\\Unload\\";
$destination="C:\\xampp\\htdocs\\NIAS\\Arhiva\\";
$OIB_URL="https://demo.apis-it.hr:8444/kpoib/kp_lista_aktiviranih_korisnika.txt";

//$OIB_list=file_get_contents($OIB_URL);
//echo $OIB_list;
$date_time = date("Y-m-d") . "T" . date("G") . ":" . date("i") . ":" . date("s");
$rows_lines="";


$input_file=scandir($full_path);

    foreach ($input_file as $input_name){
        if($input_name=="." || $input_name=="..")
        continue;

        $lines = file($full_path . $input_name);
        //$flag=true; //flag for skiping lead row in file
        foreach($lines as $line)
        {
            //if($flag) { $flag = false; continue; }//skip the first row in file
            $line_row = explode(':', $line);
            //$rows_lines .= implode(";",$line_row);
            if(substr($input_name,0,7)=="naknade"){
                if(empty($line_row[6])){
                    $IBAN_tmp=$line_row[7].$line_row[8].'172700';
                    $IBAN=IBAN_generator($IBAN_tmp);
                }
                else{
                    $IBAN=$line_row[6];
                }

                $compensation = number_format($line_row[2],2);
                $title="Obavijest o uplati naknade plaće zbog privremene nesposobnosti za rad, rodiljne i roditeljske potpore";

                echo $rows_lines ="Poštovana/i,\nNa Vaš račun " . $IBAN . " upućena je " . $line_row[5] . " u iznosu od " . $compensation . " kuna za " . $line_row[0] . ". mjesec " . $line_row[1] . ". godine." . "</br>";
            }
            else if(substr($input_name,0,9)=="za_e_grad"){
                $title="Obavijest o isteku dopunskog osiguranja";
                echo $rows_lines ="Poštovana/i,\nVaše dopunsko zdravstveno osiguranje, broj iskaznice " . $line_row[1] . ", ističe " . $line_row[2] . " godine.". "</br>";

            }

/*
$par_data = new StdClass(); 
$par_data->encoding = "EMBEDDED"; 
$par_data->any = $par_data; 
*/

            $par_data=array("KorisnickiPretinacPoruka" => 
                array("Zaglavlje"=>
                    array("IdPosiljatelja"=>"000000001","IdPoruke"=>"833362f-063f-11e2-892e-0802200c9a62","DatumVrijemeSlanja"=>$date_time,"RazinaSigurnosti"=>2),
                        "Poruka" =>array("PinPrimatelja"=>"012345678901","OznakaDrzave"=>"HR","Predmet"=>$title,"Sadrzaj"=>$rows_lines)));

            $par_envelope=array( "GsbEnvelope" =>  
                array( "MessageHeader" => 
                    array("SenderId" => "000000001",
                        "ServiceId" => "000000002",
                        "MessageId" => "833362f-063f-11e2-892e-0802200c9a62",
                        "SenderTimeStamp" => $date_time),
                        "Content" => array("MimeType" =>"application/xml","Data" =>array("encoding"=>"EMBEDDED","any"=>$par_data))));


            $client = new BeSimple\SoapClient\SoapClient("GSBService.wsdl", array( 
                            "trace"=>1,
                            "exceptions"=>1,
                            "local_cert" =>"C:\\PKI\\democacert.cer",
                            "passphrase"=>"",
                            "connection_timeout" => 300));


            print_r( $client->sendMessage($par_envelope));



            echo "<p>Request :".htmlspecialchars($client->__getLastRequest()) ."</p>";
            echo "<p>Response:".htmlspecialchars($client->__getLastResponse())."</p>";
            echo "<p>Debug:".soapDebug($client)."</p>";

        }
        if (copy($full_path.$input_name, $destination.$input_name)) {
            $delete1[] = $full_path.$input_name;
        }
    }
    if (!empty($delete1)){
        foreach ($delete1 as $file1) {
            unlink($file1);
        }
    }
function IBAN_generator($acc){

    if(strlen($acc)!=23)
        return;
    $temp_str=substr($acc,0,3);
    $remainder =$temp_str % 97;
    for($i=3;$i<=22;$i++)
    {
        $remainder =$remainder .substr($acc,$i,1);
        $remainder  = $remainder  % 97;
    }
    $con_num = 98 - $remainder;
    if ($con_num<10)
    {
        $con_num="0".$con_num;
    }
    $IBAN="HR".$con_num.substr($acc,0,17);
    return $IBAN;
}
  ?>

我在php.ini中启用了extension=php_openssl.dll。 我收到了这个错误:

Warning: DOMDocument::save(/tmp\wsdl_9429a1dff02ce405ba48d1992f82604d.cache): failed to open stream: No such file or directory in C:\xampp\htdocs\NIAS\BeSimpleSoap-master\src\BeSimple\SoapClient\WsdlDownloader.php on line 204

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from '/tmp\wsdl_9429a1dff02ce405ba48d1992f82604d.cache' : failed to load external entity "/tmp/wsdl_9429a1dff02ce405ba48d1992f82604d.cache" in C:\xampp\htdocs\NIAS\BeSimpleSoap-master\src\BeSimple\SoapClient\SoapClient.php:113 Stack trace: #0 C:\xampp\htdocs\NIAS\BeSimpleSoap-master\src\BeSimple\SoapClient\SoapClient.php(113): SoapClient->SoapClient('/tmp\wsdl_9429a...', Array) #1 C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php(76): BeSimple\SoapClient\SoapClient->__construct('GSBService.wsdl', Array) #2 {main} thrown in C:\xampp\htdocs\NIAS\BeSimpleSoap-master\src\BeSimple\SoapClient\SoapClient.php on line 113

1 个答案:

答案 0 :(得分:1)

(这在评论中得到了相当简洁的解释,在此转录。见Question with no answers, but issue solved in the comments (or extended in chat)

OP写道:

  

我通过使用soap.wsdl_cache_dir="C:\xampp\htdocs\NIAS\tmp"

编辑PHP.ini解决了这个问题