xref: /PHP-7.3/ext/soap/tests/server026.phpt (revision 610c7fbe)
1--TEST--
2SOAP Server 26: setObject
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7class Foo {
8  function test() {
9    return "Hello World";
10  }
11}
12
13$foo = new Foo();
14$server = new soapserver(null,array('uri'=>"http://testuri.org"));
15$server->setObject($foo);
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:Body><ns1:testResponse><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
37ok
38