@@ -30,6 +30,8 @@ class Interop_Client
30
30
// database DNS
31
31
var $ DSN = "" ;
32
32
33
+ var $ baseURL = "" ;
34
+
33
35
// our central interop server, where we can get the list of endpoints
34
36
var $ interopServer = "http://www.whitemesa.net/wsdl/interopInfo.wsdl " ;
35
37
@@ -57,10 +59,13 @@ class Interop_Client
57
59
var $ tests = array ('base ' ,'GroupB ' , 'GroupC ' );
58
60
var $ paramTypes = array ('php ' , 'soapval ' );
59
61
var $ endpoints = array ();
62
+ var $ html = 1 ;
60
63
61
64
function Interop_Client () {
62
65
global $ interopConfig ;
63
66
$ this ->DSN = $ interopConfig ['DSN ' ];
67
+ $ this ->baseURL = $ interopConfig ['baseURL ' ];
68
+ //$this->baseURL = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
64
69
// set up the database connection
65
70
$ this ->dbc = DB ::connect ($ this ->DSN , true );
66
71
// if it errors out, just ignore it and rely on regular methods
@@ -71,19 +76,18 @@ function Interop_Client() {
71
76
// set up local endpoint
72
77
$ this ->localEndpoint ['base ' ] = (object )array (
73
78
'endpointName ' =>'PHP ext/soap ' ,
74
- 'endpointURL ' =>' http:// ' . $ _SERVER [ ' HTTP_HOST ' ]. dirname ( $ _SERVER [ ' PHP_SELF ' ]) .'/server_round2_base.php ' ,
75
- 'wsdlURL ' =>' http:// ' . $ _SERVER [ ' HTTP_HOST ' ]. dirname ( $ _SERVER [ ' PHP_SELF ' ]) .'/interop.wsdl.php '
79
+ 'endpointURL ' =>$ this -> baseURL .'/server_round2_base.php ' ,
80
+ 'wsdlURL ' =>$ this -> baseURL .'/interop.wsdl.php '
76
81
);
77
82
$ this ->localEndpoint ['GroupB ' ] = (object )array (
78
83
'endpointName ' =>'PHP ext/soap ' ,
79
- 'endpointURL ' =>' http:// ' . $ _SERVER [ ' HTTP_HOST ' ]. dirname ( $ _SERVER [ ' PHP_SELF ' ]) .'/server_round2_groupB.php ' ,
80
- 'wsdlURL ' =>' http:// ' . $ _SERVER [ ' HTTP_HOST ' ]. dirname ( $ _SERVER [ ' PHP_SELF ' ]) .'/interopB.wsdl.php '
84
+ 'endpointURL ' =>$ this -> baseURL .'/server_round2_groupB.php ' ,
85
+ 'wsdlURL ' =>$ this -> baseURL .'/interopB.wsdl.php '
81
86
);
82
87
$ this ->localEndpoint ['GroupC ' ] = (object )array (
83
88
'endpointName ' =>'PHP ext/soap ' ,
84
- 'endpointURL ' =>'http:// ' .$ _SERVER ['HTTP_HOST ' ].dirname ($ _SERVER ['PHP_SELF ' ]).'/server_round2_groupC.php ' ,
85
- 'wsdlURL ' =>'http:// ' .$ _SERVER ['HTTP_HOST ' ].dirname ($ _SERVER ['PHP_SELF ' ]).'/echoheadersvc.wsdl.php '
86
- );
89
+ 'endpointURL ' =>$ this ->baseURL .'/server_round2_groupC.php ' ,
90
+ 'wsdlURL ' =>$ this ->baseURL .'/echoheadersvc.wsdl.php ' );
87
91
}
88
92
89
93
function _fetchEndpoints (&$ soapclient , $ test ) {
@@ -92,9 +96,11 @@ function _fetchEndpoints(&$soapclient, $test) {
92
96
// retreive endpoints from the endpoint server
93
97
$ endpointArray = $ soapclient ->__call ("GetEndpointInfo " ,array ("groupName " =>$ test ),array ('soapaction ' =>"http://soapinterop.org/ " ,'uri ' =>"http://soapinterop.org/ " ));
94
98
if (is_soap_fault ($ endpointArray ) || PEAR ::isError ($ endpointArray )) {
95
- print "<pre> " .$ soapclient ->wire ."\n" ;
99
+ if ($ this ->html ) print "<pre> " ;
100
+ print $ soapclient ->wire ."\n" ;
96
101
print_r ($ endpointArray );
97
- print "</pre> " ;
102
+ if ($ this ->html ) print "</pre> " ;
103
+ print "\n" ;
98
104
return ;
99
105
}
100
106
@@ -145,7 +151,11 @@ function fetchEndpoints($test = NULL) {
145
151
$ test = 'base ' ;
146
152
}
147
153
} catch (SoapFault $ fault ) {
148
- echo "<pre> $ fault</pre> " ;
154
+ if ($ this ->html ) {
155
+ echo "<pre> $ fault</pre> \n" ;
156
+ } else {
157
+ echo "$ fault \n" ;
158
+ }
149
159
return NULL ;
150
160
}
151
161
// retreive all endpoints now
@@ -552,7 +562,10 @@ function doTest() {
552
562
$ this ->totals ['servers ' ]++;
553
563
#$endpoint_info['tests'] = array();
554
564
555
- if ($ this ->show ) print "Processing $ endpoint at {$ endpoint_info ['endpointURL ' ]}<br> \n" ;
565
+ if ($ this ->show ) {
566
+ print "Processing $ endpoint at {$ endpoint_info ['endpointURL ' ]}" ;
567
+ if ($ this ->html ) print "<br> \n" ; else print "\n" ;
568
+ }
556
569
557
570
foreach ($ soap_tests [$ this ->currentTest ] as $ soap_test ) {
558
571
//foreach(array_keys($method_params[$this->currentTest][$this->paramType]) as $method)
@@ -573,7 +586,7 @@ function doTest() {
573
586
$ skipfault
574
587
);
575
588
#$endpoint_info['tests'][] = &$soap_test;
576
- #$soap_test->showTestResult($this->debug);
589
+ #$soap_test->showTestResult($this->debug, $this->html );
577
590
#$this->_saveResults($endpoint_info['id'], $soap_test->method_name);
578
591
$ soap_test ->result = NULL ;
579
592
continue ;
@@ -602,7 +615,7 @@ function doTest() {
602
615
}
603
616
#$endpoint_info['tests'][] = &$soap_test;
604
617
}
605
- $ soap_test ->showTestResult ($ this ->debug );
618
+ $ soap_test ->showTestResult ($ this ->debug , $ this -> html );
606
619
$ this ->_saveResults ($ endpoint_info ['id ' ], $ soap_test );
607
620
$ soap_test ->result = NULL ;
608
621
$ this ->totals ['calls ' ]++;
@@ -775,7 +788,10 @@ function showWire($id) {
775
788
$ results = $ this ->dbc ->getAll ("select * from results where id= $ id " ,NULL , DB_FETCHMODE_ASSOC );
776
789
#$wire = preg_replace("/>/",">\n",$results[0]['wire']);
777
790
$ wire = $ results [0 ]['wire ' ];
778
- echo "<pre> \n" .HTMLSpecialChars ($ wire )."</pre> \n" ;
791
+ if ($ this ->html ) print "<pre> " ;
792
+ echo "\n" .HTMLSpecialChars ($ wire );
793
+ if ($ this ->html ) print "</pre> " ;
794
+ print "\n" ;
779
795
}
780
796
781
797
}
0 commit comments