xref: /php-src/ext/soap/tests/server010.phpt (revision 7f2f0c00)
1--TEST--
2SOAP Server 10: setclass and setpersistence(SOAP_PERSISTENCE_REQUEST)
3--EXTENSIONS--
4soap
5--FILE--
6<?php
7class foo {
8  private $sum = 0;
9
10  function Sum($num) {
11    return $this->sum += $num;
12  }
13}
14
15$server = new soapserver(null,array('uri'=>"http://testuri.org"));
16$server->setclass("foo");
17$server->setpersistence(SOAP_PERSISTENCE_REQUEST);
18
19
20ob_start();
21$HTTP_RAW_POST_DATA = <<<EOF
22<?xml version="1.0" encoding="ISO-8859-1"?>
23<SOAP-ENV:Envelope
24  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
25  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
26  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
27  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
28  xmlns:si="http://soapinterop.org/xsd">
29  <SOAP-ENV:Body>
30    <ns1:Sum xmlns:ns1="http://testuri.org">
31      <num xsi:type="xsd:int">5</num>
32    </ns1:Sum>
33  </SOAP-ENV:Body>
34</SOAP-ENV:Envelope>
35EOF;
36$server->handle($HTTP_RAW_POST_DATA);
37ob_clean();
38
39$HTTP_RAW_POST_DATA = <<<EOF
40<?xml version="1.0" encoding="ISO-8859-1"?>
41<SOAP-ENV:Envelope
42  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
43  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
44  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
45  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
46  xmlns:si="http://soapinterop.org/xsd">
47  <SOAP-ENV:Body>
48    <ns1:Sum xmlns:ns1="http://testuri.org">
49      <num xsi:type="xsd:int">3</num>
50    </ns1:Sum>
51  </SOAP-ENV:Body>
52</SOAP-ENV:Envelope>
53EOF;
54$server->handle($HTTP_RAW_POST_DATA);
55ob_end_flush();
56echo "ok\n";
57?>
58--EXPECT--
59<?xml version="1.0" encoding="UTF-8"?>
60<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:SumResponse><return xsi:type="xsd:int">3</return></ns1:SumResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
61ok
62