home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 February / PCWorld_2003-02_cd.bin / Komunik / sambar / sambar53b3.exe / sysadmin / control / soap / interop.asp < prev    next >
Encoding:
Text File  |  2002-10-29  |  3.9 KB  |  187 lines

  1. <HTML>
  2. <HEAD><TITLE>Sambar Server SOAP Control Panel</TITLE>
  3. <% 
  4. #include "../header.asp"
  5. #include "../menu.asp"
  6. area = "interop";
  7. #include "submenu.asp"
  8. %>
  9. <BR>
  10. <B>Starting Soap Interop Tests...</B>
  11. <BLOCKQUOTE><PRE><CODE>
  12. <%
  13.  
  14. /*
  15. ** echoNull
  16. */
  17. $soap = soapService("http://localhost/soap", "echoNull", 
  18.     "urn:echoNull");
  19. soapParameterAdd($soap, "echoNull", NULL);
  20. soapCall($soap);
  21.  
  22. int time = soapPropertyGet($soap, "msec");
  23. val = soapResultGet($soap, NULL);
  24. if (val == NULL)
  25.     printf("echoNull SUCCESS %d msec\n", time);
  26. else
  27.     printf("echoNull FAILURE %d msec\n", time);
  28.  
  29. soapServiceFree($soap);
  30.  
  31. /*
  32. ** echoString
  33. */
  34. $soap = soapService("http://localhost/soap", "echoString", 
  35.     "urn:echoString");
  36. soapParameterAdd($soap, "echoString", "Hello");
  37. soapCall($soap);
  38.  
  39. int time = soapPropertyGet($soap, "msec");
  40. val = soapResultGet($soap, NULL);
  41. if (val == "Hello")
  42.     printf("echoString SUCCESS %d msec\n", time);
  43. else
  44.     printf("echoString FAILURE %d msec\n", time);
  45.  
  46. soapServiceFree($soap);
  47.  
  48. /*
  49. ** echoStringArray
  50. */
  51. $soap = soapService("http://localhost/soap", "echoStringArray", 
  52.     "urn:echoStringArray");
  53.  
  54. char arrayvalue[4];
  55. arrayvalue[0] = "<Hello>";
  56. arrayvalue[1] = "'This'";
  57. arrayvalue[2] = "Is";
  58. arrayvalue[3] = "Test";
  59.  
  60. soapParameterAdd($soap, "echoStringArray", arrayvalue);
  61. soapCall($soap);
  62.  
  63. int time = soapPropertyGet($soap, "msec");
  64. val = soapResultGet($soap, NULL);
  65. if (isArray(val) && 
  66.     sizeof(val) == 4 && 
  67.     val[0] == "<Hello>" &&
  68.     val[1] == "'This'" &&
  69.     val[2] == "Is" &&
  70.     val[3] == "Test")
  71. {
  72.     printf("echoStringArray SUCCESS %d msec\n", time);
  73. }
  74. else
  75. {
  76.     printf("echoStringArray FAILURE %d msec\n", time);
  77. }
  78.  
  79. soapServiceFree($soap);
  80.  
  81. /*
  82. ** echoInteger
  83. */
  84. $soap = soapService("http://localhost/soap", "echoInteger", 
  85.     "urn:echoInteger");
  86. soapParameterAdd($soap, "echoInteger", 5);
  87. soapCall($soap);
  88.  
  89. int time = soapPropertyGet($soap, "msec");
  90. val = soapResultGet($soap, NULL);
  91. if (val == 5)
  92.     printf("echoInteger SUCCESS %d msec\n", time);
  93. else
  94.     printf("echoInteger FAILURE %d msec\n", time);
  95.  
  96. soapServiceFree($soap);
  97.  
  98. /*
  99. ** echoIntegerArray
  100. */
  101. $soap = soapService("http://localhost/soap", "echoIntegerArray", 
  102.     "urn:echoIntegerArray");
  103.  
  104. int arrayvalue[5];
  105. arrayvalue[0] = 1;
  106. arrayvalue[1] = 0;
  107. arrayvalue[2] = 1;
  108. arrayvalue[3] = 3;
  109. arrayvalue[4] = 5;
  110.  
  111. soapParameterAdd($soap, "echoIntegerArray", arrayvalue);
  112. soapCall($soap);
  113.  
  114. int time = soapPropertyGet($soap, "msec");
  115. val = soapResultGet($soap, NULL);
  116. if (isArray(val) && 
  117.     sizeof(val) == 5 && 
  118.     val[0] == 1 &&
  119.     val[1] == 0 &&
  120.     val[2] == 1 &&
  121.     val[3] == 3 &&
  122.     val[4] == 5)
  123. {
  124.     printf("echoIntegerArray SUCCESS %d msec\n", time);
  125. }
  126. else
  127. {
  128.     printf("echoIntegerArray FAILURE %d msec\n", time);
  129. }
  130.  
  131. soapServiceFree($soap);
  132.  
  133. /*
  134. ** echoFloat
  135. */
  136. $soap = soapService("http://localhost/soap", "echoFloat", 
  137.     "urn:echoFloat");
  138. soapParameterAdd($soap, "echoFloat", 10.3);
  139. soapCall($soap);
  140.  
  141. int time = soapPropertyGet($soap, "msec");
  142. val = soapResultGet($soap, NULL);
  143. if (val == 10.3)
  144.     printf("echoFloat SUCCESS %d msec\n", time);
  145. else
  146.     printf("echoFloat FAILURE %d msec\n", time);
  147.  
  148. soapServiceFree($soap);
  149.  
  150. /*
  151. ** echoFloatArray
  152. */
  153. $soap = soapService("http://localhost/soap", "echoFloatArray", 
  154.     "urn:echoFloatArray");
  155.  
  156. float arrayvalue[3];
  157. arrayvalue[0] = 3.0;
  158. arrayvalue[1] = 5.3;
  159. arrayvalue[2] = 10.6;
  160.  
  161. soapParameterAdd($soap, "echoFloatArray", arrayvalue);
  162. soapCall($soap);
  163.  
  164. int time = soapPropertyGet($soap, "msec");
  165. val = soapResultGet($soap, NULL);
  166. if (isArray(val) && 
  167.     sizeof(val) == 3 && 
  168.     val[0] == 3.0 &&
  169.     val[1] == 5.3 &&
  170.     val[2] == 10.6)
  171. {
  172.     printf("echoFloatArray SUCCESS %d msec\n", time);
  173. }
  174. else
  175. {
  176.     printf("echoFloatArray FAILURE %d msec\n", time);
  177. }
  178.  
  179. soapServiceFree($soap);
  180. %>
  181. </CODE></PRE></BLOCKQUOTE>
  182. <B>Done with Soap Interop Tests...</B>
  183. <%
  184. #include "../footer.asp"
  185. %>
  186. </BODY></HTML>
  187.