-
-
Save xaoc-303/ff9cadc71ad09818ea89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $request = <<<EOS | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <soap:Envelope | |
| xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" | |
| xmlns:ns1="http://schemas.example.com" | |
| xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> | |
| <soap:Body> | |
| <ns1:add> | |
| <param0 xsi:type="xsd:int">3</param0> | |
| <param1 xsi:type="xsd:int">4</param1> | |
| </ns1:add> | |
| </soap:Body> | |
| </soap:Envelope> | |
| EOS; | |
| function fromXml($xml) { | |
| // works fine if only thrown for second param: | |
| // if ('4' === strip_tags($xml)) | |
| throw new SoapFault('Server', 'Conversion Fault'); | |
| } | |
| function toXml() {} | |
| function add($x, $y) {} | |
| $server = new SoapServer(null, array( | |
| 'uri' => 'http://schemas.example.com', | |
| 'typemap' => array(array( | |
| 'type_name' => 'int', | |
| 'type_ns' => 'http://www.w3.org/2001/XMLSchema', | |
| 'from_xml' => 'fromXml', | |
| 'to_xml' => 'toXml', | |
| )) | |
| )); | |
| $server->addFunction('add'); | |
| $server->handle($request); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment