xref: /PHP-7.0/ext/soap/tests/server023.phpt (revision 610c7fbe)
1--TEST--
2SOAP Server 23: Send SOAP headers those were not received
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7function test() {
8	global $server;
9	$server->addSoapHeader(new SoapHeader("http://testuri.org", "Test1", "Hello Header!"));
10	$server->addSoapHeader(new SoapHeader("http://testuri.org", "Test2", "Hello Header!"));
11	return "Hello Body!";
12}
13
14$server = new soapserver(null,array('uri'=>"http://testuri.org"));
15$server->addfunction("test");
16
17$HTTP_RAW_POST_DATA = <<<EOF
18<?xml version="1.0" encoding="ISO-8859-1"?>
19<SOAP-ENV:Envelope
20  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
21  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
22  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
23  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24  xmlns:si="http://soapinterop.org/xsd">
25  <SOAP-ENV:Body>
26    <ns1:test xmlns:ns1="http://testuri.org"/>
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:Header><ns1:Test1>Hello Header!</ns1:Test1><ns1:Test2>Hello Header!</ns1:Test2></SOAP-ENV:Header><SOAP-ENV:Body><ns1:testResponse><return xsi:type="xsd:string">Hello Body!</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
37ok
38