xref: /PHP-7.3/ext/soap/tests/server002.phpt (revision 9b661ea6)
1--TEST--
2SOAP Server 2: function with parameters and result
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7function Add($x,$y) {
8  return $x+$y;
9}
10
11$server = new soapserver(null,array('uri'=>"http://testuri.org"));
12$server->addfunction("Add");
13
14$HTTP_RAW_POST_DATA = <<<EOF
15<?xml version="1.0" encoding="ISO-8859-1"?>
16<SOAP-ENV:Envelope
17  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
18  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
19  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
20  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21  xmlns:si="http://soapinterop.org/xsd">
22  <SOAP-ENV:Body>
23    <ns1:Add xmlns:ns1="http://testuri.org">
24      <x xsi:type="xsd:int">22</x>
25      <y xsi:type="xsd:int">33</y>
26    </ns1:Add>
27  </SOAP-ENV:Body>
28</SOAP-ENV:Envelope>
29EOF;
30
31$server->handle($HTTP_RAW_POST_DATA);
32echo "ok\n";
33?>
34--EXPECT--
35<?xml version="1.0" encoding="UTF-8"?>
36<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:AddResponse><return xsi:type="xsd:int">55</return></ns1:AddResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
37ok
38