_ >   62 62 # Takes an array, each of whose members is a struct.  Return the
  63 63 # sum of all the values named curly from each struct.
  64 64
< >     65
65 66 proc validator1.arrayOfStructsTest {params} {
  66 67        
  67 68     set number 0
 
89 90     return [list -int $number]
  90 91 }
  91 92
< >     93 xmlrpc_register_proc validator1.arrayOfStructsTest
    94
92 95 # Takes a string.
  93 96 # Return the number of each entity in a struct.
  94 97
 
115 118           ctQuotes             [list -int [regsub -all {\"} $string "" string]]]]
  116 119 }
  117 120
< >     121 xmlrpc_register_proc validator1.countTheEntities
    122
118 123 # Takes a struct.
  119 124 # Return the sum of the values larry, curly and moe.
  120 125
 
128 133             + $bigStruct(larry)]]
  129 134 }
  130 135
< >     136 xmlrpc_register_proc validator1.easyStructTest
    137
131 138 proc validator1.echoStructTest {struct} {
  132 139     foreach {name value} $struct {
  133 140         if {[llength $value] > 1} {
 
144 151     return [list -struct [array get output]]
  145 152 }
  146 153
< >     154 xmlrpc_register_proc validator1.echoStructTest
    155
147 156 proc validator1.manyTypesTest {
  148 157     number boolean string double dateTime base64
  149 158 } {
 
157 166                [list -base64 $base64]]]
  158 167 }
  159 168
< >     169 xmlrpc_register_proc validator1.manyTypesTest
    170
160 171 proc validator1.moderateSizeArrayCheck {array} {
  161 172     array set bigArray $array
  162 173     set counter 1
 
167 178     return "-string [list "$bigArray(1)$bigArray($counter)"]"
  168 179 }
  169 180
< >     181 xmlrpc_register_proc validator1.moderateSizeArrayCheck
    182
170 183 proc validator1.nestedStructTest {struct} {
  171 184     array set bigStruct $struct
  172 185     array set 2000 $bigStruct(2000)
 
176 189             + $first(curly) + $first(moe)]"
  177 190 }
  178 191
< >     192 xmlrpc_register_proc validator1.nestedStructTest
    193
179 194 proc validator1.simpleStructReturnTest {number} {
  180 195     set struct(times10) [expr $number * 10]
  181 196     set struct(times100) [expr $number * 100]
 
184 199     return "-struct [list [array get struct]]"
  185 200 }
  186 201
< >     202 xmlrpc_register_proc validator1.simpleStructReturnTest
    203
187 204 ############################################################
  188 205 # XML-RPC Server Validator
< >     206 # change URL to the server you are trying to validate! for each of
    207 # these procs..
189 208
  190 209 proc validate1.arrayOfStructsTest {
< >   191       {url http://www.theashergroup.com/RPC2}
    210 {url http://www.theashergroup.com/RPC2}
192 211     {array ""}
  193 212 } {
  194 213     if {[string equal "" $array]} {
 
206 225     return [xmlrpc_call $url validator1.arrayOfStructsTest -array $array]
  207 226 }
  208 227
< >   209   proc validate1.countTheEntities {
  210       {url http://www.theashergroup.com/RPC2}
  211       {string {<<<>>>}}
  212   } {
  213       set response \
  214             [xmlrpc_call \
  215               $url validator1.countTheEntities -string $string]
  216       return $response
  217   }
  218  
219 228 proc validate1.easyStructTest {
  220 229     {url "http://www.theashergroup.com/RPC2"}
  221 230     {struct ""}
 
254 263               -double $double -date $date -base64 $base64]
  255 264 }
  256 265
< >   257   proc validate1.moderateSizeArrayCheck {
  258       {url http://www.theashergroup.com/RPC2}
  259       {first "Now is the time for all good men "}
  260       {last "to come to the aid of their country"}
  261       {fluff_length 20}
  262   } {
  263       set array [list]
  264  
  265       lappend array [list -string $first]
  266       for {set i 0} {$i < $fluff_length} {incr i} {
  267           lappend array [list -string ebede]
  268       }
  269       lappend array [list -string $last]
  270      
  271       return [xmlrpc_call $url validator1.moderateSizeArrayCheck -array $array]
  272   }
  273  
274 266 proc validate1.nestedStructTest {
  275 267     {url http://www.theashergroup.com/RPC2}
  276 268     {moe 1}
 
326 318     return [xmlrpc_call $url validator1.nestedStructTest -struct $calendar]
  327 319 }
  328 320
< >     321
329 322 proc validate1.simpleStructReturnTest {
  330 323     {url http://www.theashergroup.com/RPC2}
  331 324     {number 2}
  332 325 } {
  333 326     return [xmlrpc_call $url validator1.simpleStructReturnTest -int $number]
< _   334   }
    327 }
    328