summaryrefslogtreecommitdiff
path: root/ext/soap/tests/soap12/soap12-test.inc
blob: 9774729d292ac6be23ff1075a405f466ed3ce178 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
class Soap12test {
	public $header;

	function echoOk($x) {
  	return $x;
	}

	function echoString($inputString) {
		return $inputString;
	}

	function echoStringArray($inputStringArray) {
		return $inputStringArray;
	}

	function echoInteger($inputInteger) {
		return $inputInteger;
	}

	function echoIntegerArray($inputIntegerArray) {
		return $inputIntegerArray;
	}

	function echoFloat($inputFloat) {
		return $inputFloat;
	}

	function echoFloatArray($inputFloatArray) {
		return $inputFloatArray;
  }

	function echoStruct($x) {
  	return $x;
	}

	function echoStructArray($x) {
  	return $x;
	}

	function echoVoid() {
		return NULL;
	}

	function echoBase64($b_encoded) {
		return $b_encoded;
  }

	function echoDate($timeInstant) {
		return $timeInstant;
	}

	function echoHexBinary($hb) {
		return $hb;
	}

	function echoDecimal($dec) {
		return $dec;
	}

	function echoBoolean($boolean) {
		return $boolean;
	}

	function echoStructAsSimpleTypes ($struct) {
		 return array('outputString'  => $struct->varString,
		              'outputInteger' => $struct->varInt,
		              'outputFloat'   => $struct->varFloat);
	}

	function echoSimpleTypesAsStruct($string, $int, $float) {
		return (object)array("varString" => $string,
		 										 "varInt"    => $int,
	  										 "varFloat"  => $float);
	}

	function echoNestedStruct($struct) {
		return $struct;
	}

	function echo2DStringArray($ary) {
		return $ary;
	}

	function echoNestedArray($ary) {
		return $ary;
	}

	function countItems($input) {
		return count($input);
	}

	function isNil($input) {
		return is_null($input);
	}

	function returnVoid() {
	}

	function emptyBody() {
	}

	function requiredHeader($x) {
		$this->header = $x;
	}

	function echoHeader() {
	  return $this->header;
	}

	function echoResolvedRef($ref) {
	  return $ref->RelativeReference->base.$ref->RelativeReference->href;
	}

	function validateCountryCode($code) {
		if (strlen($code) != 2) {
		  return new SoapFault("Client", "Not a valid country code", NULL, NULL, NULL, new SoapHeader("http://example.org/ts-tests", "validateCountryCodeFault", "Country code must be 2 letters."));
		} else {
			return "OK";
		}
	}

}

$server = new soapserver(dirname(__FILE__)."/soap12-test.wsdl", array('soap_version'=>SOAP_1_2,'actor'=>"http://example.org/ts-tests/C"));
$server->setClass("Soap12test");

$server->handle();
echo "ok\n";
?>