xref: /PHP-7.1/ext/soap/tests/soap12/soap12-test.inc (revision ff363e2e)
1<?php
2class Soap12test {
3	public $header;
4
5	function echoOk($x) {
6  	return $x;
7	}
8
9	function echoString($inputString) {
10		return $inputString;
11	}
12
13	function echoStringArray($inputStringArray) {
14		return $inputStringArray;
15	}
16
17	function echoInteger($inputInteger) {
18		return $inputInteger;
19	}
20
21	function echoIntegerArray($inputIntegerArray) {
22		return $inputIntegerArray;
23	}
24
25	function echoFloat($inputFloat) {
26		return $inputFloat;
27	}
28
29	function echoFloatArray($inputFloatArray) {
30		return $inputFloatArray;
31  }
32
33	function echoStruct($x) {
34  	return $x;
35	}
36
37	function echoStructArray($x) {
38  	return $x;
39	}
40
41	function echoVoid() {
42		return NULL;
43	}
44
45	function echoBase64($b_encoded) {
46		return $b_encoded;
47  }
48
49	function echoDate($timeInstant) {
50		return $timeInstant;
51	}
52
53	function echoHexBinary($hb) {
54		return $hb;
55	}
56
57	function echoDecimal($dec) {
58		return $dec;
59	}
60
61	function echoBoolean($boolean) {
62		return $boolean;
63	}
64
65	function echoStructAsSimpleTypes ($struct) {
66		 return array('outputString'  => $struct->varString,
67		              'outputInteger' => $struct->varInt,
68		              'outputFloat'   => $struct->varFloat);
69	}
70
71	function echoSimpleTypesAsStruct($string, $int, $float) {
72		return (object)array("varString" => $string,
73		 										 "varInt"    => $int,
74	  										 "varFloat"  => $float);
75	}
76
77	function echoNestedStruct($struct) {
78		return $struct;
79	}
80
81	function echo2DStringArray($ary) {
82		return $ary;
83	}
84
85	function echoNestedArray($ary) {
86		return $ary;
87	}
88
89	function countItems($input) {
90		return count($input);
91	}
92
93	function isNil($input=NULL) {
94		return is_null($input);
95	}
96
97	function returnVoid() {
98	}
99
100	function emptyBody() {
101	}
102
103	function requiredHeader($x) {
104		$this->header = $x;
105	}
106
107	function echoHeader() {
108	  return $this->header;
109	}
110
111	function echoResolvedRef($ref) {
112	  return $ref->RelativeReference->base.$ref->RelativeReference->href;
113	}
114
115	function validateCountryCode($code) {
116		if (strlen($code) != 2) {
117		  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."));
118		} else {
119			return "OK";
120		}
121	}
122
123}
124
125ini_set("soap.wsdl_cache_enabled",0);
126$server = new soapserver(dirname(__FILE__)."/soap12-test.wsdl", array('soap_version'=>SOAP_1_2,'actor'=>"http://example.org/ts-tests/C"));
127$server->setClass("Soap12test");
128
129$server->handle($HTTP_RAW_POST_DATA);
130echo "ok\n";
131?>
132