xref: /PHP-8.3/ext/soap/tests/bugs/bug36908.phpt (revision 7f2f0c00)
1--TEST--
2Bug #36908 (wsdl default value overrides value in soap request)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9class PublisherService {
10  function add($publisher) {
11    return $publisher->region_id;
12  }
13}
14$input =
15'<?xml version="1.0" encoding="UTF-8"?>
16<soapenv:Envelope
17xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
18xmlns:xsd="http://www.w3.org/2001/XMLSchema"
19xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
20  <soapenv:Body>
21    <ns1:add xmlns:ns1="urn:PublisherService" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
22      <publisher href="#id0"/>
23    </ns1:add>
24    <multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
25xmlns:ns3="http://soap.dev/soap/types" id="id0" soapenc:root="0"
26soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
27xsi:type="ns3:publisher">
28      <region_id href="#id5"/>
29    </multiRef>
30    <multiRef xmlns:ns5="http://soap.dev/soap/types"
31xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" id="id5"
32soapenc:root="0"
33soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
34xsi:type="xsd:long">9</multiRef>
35  </soapenv:Body>
36</soapenv:Envelope>';
37ini_set('soap.wsdl_cache_enabled', false);
38$server = new SoapServer(__DIR__."/bug36908.wsdl");
39$server->setClass("PublisherService");
40$server->handle($input);
41?>
42--EXPECT--
43<?xml version="1.0" encoding="UTF-8"?>
44<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:PublisherService" 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><out xsi:type="xsd:string">9</out></ns1:addResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
45