0

I'm trying to send test message with my PHP SOAP client. I'm using BeSimpleSoap library because I had problems with standard PHP SOAP calss and NuSOAP class. This is my script:

<?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;
}
  ?>

I have enabled extension=php_openssl.dll in php.ini. I'm getting this error:

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
  • 1
    I have solved it by editing PHP.ini with soap.wsdl_cache_dir="C:\xampp\htdocs\NIAS\tmp" Commented Jan 22, 2014 at 11:47

1 Answer 1

1

(This was solved rather tersely in the comments, transcribed herein. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

I have solved it by editing PHP.ini with soap.wsdl_cache_dir="C:\xampp\htdocs\NIAS\tmp"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.