6 This file is part of, or distributed with, libXMLRPC - a C library for
7 xml-encoded function calls.
9 Author: Dan Libby (dan@libby.com)
10 Epinions.com may be contacted at feedback@epinions-inc.com
14 Copyright 2001 Epinions, Inc.
16 Subject to the following 3 conditions, Epinions, Inc. permits you, free
17 of charge, to (a) use, copy, distribute, modify, perform and display this
18 software and associated documentation files (the "Software"), and (b)
19 permit others to whom the Software is furnished to do so as well.
21 1) The above copyright notice and this permission notice shall be included
22 without modification in all copies or substantial portions of the
25 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
26 ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
27 IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
28 PURPOSE OR NONINFRINGEMENT.
30 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
31 SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
32 OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
33 NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
39 include 'xmlrpc_utils.php';
41 // ensure extension is loaded.
44 function do_test_case($title, $desc, $xml) {
46 $desc = "<p>$desc</p>";
51 <h3>Enter your xmlrpc query</h3>
52 <form method="get" action="validate.php">
53 <textarea rows='20' cols='80' name='xml'>
58 <input type='text' name='encoding' value='iso-8859-1'>
61 <b>output type</b><br>
62 <input type='radio' name='output_type' value='xml' checked>xml
63 <input type='radio' name='output_type' value='php'>php
66 <i>These options apply to xml output type only.</i><br>
68 <b>output version</b><br>
69 <input type='radio' name='version' value='xmlrpc' checked>xmlrpc
70 <input type='radio' name='version' value='simple'>simple
73 <b>output verbosity</b><br>
74 <input type='radio' name='verbosity' value='pretty' checked>pretty
75 <input type='radio' name='verbosity' value='newlines_only'>newlines only
76 <input type='radio' name='verbosity' value='no_white_space'>no white space
79 <b>output escaping</b><br>
80 <input type='checkbox' name='escaping[]' value='markup' checked>markup
81 <input type='checkbox' name='escaping[]' value='cdata'>cdata
82 <input type='checkbox' name='escaping[]' value='non-ascii'>non-ascii
83 <input type='checkbox' name='escaping[]' value='non-print'>non-print
86 <input type='submit' value="Get your fresh hot xmlrpc!">
87 <input type='hidden' name='disp' value='html'>
96 title => "custom user input",
97 desc => "Enter your own xml here if you have a specific xmlrpc query you would like to perform.",
100 title => "arrayOfStructsTest",
102 "This handler takes a single parameter, an array of structs, each of which contains at least three elements
103 named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and
106 "<?xml version='1.0'?>
108 <!-- expected answer = -166 -->
109 <methodName>validator1.arrayOfStructsTest</methodName>
297 title => "countTheEntities",
298 desc => "This handler takes a single parameter, a string, that contains any number of predefined entities, namely <,
301 Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets,
302 ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.
304 To validate, the numbers must be correct",
306 "<?xml version='1.0'?>
308 <methodName>validator1.countTheEntities</methodName>
311 <value>b&amp;htj&gt;q&lt;e&gt;ow&lt;&gt;&lt;a&quot;&gt;&quot;&gt;m&amp;&lt;y&gt;&gt;g&lt;&quot;kf&amp;nup&gt;&amp;lsz&amp;lt;xi&amp;d&quot;&lt;&apos;crv&lt;</value>
316 title => "easyStructTest",
317 desc => "This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.",
319 "<?xml version='1.0'?>
321 <methodName>validator1.easyStructTest</methodName>
348 title => "echoStructTest",
349 desc => "This handler takes a single parameter, a struct. Your handler must return the struct.",
351 "<?xml version='1.0'?>
353 <methodName>validator1.echoStructTest</methodName>
358 <name>substruct0</name>
383 <name>substruct1</name>
408 <name>substruct2</name>
433 <name>substruct3</name>
458 <name>substruct4</name>
483 <name>substruct5</name>
508 <name>substruct6</name>
533 <name>substruct7</name>
558 <name>substruct8</name>
583 <name>substruct9</name>
612 title => "manyTypesTest",
613 desc => "This handler takes six parameters, and returns an array containing all the parameters.",
615 "<?xml version='1.0'?>
617 <methodName>validator1.manyTypesTest</methodName>
620 <value><i4>24288</i4></value>
623 <value><boolean>0</boolean></value>
629 <value><double>1762.0</double></value>
632 <value><dateTime.iso8601>19040101T05:24:54</dateTime.iso8601></value>
635 <value><base64>R0lGODlhFgASAJEAAP/////OnM7O/wAAACH5BAEAAAAALAAAAAAWABIAAAJAhI+py40zDIzujEDBzW0n74AaFGChqZUYylyYq7ILXJJ1BU95l6r23RrRYhyL5jiJAT/Ink8WTPoqHx31im0UAAA7</base64></value>
640 title => "moderateSizeArrayCheck",
641 desc => "This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.",
643 "<?xml version='1.0'?>
645 <methodName>validator1.moderateSizeArrayCheck</methodName>
651 <value>Nebraska</value>
652 <value>Nebraska</value>
653 <value>Kansas</value>
654 <value>Tennessee</value>
656 <value>Oregon</value>
657 <value>Missouri</value>
658 <value>Mississippi</value>
659 <value>Michigan</value>
660 <value>Pennsylvania</value>
661 <value>Rhode Island</value>
664 <value>Nebraska</value>
665 <value>Washington</value>
666 <value>Oregon</value>
667 <value>Virginia</value>
668 <value>Arizona</value>
670 <value>South Carolina</value>
671 <value>Montana</value>
672 <value>Tennessee</value>
674 <value>Maryland</value>
675 <value>Michigan</value>
677 <value>Wisconsin</value>
678 <value>Delaware</value>
679 <value>Kansas</value>
680 <value>North Dakota</value>
681 <value>Massachusetts</value>
682 <value>New Mexico</value>
683 <value>Alaska</value>
684 <value>Michigan</value>
685 <value>Colorado</value>
686 <value>Wisconsin</value>
687 <value>South Dakota</value>
688 <value>Vermont</value>
689 <value>Virginia</value>
690 <value>Arkansas</value>
691 <value>Wisconsin</value>
692 <value>Colorado</value>
694 <value>Oregon</value>
695 <value>Arizona</value>
696 <value>Michigan</value>
697 <value>Illinois</value>
698 <value>Virginia</value>
699 <value>Florida</value>
700 <value>South Carolina</value>
701 <value>Florida</value>
702 <value>Arkansas</value>
703 <value>Maryland</value>
704 <value>Rhode Island</value>
705 <value>Washington</value>
706 <value>Georgia</value>
707 <value>Arizona</value>
709 <value>Louisiana</value>
710 <value>Washington</value>
711 <value>Nevada</value>
712 <value>Alaska</value>
713 <value>Hawaii</value>
714 <value>New Hampshire</value>
715 <value>West Virginia</value>
716 <value>South Carolina</value>
717 <value>Vermont</value>
718 <value>Tennessee</value>
719 <value>Connecticut</value>
721 <value>Louisiana</value>
722 <value>Alaska</value>
724 <value>California</value>
725 <value>Vermont</value>
726 <value>Rhode Island</value>
727 <value>West Virginia</value>
728 <value>Colorado</value>
729 <value>Delaware</value>
730 <value>Massachusetts</value>
731 <value>Rhode Island</value>
732 <value>Nevada</value>
733 <value>Oklahoma</value>
734 <value>Nebraska</value>
736 <value>Indiana</value>
737 <value>Mississippi</value>
738 <value>Mississippi</value>
739 <value>Washington</value>
740 <value>Tennessee</value>
741 <value>Arkansas</value>
742 <value>Alaska</value>
743 <value>Rhode Island</value>
744 <value>Oklahoma</value>
745 <value>Massachusetts</value>
746 <value>Connecticut</value>
747 <value>Connecticut</value>
748 <value>Virginia</value>
749 <value>Nebraska</value>
750 <value>Alabama</value>
751 <value>Louisiana</value>
752 <value>Colorado</value>
753 <value>Vermont</value>
754 <value>New Hampshire</value>
756 <value>Nebraska</value>
757 <value>Wisconsin</value>
758 <value>Kansas</value>
765 title => "nestedStructTest",
766 desc => "This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one
767 struct for each year. Each year is broken down into months, and months into days. Most of the days are
768 empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe,
769 larry and curly, all <i4>s. Your handler must add the three numbers and return the result.
771 Ken MacLeod: \"This description isn't clear, I expected '2000.April.1' when in fact it's '2000.04.01'. Adding
772 a note saying that month and day are two-digits with leading 0s, and January is 01 would help.\" Done.",
774 "<?xml version='1.0'?>
776 <methodName>validator1.nestedStructTest</methodName>
1139 title => "simpleStructReturnTest",
1140 desc => "This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.",
1142 "<?xml version='1.0'?>
1144 <methodName>validator1.simpleStructReturnTest</methodName>
1147 <value><i4>55</i4></value>
1154 foreach($test_cases as $test_case) {
1155 do_test_case($test_case[title], $test_case[desc], $test_case[xml]);