xref: /PHP-7.4/ext/soap/tests/server016.phpt (revision 9b661ea6)
1--TEST--
2SOAP Server 16: user fault
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7function test() {
8	global $server;
9	$server->fault("MyFault","My fault string");
10}
11
12$server = new soapserver(null,array('uri'=>"http://testuri.org"));
13$server->addfunction("test");
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:test xmlns:ns1="http://testuri.org"/>
25  </SOAP-ENV:Body>
26</SOAP-ENV:Envelope>
27EOF;
28
29$server->handle($HTTP_RAW_POST_DATA);
30echo "ok\n";
31?>
32--EXPECT--
33<?xml version="1.0" encoding="UTF-8"?>
34<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>MyFault</faultcode><faultstring>My fault string</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
35