-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.php
More file actions
41 lines (34 loc) · 1.18 KB
/
client.php
File metadata and controls
41 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
ini_set("soap.wsdl_cache_enabled", "0");
$wsdlUrl = "http://localhost/soaptest/service.php?wsdl";
try {
$client = new SoapClient($wsdlUrl, [
'trace' => true,
'exceptions' => true
]);
$response = $client->__soapCall('GetBookList', array(
"request" =>
array(
"username" => "akartals",
"password" => "123456",
"type" => "roman"
)
));
if (isset($response->result)) {
$xml = simplexml_load_string(data: $response->result);
echo "Kitap listesi:<br/>";
foreach ($xml->kitap as $kitap) {
echo "Isim: " . (string) $kitap->kitapIsim . ", ID: " . (string) $kitap->kitapId . "<br/>";
}
} else {
echo "Error: " . $response->error . "<br/>";
}
} catch (SoapFault $fault) {
echo "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})<br/>";
echo "Request :\n" . $client->__getLastRequest() . "<br/>";
echo "Response:\n" . $client->__getLastResponse() . "<br/>";
echo "ErrorLine:\n " . $fault->getLine();
} catch (Exception $ex) {
echo "Bir hata olustu: " . $ex->getMessage() . "<br/>";
}
?>