1<?php
2//
3// +----------------------------------------------------------------------+
4// | PHP Version 4                                                        |
5// +----------------------------------------------------------------------+
6// | Copyright (c) 1997-2018 The PHP Group                                |
7// +----------------------------------------------------------------------+
8// | This source file is subject to version 2.02 of the PHP license,      |
9// | that is bundled with this package in the file LICENSE, and is        |
10// | available through the world-wide-web at                              |
11// | http://www.php.net/license/2_02.txt.                                 |
12// | If you did not receive a copy of the PHP license and are unable to   |
13// | obtain it through the world-wide-web, please send a note to          |
14// | license@php.net so we can mail you a copy immediately.               |
15// +----------------------------------------------------------------------+
16// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
17// +----------------------------------------------------------------------+
18
19define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor');
20
21class SOAP_Test {
22    var $type = 'php';
23    var $test_name = NULL;
24    var $method_name = NULL;
25    var $method_params = NULL;
26    var $cmp_func = NULL;
27    var $expect = NULL;
28    var $expect_fault = FALSE;
29    var $headers = NULL;
30    var $headers_expect = NULL;
31    var $result = array();
32    var $show = 1;
33    var $debug = 0;
34    var $encoding = 'UTF-8';
35
36    function SOAP_Test($methodname, $params, $expect = NULL, $cmp_func = NULL) {
37        # XXX we have to do this to make php-soap happy with NULL params
38        if (!$params) $params = array();
39
40        if (strchr($methodname,'(')) {
41            preg_match('/(.*)\((.*)\)/',$methodname,$matches);
42            $this->test_name = $methodname;
43            $this->method_name = $matches[1];
44        } else {
45            $this->test_name = $this->method_name = $methodname;
46        }
47        $this->method_params = $params;
48        if ($expect !== NULL) {
49          $this->expect = $expect;
50        }
51        if ($cmp_func !== NULL) {
52          $this->cmp_func = $cmp_func;
53        }
54
55        // determine test type
56        if ($params) {
57        $v = array_values($params);
58        if (gettype($v[0]) == 'object' &&
59            (get_class($v[0]) == 'SoapVar' || get_class($v[0]) == 'SoapParam'))
60            $this->type = 'soapval';
61        }
62    }
63
64    function setResult($ok, $result, $wire, $error = '', $fault = NULL)
65    {
66        $this->result['success'] = $ok;
67        $this->result['result'] = $result;
68        $this->result['error'] = $error;
69        $this->result['wire'] = $wire;
70        $this->result['fault'] = $fault;
71    }
72
73    /**
74    *  showMethodResult
75    * print simple output about a methods result
76    *
77    * @param array endpoint_info
78    * @param string method
79    * @access public
80    */
81    function showTestResult($debug = 0, $html = 0) {
82        // debug output
83        if ($debug) $this->show = 1;
84        if ($debug) {
85            echo str_repeat("-",50).$html?"<br>\n":"\n";
86        }
87
88        echo "testing $this->test_name : ";
89
90        if ($debug) {
91            print "method params: ";
92            print_r($this->params);
93            print "\n";
94        }
95
96        $ok = $this->result['success'];
97        if ($ok) {
98            if ($html) {
99                print "<font color=\"#00cc00\">SUCCESS</font>\n";
100            } else {
101                print "SUCCESS\n";
102            }
103        } else {
104            $fault = $this->result['fault'];
105            if ($fault) {
106            		$res = $fault->faultcode;
107                $pos = strpos($res,':');
108                if ($pos !== false) {
109                	$res = substr($res,$pos+1);
110                }
111                if ($html) {
112                    print "<font color=\"#ff0000\">FAILED: [$res] {$fault->faultstring}</font>\n";
113                } else {
114                    print "FAILED: [$res] {$fault->faultstring}\n";
115                }
116            } else {
117                if ($html) {
118                    print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n";
119                } else {
120                    print "FAILED: ".$this->result['result']."\n";
121                }
122            }
123        }
124        if ($debug) {
125            if ($html) {
126                echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n";
127            } else {
128                echo "\n".htmlentities($this->result['wire'])."\n";
129            }
130        }
131    }
132}
133
134# XXX I know this isn't quite right, need to deal with this better
135function make_2d($x, $y)
136{
137    for ($_x = 0; $_x < $x; $_x++) {
138        for ($_y = 0; $_y < $y; $_y++) {
139            $a[$_x][$_y] = "x{$_x}y{$_y}";
140        }
141    }
142    return $a;
143}
144
145function soap_value($name, $value, $type, $type_name=NULL, $type_ns=NULL) {
146    return new SoapParam(new SoapVar($value,$type,$type_name,$type_ns),$name);
147}
148
149class SOAPStruct {
150    var $varString;
151    var $varInt;
152    var $varFloat;
153    function SOAPStruct($s, $i, $f) {
154        $this->varString = $s;
155        $this->varInt = $i;
156        $this->varFloat = $f;
157    }
158}
159
160//***********************************************************
161// Base echoString
162
163$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => 'hello world!'));
164$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => soap_value('inputString','hello world',XSD_STRING)));
165$soap_tests['base'][] = new SOAP_Test('echoString(empty)', array('inputString' => ''));
166$soap_tests['base'][] = new SOAP_Test('echoString(empty)', array('inputString' => soap_value('inputString','',XSD_STRING)));
167$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => NULL));
168$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => soap_value('inputString',NULL,XSD_STRING)));
169//$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => ">,<,&,\",',0:\x00",1:\x01,2:\x02,3:\x03,4:\x04,5:\x05,6:\x06,7:\x07,8:\x08,9:\x09,10:\x0a,11:\x0b,12:\x0c,13:\x0d,14:\x0e,15:\x0f,16:\x10,17:\x11,18:\x12,19:\x13,20:\x14,21:\x15,22:\x16,23:\x17,24:\x18,25:\x19,26:\x1a,27:\x1b,28:\x1c,29:\x1d,30:\x1e,31:\x1f"));
170//$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString',">,<,&,\",',0:\x00",1:\x01,2:\x02,3:\x03,4:\x04,5:\x05,6:\x06,7:\x07,8:\x08,9:\x09,10:\x0a,11:\x0b,12:\x0c,13:\x0d,14:\x0e,15:\x0f,16:\x10,17:\x11,18:\x12,19:\x13,20:\x14,21:\x15,22:\x16,23:\x17,24:\x18,25:\x19,26:\x1a,27:\x1b,28:\x1c,29:\x1d,30:\x1e,31:\x1f",XSD_STRING)));
171$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => ">,<,&,\",',\\,\n"));
172$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString',">,<,&,\",',\\,\n",XSD_STRING)));
173$test = new SOAP_Test('echoString(utf-8)', array('inputString' => utf8_encode('ỗÈéóÒ₧⅜ỗỸ')));
174$test->encoding = 'UTF-8';
175$soap_tests['base'][] = $test;
176$test = new SOAP_Test('echoString(utf-8)', array('inputString' => soap_value('inputString',utf8_encode('ỗÈéóÒ₧⅜ỗỸ'),XSD_STRING)));
177$test->encoding = 'UTF-8';
178$soap_tests['base'][] = $test;
179
180//***********************************************************
181// Base echoStringArray
182
183$soap_tests['base'][] = new SOAP_Test('echoStringArray',
184        array('inputStringArray' => array('good','bad')));
185$soap_tests['base'][] = new SOAP_Test('echoStringArray',
186        array('inputStringArray' =>
187            soap_value('inputStringArray',array('good','bad'),SOAP_ENC_ARRAY,"ArrayOfstring","http://soapinterop.org/xsd")));
188
189$soap_tests['base'][] = new SOAP_Test('echoStringArray(one)',
190        array('inputStringArray' => array('good')));
191$soap_tests['base'][] = new SOAP_Test('echoStringArray(one)',
192        array('inputStringArray' =>
193            soap_value('inputStringArray',array('good'),SOAP_ENC_ARRAY,"ArrayOfstring","http://soapinterop.org/xsd")));
194
195// empty array test
196$soap_tests['base'][] = new SOAP_Test('echoStringArray(empty)', array('inputStringArray' => array()));
197$soap_tests['base'][] = new SOAP_Test('echoStringArray(empty)', array('inputStringArray' => soap_value('inputStringArray',array(),SOAP_ENC_ARRAY,"ArrayOfstring","http://soapinterop.org/xsd")));
198
199# XXX NULL Arrays not supported
200// null array test
201$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => NULL));
202$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => soap_value('inputStringArray',NULL,SOAP_ENC_ARRAY,"ArrayOfstring","http://soapinterop.org/xsd")));
203
204//***********************************************************
205// Base echoInteger
206$x = new SOAP_Test('echoInteger', array('inputInteger' => 34345));
207$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => 34345));
208$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => soap_value('inputInteger',12345,XSD_INT)));
209
210//***********************************************************
211// Base echoIntegerArray
212
213$soap_tests['base'][] = new SOAP_Test('echoIntegerArray', array('inputIntegerArray' => array(1,234324324,2)));
214$soap_tests['base'][] = new SOAP_Test('echoIntegerArray',
215        array('inputIntegerArray' =>
216            soap_value('inputIntegerArray',
217                       array(new SoapVar(12345,XSD_INT),new SoapVar(654321,XSD_INT)),
218                    SOAP_ENC_ARRAY,"ArrayOfint","http://soapinterop.org/xsd")));
219
220//***********************************************************
221// Base echoFloat
222
223$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => 342.23));
224$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => soap_value('inputFloat',123.45,XSD_FLOAT)));
225
226//***********************************************************
227// Base echoFloatArray
228
229$soap_tests['base'][] = new SOAP_Test('echoFloatArray', array('inputFloatArray' => array(1.3223,34.2,325.325)));
230$soap_tests['base'][] = new SOAP_Test('echoFloatArray',
231        array('inputFloatArray' =>
232            soap_value('inputFloatArray',
233                       array(new SoapVar(123.45,XSD_FLOAT),new SoapVar(654.321,XSD_FLOAT)),
234                    SOAP_ENC_ARRAY,"ArrayOffloat","http://soapinterop.org/xsd")));
235//***********************************************************
236// Base echoStruct
237
238$soapstruct = new SOAPStruct('arg',34,325.325);
239# XXX no way to set a namespace!!!
240$soapsoapstruct = soap_value('inputStruct',$soapstruct,SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd");
241$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapstruct));
242$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapsoapstruct));
243
244//***********************************************************
245// Base echoStructArray
246
247$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' => array(
248        $soapstruct,$soapstruct,$soapstruct)));
249$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' =>
250         soap_value('inputStructArray',array(
251           new SoapVar($soapstruct,SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"),
252           new SoapVar($soapstruct,SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"),
253           new SoapVar($soapstruct,SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd")),
254         SOAP_ENC_ARRAY,"ArrayOfSOAPStruct","http://soapinterop.org/xsd")));
255
256
257//***********************************************************
258// Base echoVoid
259
260$soap_tests['base'][] = new SOAP_Test('echoVoid', NULL);
261$test = new SOAP_Test('echoVoid', NULL);
262$test->type = 'soapval';
263$soap_tests['base'][] = $test;
264
265//***********************************************************
266// Base echoBase64
267
268$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' => 'TmVicmFza2E='));
269$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' =>
270        soap_value('inputBase64','TmVicmFza2E=',XSD_BASE64BINARY)));
271
272//***********************************************************
273// Base echoHexBinary
274
275$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'),'736F61707834','hex_compare');
276$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' =>
277        soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)),'736F61707834','hex_compare');
278
279//***********************************************************
280// Base echoDecimal
281
282# XXX test fails because php-soap incorrectly sets decimal to long rather than float
283$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' => '12345.67890'));
284$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' =>
285        soap_value('inputDecimal','12345.67890',XSD_DECIMAL)));
286
287//***********************************************************
288// Base echoDate
289
290# php-soap doesn't handle datetime types properly yet
291$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' => '2001-05-24T17:31:41Z'), null, 'date_compare');
292$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' =>
293        soap_value('inputDate','2001-05-24T17:31:41Z',XSD_DATETIME)), null, 'date_compare');
294
295//***********************************************************
296// Base echoBoolean
297
298# php-soap sends boolean as zero or one, which is ok, but to be explicit, send true or false.
299$soap_tests['base'][] = new SOAP_Test('echoBoolean(true)', array('inputBoolean' => TRUE));
300$soap_tests['base'][] = new SOAP_Test('echoBoolean(true)', array('inputBoolean' =>
301        soap_value('inputBoolean',TRUE,XSD_BOOLEAN)));
302$soap_tests['base'][] = new SOAP_Test('echoBoolean(false)', array('inputBoolean' => FALSE));
303$soap_tests['base'][] = new SOAP_Test('echoBoolean(false)', array('inputBoolean' =>
304        soap_value('inputBoolean',FALSE,XSD_BOOLEAN)));
305$soap_tests['base'][] = new SOAP_Test('echoBoolean(1)', array('inputBoolean' => 1),true);
306$soap_tests['base'][] = new SOAP_Test('echoBoolean(1)', array('inputBoolean' =>
307        soap_value('inputBoolean',1,XSD_BOOLEAN)),true);
308$soap_tests['base'][] = new SOAP_Test('echoBoolean(0)', array('inputBoolean' => 0),false);
309$soap_tests['base'][] = new SOAP_Test('echoBoolean(0)', array('inputBoolean' =>
310        soap_value('inputBoolean',0,XSD_BOOLEAN)),false);
311
312
313
314//***********************************************************
315// GROUP B
316
317
318//***********************************************************
319// GroupB echoStructAsSimpleTypes
320
321$expect = array(
322        'outputString'=>'arg',
323        'outputInteger'=>34,
324        'outputFloat'=>325.325
325    );
326$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
327    array('inputStruct' => (object)array(
328        'varString'=>'arg',
329        'varInt'=>34,
330        'varFloat'=>325.325
331    )), $expect);
332$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
333    array('inputStruct' =>
334          soap_value('inputStruct',
335            (object)array('varString' => 'arg',
336                					'varInt'    => 34,
337                          'varFloat'  => 325.325
338            ), SOAP_ENC_OBJECT, "SOAPStruct","http://soapinterop.org/xsd")), $expect);
339
340//***********************************************************
341// GroupB echoSimpleTypesAsStruct
342
343$expect =
344    (object)array(
345        'varString'=>'arg',
346        'varInt'=>34,
347        'varFloat'=>325.325
348    );
349$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
350    array(
351        'inputString'=>'arg',
352        'inputInteger'=>34,
353        'inputFloat'=>325.325
354    ), $expect);
355$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
356    array(
357        soap_value('inputString','arg', XSD_STRING),
358        soap_value('inputInteger',34, XSD_INT),
359        soap_value('inputFloat',325.325, XSD_FLOAT)
360    ), $expect);
361
362//***********************************************************
363// GroupB echo2DStringArray
364
365$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
366    array('input2DStringArray' => make_2d(3,3)));
367
368$multidimarray =
369    soap_value('input2DStringArray',
370        array(
371            array('row0col0', 'row0col1', 'row0col2'),
372            array('row1col0', 'row1col1', 'row1col2')
373        ), SOAP_ENC_ARRAY
374    );
375//$multidimarray->options['flatten'] = TRUE;
376$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
377    array('input2DStringArray' => $multidimarray));
378
379//***********************************************************
380// GroupB echoNestedStruct
381
382$strstr = (object)array(
383        'varString'=>'arg',
384        'varInt'=>34,
385        'varFloat'=>325.325,
386        'varStruct' => (object)array(
387            'varString'=>'arg',
388            'varInt'=>34,
389            'varFloat'=>325.325
390        ));
391$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
392    array('inputStruct' => $strstr));
393$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
394    array('inputStruct' =>
395        soap_value('inputStruct',
396						(object)array(
397				        'varString'=>'arg',
398        				'varInt'=>34,
399				        'varFloat'=>325.325,
400        				'varStruct' => new SoapVar((object)array(
401				            'varString'=>'arg',
402        				    'varInt'=>34,
403				            'varFloat'=>325.325
404        				), SOAP_ENC_OBJECT, "SOAPStruct","http://soapinterop.org/xsd")
405            ), SOAP_ENC_OBJECT, "SOAPStructStruct","http://soapinterop.org/xsd"
406        )),$strstr);
407
408//***********************************************************
409// GroupB echoNestedArray
410
411$arrstr = (object)array(
412        'varString'=>'arg',
413        'varInt'=>34,
414        'varFloat'=>325.325,
415        'varArray' => array('red','blue','green')
416    );
417$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
418    array('inputStruct' => $arrstr));
419$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
420    array('inputStruct' =>
421        soap_value('inputStruct',
422            (object)array('varString' => 'arg',
423                          'varInt'    => 34,
424                          'varFloat'  => 325.325,
425                          'varArray'  =>
426                    new SoapVar(array("red", "blue", "green"), SOAP_ENC_ARRAY, "ArrayOfstring","http://soapinterop.org/xsd")
427                ), SOAP_ENC_OBJECT, "SOAPArrayStruct","http://soapinterop.org/xsd"
428        )),$arrstr);
429
430
431//***********************************************************
432// GROUP C header tests
433
434//***********************************************************
435// echoMeStringRequest
436
437// echoMeStringRequest with endpoint as header destination, doesn't have to understand
438$test = new SOAP_Test('echoVoid(echoMeStringRequest mustUnderstand=0 actor=next)', NULL);
439$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStringRequest', 'hello world', 0, SOAP_ACTOR_NEXT);
440$test->headers_expect = array('echoMeStringResponse'=>'hello world');
441$soap_tests['GroupC'][] = $test;
442
443$test = new SOAP_Test('echoVoid(echoMeStringRequest mustUnderstand=0 actor=next)', NULL);
444$test->type = 'soapval';
445$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStringRequest', new SoapVar('hello world',XSD_STRING), 0, SOAP_ACTOR_NEXT);
446$test->headers_expect = array('echoMeStringResponse'=>'hello world');
447$soap_tests['GroupC'][] = $test;
448
449// echoMeStringRequest with endpoint as header destination, must understand
450$test = new SOAP_Test('echoVoid(echoMeStringRequest mustUnderstand=1 actor=next)', NULL);
451$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStringRequest', 'hello world', 1, SOAP_ACTOR_NEXT);
452$test->headers_expect = array('echoMeStringResponse'=>'hello world');
453$soap_tests['GroupC'][] = $test;
454
455$test = new SOAP_Test('echoVoid(echoMeStringRequest mustUnderstand=1 actor=next)', NULL);
456$test->type = 'soapval';
457$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStringRequest', new SoapVar('hello world',XSD_STRING), 1, SOAP_ACTOR_NEXT);
458$test->headers_expect = array('echoMeStringResponse'=>'hello world');
459$soap_tests['GroupC'][] = $test;
460
461// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
462$test = new SOAP_Test('echoVoid(echoMeStringRequest mustUnderstand=0 actor=other)', NULL);
463$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStringRequest', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
464$test->headers_expect = array();
465$soap_tests['GroupC'][] = $test;
466
467$test = new SOAP_Test('echoVoid(echoMeStringRequest mustUnderstand=0 actor=other)', NULL);
468$test->type = 'soapval';
469$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStringRequest', new SoapVar('hello world',XSD_STRING), 0, SOAP_TEST_ACTOR_OTHER);
470$test->headers_expect = array();
471$soap_tests['GroupC'][] = $test;
472
473// echoMeStringRequest with endpoint NOT header destination, must understand
474$test = new SOAP_Test('echoVoid(echoMeStringRequest mustUnderstand=1 actor=other)', NULL);
475$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStringRequest', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
476$test->headers_expect = array();
477$soap_tests['GroupC'][] = $test;
478
479$test = new SOAP_Test('echoVoid(echoMeStringRequest mustUnderstand=1 actor=other)', NULL);
480$test->type = 'soapval';
481$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStringRequest', new SoapVar('hello world', XSD_STRING), 1, SOAP_TEST_ACTOR_OTHER);
482$test->headers_expect = array();
483$soap_tests['GroupC'][] = $test;
484
485// echoMeStringRequest with endpoint header destination, must understand,
486// invalid namespace, should receive a fault
487$test = new SOAP_Test('echoVoid(echoMeStringRequest invalid namespace)', NULL);
488$test->headers[] = new SoapHeader('http://unknown.org/echoheader/','echoMeStringRequest', 'hello world', 1, SOAP_ACTOR_NEXT);
489$test->headers_expect = array();
490$test->expect_fault = TRUE;
491$soap_tests['GroupC'][] = $test;
492
493$test = new SOAP_Test('echoVoid(echoMeStringRequest invalid namespace)', NULL);
494$test->type = 'soapval';
495$test->headers[] = new SoapHeader('http://unknown.org/echoheader/','echoMeStringRequest', new SoapVar('hello world', XSD_STRING), 1, SOAP_ACTOR_NEXT);
496$test->headers_expect = array();
497$test->expect_fault = TRUE;
498$soap_tests['GroupC'][] = $test;
499
500//***********************************************************
501// echoMeStructRequest
502
503// echoMeStructRequest with endpoint as header destination, doesn't have to understand
504$test = new SOAP_Test('echoVoid(echoMeStructRequest mustUnderstand=0 actor=next)', NULL);
505$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStructRequest',
506        new SOAPStruct('arg',34,325.325), 0, SOAP_ACTOR_NEXT);
507$test->headers_expect =
508    array('echoMeStructResponse'=> (object)array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
509$soap_tests['GroupC'][] = $test;
510
511$test = new SOAP_Test('echoVoid(echoMeStructRequest mustUnderstand=0 actor=next)', NULL);
512$test->type = 'soapval';
513$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStructRequest',
514            new SoapVar(new SOAPStruct('arg',34,325.325),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"),
515            0, SOAP_ACTOR_NEXT);
516$test->headers_expect =
517    array('echoMeStructResponse'=> (object)array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
518$soap_tests['GroupC'][] = $test;
519
520// echoMeStructRequest with endpoint as header destination, must understand
521$test = new SOAP_Test('echoVoid(echoMeStructRequest mustUnderstand=1 actor=next)', NULL);
522$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStructRequest',
523        new SOAPStruct('arg',34,325.325), 1, SOAP_ACTOR_NEXT);
524$test->headers_expect =
525    array('echoMeStructResponse'=> (object)array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
526$soap_tests['GroupC'][] = $test;
527
528$test = new SOAP_Test('echoVoid(echoMeStructRequest mustUnderstand=1 actor=next)', NULL);
529$test->type = 'soapval';
530$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStructRequest',
531            new SoapVar(new SOAPStruct('arg',34,325.325),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"),
532            1, SOAP_ACTOR_NEXT);
533$test->headers_expect =
534    array('echoMeStructResponse'=> (object)array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
535$soap_tests['GroupC'][] = $test;
536
537// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
538$test = new SOAP_Test('echoVoid(echoMeStructRequest mustUnderstand=0 actor=other)', NULL);
539$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStructRequest',
540        new SOAPStruct('arg',34,325.325), 0, SOAP_TEST_ACTOR_OTHER);
541$test->headers_expect = array();
542$soap_tests['GroupC'][] = $test;
543
544$test = new SOAP_Test('echoVoid(echoMeStructRequest mustUnderstand=0 actor=other)', NULL);
545$test->type = 'soapval';
546$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStructRequest',
547            new SoapVar(new SOAPStruct('arg',34,325.325),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"),
548            0, SOAP_TEST_ACTOR_OTHER);
549$test->headers_expect = array();
550$soap_tests['GroupC'][] = $test;
551
552// echoMeStructRequest with endpoint NOT header destination, must understand
553$test = new SOAP_Test('echoVoid(echoMeStructRequest mustUnderstand=1 actor=other)', NULL);
554$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStructRequest',
555        new SOAPStruct('arg',34,325.325), 1, SOAP_TEST_ACTOR_OTHER);
556$test->headers_expect = array();
557$soap_tests['GroupC'][] = $test;
558
559$test = new SOAP_Test('echoVoid(echoMeStructRequest mustUnderstand=1 actor=other)', NULL);
560$test->type = 'soapval';
561$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeStructRequest',
562            new SoapVar(new SOAPStruct('arg',34,325.325),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"),
563            1, SOAP_TEST_ACTOR_OTHER);
564$test->headers_expect = array();
565$soap_tests['GroupC'][] = $test;
566
567//***********************************************************
568// echoMeUnknown
569
570// echoMeUnknown with endpoint as header destination, doesn't have to understand
571$test = new SOAP_Test('echoVoid(echoMeUnknown mustUnderstand=0 actor=next)', NULL);
572$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeUnknown', 'nobody understands me!',0,SOAP_ACTOR_NEXT);
573$test->headers_expect = array();
574$soap_tests['GroupC'][] = $test;
575
576$test = new SOAP_Test('echoVoid(echoMeUnknown mustUnderstand=0 actor=next)', NULL);
577$test->type = 'soapval';
578$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeUnknown', new SoapVar('nobody understands me!',XSD_STRING),0,SOAP_ACTOR_NEXT);
579$test->headers_expect = array();
580$soap_tests['GroupC'][] = $test;
581
582// echoMeUnknown with endpoint as header destination, must understand
583$test = new SOAP_Test('echoVoid(echoMeUnknown mustUnderstand=1 actor=next)', NULL);
584$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeUnknown', 'nobody understands me!',1,SOAP_ACTOR_NEXT);
585$test->headers_expect = array();
586$test->expect_fault = TRUE;
587$soap_tests['GroupC'][] = $test;
588
589$test = new SOAP_Test('echoVoid(echoMeUnknown mustUnderstand=1 actor=next)', NULL);
590$test->type = 'soapval';
591$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeUnknown', new SoapVar('nobody understands me!',XSD_STRING),1,SOAP_ACTOR_NEXT);
592$test->headers_expect = array();
593$test->expect_fault = TRUE;
594$soap_tests['GroupC'][] = $test;
595
596// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
597$test = new SOAP_Test('echoVoid(echoMeUnknown mustUnderstand=0 actor=other)', NULL);
598$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeUnknown', 'nobody understands me!',0,SOAP_TEST_ACTOR_OTHER);
599$test->headers_expect = array();
600$soap_tests['GroupC'][] = $test;
601
602$test = new SOAP_Test('echoVoid(echoMeUnknown mustUnderstand=0 actor=other)', NULL);
603$test->type = 'soapval';
604$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeUnknown', new SoapVar('nobody understands me!',XSD_STRING),0,SOAP_TEST_ACTOR_OTHER);
605$test->headers_expect = array();
606$soap_tests['GroupC'][] = $test;
607
608// echoMeUnknown with endpoint NOT header destination, must understand
609$test = new SOAP_Test('echoVoid(echoMeUnknown mustUnderstand=1 actor=other)', NULL);
610$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeUnknown', 'nobody understands me!',1,SOAP_TEST_ACTOR_OTHER);
611$test->headers_expect = array();
612$soap_tests['GroupC'][] = $test;
613
614$test = new SOAP_Test('echoVoid(echoMeUnknown mustUnderstand=1 actor=other)', NULL);
615$test->type = 'soapval';
616$test->headers[] = new SoapHeader('http://soapinterop.org/echoheader/','echoMeUnknown', new SoapVar('nobody understands me!',XSD_STRING),1,SOAP_TEST_ACTOR_OTHER);
617$test->headers_expect = array();
618$soap_tests['GroupC'][] = $test;
619?>
620