uspeo sam i radi
Code:
require_once('lib/nusoap.php');
$soapaction = "http://communicationoffice.nbs.rs/GetCurrentExchangeRate";
$wsdl = "https://webservices.nbs.rs/Com.../ExchangeRateService.asmx?WSDL";
$namespace = "http://communicationoffice.nbs.rs";
//kreiranje SOAP klijenta, tj. objekta preko kog ce se komunicirati
$client = new nusoap_client($wsdl);
//kreiranje poruke, XML-a, koja ce biti poslata Web servisu NBS-a
$mysoapmsg = $client->serializeEnvelope('<GetCurrentExchangeRate xmlns="http://communicationoffice.nbs.rs"><exchangeRateListTypeID>1</exchangeRateListTypeID></GetCurrentExchangeRate>
','<AuthenticationHeader xmlns="http://communicationoffice.nbs.rs"><UserName></UserName><Password></Password><LicenceID></LicenceID></AuthenticationHeader>',array(),'document', 'literal');
//prihvatanje poruke od WS-a
$response = $client->send($mysoapmsg, $soapaction);
$_f="skurs.php";
$buf=sprintf("<?php\nclass Kurs{ \nvar \$NOVAC=%s;\nfunction VratiKurs(){return \$this->NOVAC;}\n \n}\n?>",var_export($response['GetCurrentExchangeRateResult']['diffgram']['ExchangeRateDataSet'],1));
$fp=fopen($_f,'ab');
if($fp&&flock($fp,LOCK_EX)){ftruncate($fp,0);fseek($fp,0);fwrite($fp,$buf);fflush($fp);fclose($fp);}else exit ();