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