@@ 29-67 (lines=39) @@ | ||
26 | $server->setObject(new DocumentLiteralWrapper(new SimpleSoapServer())); |
|
27 | $server->handle(); |
|
28 | ||
29 | class SimpleSoapServer |
|
30 | { |
|
31 | /** |
|
32 | * @WebMethod |
|
33 | * @param string $name |
|
34 | * @param int $age |
|
35 | * @return string $nameWithAge |
|
36 | */ |
|
37 | public function getNameWithAge($name, $age) |
|
38 | { |
|
39 | return 'Your name is: ' . $name . ' and you have ' . $age . ' years old'; |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * @WebMethod |
|
44 | * @param string[] $names |
|
45 | * @return string $userNames |
|
46 | */ |
|
47 | public function getNameForUsers($names) |
|
48 | { |
|
49 | //FIXME correct array of $names |
|
50 | return 'User names: ' . implode(', ', $names); |
|
51 | } |
|
52 | ||
53 | /** |
|
54 | * @WebMethod |
|
55 | * @param int $max |
|
56 | * @return string[] $count |
|
57 | */ |
|
58 | public function countTo($max) |
|
59 | { |
|
60 | //FIXME incorrect structure of response |
|
61 | $array = array(); |
|
62 | for ($i = 0; $i < $max; $i++) { |
|
63 | $array[] = 'Number: ' . ($i + 1); |
|
64 | } |
|
65 | return $array; |
|
66 | } |
|
67 | } |
@@ 28-64 (lines=37) @@ | ||
25 | $server->setClass('SimpleSoapServer'); |
|
26 | $server->handle(); |
|
27 | ||
28 | class SimpleSoapServer |
|
29 | { |
|
30 | /** |
|
31 | * @WebMethod |
|
32 | * @param string $name |
|
33 | * @param int $age |
|
34 | * @return string $nameWithAge |
|
35 | */ |
|
36 | public function getNameWithAge($name, $age) |
|
37 | { |
|
38 | return 'Your name is: ' . $name . ' and you have ' . $age . ' years old'; |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * @WebMethod |
|
43 | * @param string[] $names |
|
44 | * @return string $userNames |
|
45 | */ |
|
46 | public function getNameForUsers($names) |
|
47 | { |
|
48 | return 'User names: ' . implode(', ', $names); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * @WebMethod |
|
53 | * @param int $max |
|
54 | * @return string[] $count |
|
55 | */ |
|
56 | public function countTo($max) |
|
57 | { |
|
58 | $array = array(); |
|
59 | for ($i = 0; $i < $max; $i++) { |
|
60 | $array[] = 'Number: ' . ($i + 1); |
|
61 | } |
|
62 | return $array; |
|
63 | } |
|
64 | } |
@@ 27-63 (lines=37) @@ | ||
24 | $server->setClass('SimpleSoapServer'); |
|
25 | $server->handle(); |
|
26 | ||
27 | class SimpleSoapServer |
|
28 | { |
|
29 | /** |
|
30 | * @WebMethod |
|
31 | * @param string $name |
|
32 | * @param int $age |
|
33 | * @return string $nameWithAge |
|
34 | */ |
|
35 | public function getNameWithAge($name, $age) |
|
36 | { |
|
37 | return 'Your name is: ' . $name . ' and you have ' . $age . ' years old'; |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * @WebMethod |
|
42 | * @param string[] $names |
|
43 | * @return string $userNames |
|
44 | */ |
|
45 | public function getNameForUsers($names) |
|
46 | { |
|
47 | return 'User names: ' . implode(', ', $names); |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @WebMethod |
|
52 | * @param int $max |
|
53 | * @return string[] $count |
|
54 | */ |
|
55 | public function countTo($max) |
|
56 | { |
|
57 | $array = array(); |
|
58 | for ($i = 0; $i < $max; $i++) { |
|
59 | $array[] = 'Number: ' . ($i + 1); |
|
60 | } |
|
61 | return $array; |
|
62 | } |
|
63 | } |