]> granicus.if.org Git - php/commitdiff
Tests were improved (https:// support)
authorDmitry Stogov <dmitry@php.net>
Fri, 9 Jan 2004 14:56:24 +0000 (14:56 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 9 Jan 2004 14:56:24 +0000 (14:56 +0000)
ext/soap/interop/client_round2_interop.php
ext/soap/interop/client_round2_params.php
ext/soap/interop/echoheadersvc.wsdl.php
ext/soap/interop/index.php
ext/soap/interop/interop.wsdl.php
ext/soap/interop/server_round2_base.php
ext/soap/interop/server_round2_groupB.php
ext/soap/interop/test.utility.php

index 6c4dbd64994a12684c5a95697bf7155e504fa24c..7d981b33d242c00eafc728a0edfee53cd2d95f15 100644 (file)
@@ -71,18 +71,18 @@ class Interop_Client
         // set up local endpoint
         $this->localEndpoint['base'] = (object)array(
                                 'endpointName'=>'PHP ext/soap',
-                                'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_base.php',
-                                'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/interop.wsdl.php'
+                                'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_base.php',
+                                'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/interop.wsdl.php'
                               );
         $this->localEndpoint['GroupB'] = (object)array(
                                 'endpointName'=>'PHP ext/soap',
-                                'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupB.php',
-                                'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/interopB.wsdl.php'
+                                'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupB.php',
+                                'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/interopB.wsdl.php'
                               );
         $this->localEndpoint['GroupC'] = (object)array(
                                 'endpointName'=>'PHP ext/soap',
-                                'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupC.php',
-                                'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/echoheadersvc.wsdl.php'
+                                'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupC.php',
+                                'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/echoheadersvc.wsdl.php'
                               );
     }
 
@@ -481,9 +481,14 @@ class Interop_Client
 
             // compare the results with what we sent
 
-            $ok = $this->compareResult($sent_d,$return, $sent->type);
-            if (!$ok && $soap_test->expect) {
+            if ($soap_test->cmp_func !== NULL) {
+              $cmp_func = $soap_test->cmp_func;
+              $ok = $cmp_func($sent_d,$return);
+            } else {
+              $ok = $this->compareResult($sent_d,$return, $sent->type);
+              if (!$ok && $soap_test->expect) {
                 $ok = $this->compareResult($soap_test->expect,$return);
+              }
             }
 
             // save the wire
index b78fb14bce35ca3cd8643308e649f4c992a3ee70..c7a8245924a3419a61e3915b5d512337cec7e550 100644 (file)
@@ -27,6 +27,7 @@ class SOAP_Test {
     var $test_name = NULL;
     var $method_name = NULL;
     var $method_params = NULL;
+    var $cmp_func = NULL;
     var $expect = NULL;
     var $expect_fault = FALSE;
     var $headers = NULL;
@@ -36,7 +37,7 @@ class SOAP_Test {
     var $debug = 0;
     var $encoding = 'UTF-8';
 
-    function SOAP_Test($methodname, $params, $expect = NULL) {
+    function SOAP_Test($methodname, $params, $expect = NULL, $cmp_func = NULL) {
         # XXX we have to do this to make php-soap happy with NULL params
         if (!$params) $params = array();
 
@@ -51,6 +52,9 @@ class SOAP_Test {
         if ($expect !== NULL) {
           $this->expect = $expect;
         }
+        if ($cmp_func !== NULL) {
+          $this->cmp_func = $cmp_func;
+        }
 
         // determine test type
         if ($params) {
@@ -259,9 +263,9 @@ $soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' =>
 //***********************************************************
 // Base echoHexBinary
 
-$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'));
+$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'),'736F61707834','hex_compare');
 $soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' =>
-        soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)));
+        soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)),'736F61707834','hex_compare');
 
 //***********************************************************
 // Base echoDecimal
index 2eb5c8c6e17ee5032e2b6702ee0b1b1a1ede5ab2..b31096065705c356532b1909781820fb390ac442 100644 (file)
@@ -12,7 +12,7 @@ echo "\n";
        <service name="interopLabEchoHeader">
 
                <port name="interopPortEchoHdr" binding="tns:InteropEchoHeaderBinding">
-                       <soap:address location="http://<?php echo ($_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']));?>/server_round2.php"/>
+                       <soap:address location="<?php echo ((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));?>/server_round2.php"/>
                </port>
 
        </service>
index 7c63ebf79f3660f138e42e8b7155d6e6243737c1..999cd47efa7b671c9f56301121a16b022be44b1c 100644 (file)
@@ -6,10 +6,10 @@
 </head>
 <?php
 // get our endpoint
-$server = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
-$base = 'http://'.$server.dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php";
-$groupb = 'http://'.$server.dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php";
-$groupc = 'http://'.$server.dirname($_SERVER['PHP_SELF'])."/echoheadersvc.wsdl.php";
+$server = $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'];
+$base = (isset($_SERVER['HTTPS'])?"https://":"http://").$server.dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php";
+$groupb = (isset($_SERVER['HTTPS'])?"https://":"http://").$server.dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php";
+$groupc = (isset($_SERVER['HTTPS'])?"https://":"http://").$server.dirname($_SERVER['PHP_SELF'])."/echoheadersvc.wsdl.php";
 ?>
 <body>
 
index e71a19c76d5d7e0b480791c73b08cd6bb91e03a7..b257c56b66ff2280f78cf796732ef82ed480764b 100644 (file)
@@ -328,7 +328,7 @@ echo "\n";
 
   <service name="InteropTest">
     <port name="InteropTestPort" binding="tns:InteropTestBinding">
-                       <soap:address location="http://<?php echo ($_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']));?>/server_round2_base.php"/>
+                       <soap:address location="<?php echo ((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));?>/server_round2_base.php"/>
     </port>
   </service>
 
index 314a5c85e2ab43cae20d86b516b99d8b76d87c4d..0c6771d88eedd1f5606438dffcf1c99ebde7d9a6 100644 (file)
@@ -139,7 +139,7 @@ class SOAP_Interop_Base {
 }
 
 $server = new SoapServer("http://test-uri");
-$server->bind("http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php");
+$server->bind((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php");
 $server->setClass("SOAP_Interop_Base");
 $server->handle();
 ?>
\ No newline at end of file
index dc36aa5027eb036bdaff33a2f58dd96b330ce8e7..eaae5ba89b9da051d8dea1e259b1b5576ac8ecf3 100644 (file)
@@ -64,7 +64,7 @@ class SOAP_Interop_GroupB {
 }
 
 $server = new SoapServer("http://test-uri");
-$server->bind("http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php");
+$server->bind((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php");
 $server->setClass("SOAP_Interop_GroupB");
 $server->handle();
 ?>
\ No newline at end of file
index bfe176dc93c1ea4bc2355e199ff6eeca0927b812..50f85f1cd8510d736faca124aec7e726c7ff5b8a 100644 (file)
@@ -1,5 +1,10 @@
 <?php
 
+function hex_compare($f1, $f2)
+{
+  return strcasecmp($f1,$f2) == 0;
+}
+
 function number_compare($f1, $f2)
 {
     # figure out which has the least fractional digits