cvs: pear /SOAP Client.php Fault.php Parser.php Server.php Value.php globals.php /SOAP/Transport HTTP.php /SOAP/interop client_round2.php
client_round2_interop.php client_round2_params.php echoheadersvc.wsdl interop.wsdl interopB.wsdl server_round2.php /SOAP/test test.utility.php

From: Date: Sun, 07 Apr 2002 23:22:33 +0000
Subject: cvs: pear /SOAP Client.php Fault.php Parser.php Server.php Value.php globals.php /SOAP/Transport HTTP.php /SOAP/interop client_round2.php
client_round2_interop.php client_round2_params.php echoheadersvc.wsdl interop.wsdl interopB.wsdl server_round2.php /SOAP/test test.utility.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-3124@lists.php.net to get a copy of this message
shane Sun Apr 7 19:22:33 2002 EDT Added files: /pear/SOAP/interop echoheadersvc.wsdl interop.wsdl interopB.wsdl Modified files: /pear/SOAP Client.php Fault.php Parser.php Server.php Value.php globals.php /pear/SOAP/Transport HTTP.php /pear/SOAP/interop client_round2.php client_round2_interop.php client_round2_params.php server_round2.php /pear/SOAP/test test.utility.php Log: add wsdl files for interop tests some interop test facility cleanup and improvement make SOAP_Parser use SOAP_Base start to cleanup SOAP_Server faults some SOAP_Value fixes for arrays and struct handling

Index: pear/SOAP/Client.php diff -u pear/SOAP/Client.php:1.17 pear/SOAP/Client.php:1.18 --- pear/SOAP/Client.php:1.17 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/Client.php Sun Apr 7 19:22:32 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Client.php,v 1.17 2002/03/30 23:13:21 shane Exp $ +// $Id: Client.php,v 1.18 2002/04/07 23:22:32 shane Exp $ // require_once 'SOAP/Value.php'; @@ -38,7 +38,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Client.php,v 1.17 2002/03/30 23:13:21 shane Exp $ +* @version $Id: Client.php,v 1.18 2002/04/07 23:22:32 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Stig Bakken <ssb@fast.no> Conversion to PEAR @@ -272,6 +272,9 @@ // parse the response #$return = $this->soapmsg->parseResponse($this->response); $this->response = new SOAP_Parser($this->response); + if ($this->response->fault) { + return $this->raiseSoapFault($this->response->fault); + } // return array of parameters $return = $this->response->getResponse(); $headers = $this->response->getHeaders(); Index: pear/SOAP/Fault.php diff -u pear/SOAP/Fault.php:1.2 pear/SOAP/Fault.php:1.3 --- pear/SOAP/Fault.php:1.2 Wed Mar 6 10:43:02 2002 +++ pear/SOAP/Fault.php Sun Apr 7 19:22:32 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Fault.php,v 1.2 2002/03/06 15:43:02 uw Exp $ +// $Id: Fault.php,v 1.3 2002/04/07 23:22:32 shane Exp $ // require_once('PEAR.php'); require_once('SOAP/Message.php'); @@ -29,7 +29,7 @@ * @access public * @author Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more * @author Dietrich Ayala <dietrich@ganx4.com> Original Author -* @version $Id: Fault.php,v 1.2 2002/03/06 15:43:02 uw Exp $ +* @version $Id: Fault.php,v 1.3 2002/04/07 23:22:32 shane Exp $ */ class SOAP_Fault extends PEAR_Error { @@ -61,7 +61,8 @@ // set up a fault function message() { - return new SOAP_Message('Fault', + $msg = new SOAP_Message(); + $msg->method('Fault', array( 'faultcode' => $this->code, 'faultstring' => $this->message, @@ -70,6 +71,7 @@ ), SOAP_ENVELOP ); + return $msg; } function getFault() Index: pear/SOAP/Parser.php diff -u pear/SOAP/Parser.php:1.12 pear/SOAP/Parser.php:1.13 --- pear/SOAP/Parser.php:1.12 Wed Apr 3 21:50:46 2002 +++ pear/SOAP/Parser.php Sun Apr 7 19:22:32 2002 @@ -17,11 +17,12 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Parser.php,v 1.12 2002/04/04 02:50:46 shane Exp $ +// $Id: Parser.php,v 1.13 2002/04/07 23:22:32 shane Exp $ // -require_once('SOAP/globals.php'); -require_once('SOAP/Value.php'); +require_once 'SOAP/globals.php'; +require_once 'SOAP/Base.php'; +require_once 'SOAP/Value.php'; /** * SOAP Parser @@ -30,12 +31,12 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Parser.php,v 1.12 2002/04/04 02:50:46 shane Exp $ +* @version $Id: Parser.php,v 1.13 2002/04/07 23:22:32 shane Exp $ * @package SOAP::Parser * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author */ -class SOAP_Parser +class SOAP_Parser extends SOAP_Base { var $status = ''; var $position = 0; @@ -44,13 +45,7 @@ var $default_namespace = ''; var $namespaces = array(); var $message = array(); - var $fault = false; - var $fault_code = ''; - var $fault_str = ''; - var $fault_detail = ''; var $depth_array = array(); - var $debug_flag = SOAP_DEBUG; - var $debug_data = ''; var $previous_element = ''; var $soapresponse = NULL; var $parent = 0; @@ -69,15 +64,15 @@ function SOAP_Parser($xml, $encoding = 'UTF-8') { + parent::SOAP_Base('Parser'); $this->setSchemaVersion(SOAP_XML_SCHEMA_VERSION); - //global $soapTypes; - //$this->soapTypes = $soapTypes; + $this->xml = $xml; $this->xml_encoding = $encoding; // determines where in the message we are (envelope,header,body,method) // Check whether content has been read. - if (!empty($xml)) { + if (!empty($this->xml)) { $this->debug('Entering SOAP_Parser()'); //$this->debug("DATA DUMP:\n\n$xml"); @@ -95,12 +90,13 @@ xml_set_default_handler($parser, 'defaultHandler'); // Parse the XML file. - if (!xml_parse($parser,$xml,true)) { + if (!xml_parse($parser,$this->xml,true)) { // Display an error message. - $this->debug(sprintf('XML error on line %d: %s', - xml_get_current_line_number($parser), - xml_error_string(xml_get_error_code($parser)))); + $err = sprintf('XML error on line %d: %s', + xml_get_current_line_number($parser), + xml_error_string(xml_get_error_code($parser))); $this->fault = true; + $this->raiseSoapFault($err,htmlspecialchars($this->xml)); } else { // get final value $this->soapresponse = $this->buildResponse($this->root_struct[0]); @@ -401,6 +397,8 @@ $this->message[$ref_pos]['cdata'] = &$this->message[$pos]['cdata']; $this->message[$ref_pos]['type'] = &$this->message[$pos]['type']; $this->message[$ref_pos]['inval'] = &$this->message[$pos]['inval']; + $this->message[$ref_pos]['arraySize'] = &$this->message[$pos]['arraySize']; + $this->message[$ref_pos]['arrayType'] = &$this->message[$pos]['arrayType']; } # wipe out our waiting list $this->need_references[$idref] = array(); @@ -449,13 +447,6 @@ // we don't fault if there are no headers // that can be handled by the app if necessary return NULL; - } - - function debug($string) - { - if ($this->debug_flag) { - $this->debug_data .= 'SOAP_Parser: ' . preg_replace("/>/","/>\r\n/", $string) . "\n"; - } } function decodeEntities($text) Index: pear/SOAP/Server.php diff -u pear/SOAP/Server.php:1.9 pear/SOAP/Server.php:1.10 --- pear/SOAP/Server.php:1.9 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/Server.php Sun Apr 7 19:22:32 2002 @@ -17,13 +17,14 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Server.php,v 1.9 2002/03/30 23:13:21 shane Exp $ +// $Id: Server.php,v 1.10 2002/04/07 23:22:32 shane Exp $ // -require_once('SOAP/globals.php'); -require_once('SOAP/Parser.php'); -require_once('SOAP/Message.php'); -require_once('SOAP/Value.php'); +require_once 'SOAP/globals.php'; +require_once 'SOAP/Fault.php'; +require_once 'SOAP/Parser.php'; +require_once 'SOAP/Message.php'; +require_once 'SOAP/Value.php'; // make errors handle properly in windows error_reporting(2039); @@ -35,7 +36,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Server.php,v 1.9 2002/03/30 23:13:21 shane Exp $ +* @version $Id: Server.php,v 1.10 2002/04/07 23:22:32 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -88,24 +89,7 @@ * * @var boolean */ - var $fault = false; - - /** - * - * @var string fault-code - */ - var $fault_code = ''; - - /** - * - * @var string fault-string - */ - var $fault_str = ''; - - /** - * - */ - var $fault_actor = ''; + var $soapfault = false; var $result = 'successful'; // for logging interop results to db @@ -131,10 +115,11 @@ // if this is not a POST with Content-Type text/xml, try to return a WSDL file if (!$test && ($_SERVER['REQUEST_METHOD'] != 'POST' || + (strncmp($_SERVER['CONTENT_LENGTH'], 'text/xml', 8) != 0) && strncmp($_ENV['HTTP_CONTENT_TYPE'], 'text/xml', 8) != 0)) { // this is not possibly a valid soap request, try to return a WSDL file $this->makeFault('Server',"Invalid SOAP request"); - $response = $this->fault(); + $response = $this->getFaultMessage(); } else { // $response is a soap_msg object $response = $this->parseRequest($data); @@ -149,7 +134,7 @@ } $payload = $response->serialize(); // print headers - if ($this->fault) { + if ($this->soapfault) { //$header[] = "HTTP/1.0 500 Internal Server Error\r\n"; $header[] = 'Status: 500 Internal Server Error\r\n'; } else { @@ -247,14 +232,15 @@ // parse response, get soap parser obj $parser = new SOAP_Parser($data,$this->xml_encoding); // if fault occurred during message parsing - if ($parser->fault()) { + if ($parser->fault) { // parser debug $this->debug($parser->debug_data); $this->result = 'fault: error in msg parsing'; - $this->makeFault('Server',"error in msg parsing:\n".$parser->getResponse()); + $fault = $parser->fault->message(); + #$this->makeFault('Server',"error in msg parsing:\n".$fault->serialize."\n\n<pre>$data</pre>\n\n"); // return soapresp - return $this->fault(); + return $parser->fault->message(); // else successfully parsed request into SOAP_Value object } // parser debug @@ -285,7 +271,7 @@ // return fault $this->makeFault('Server',"parser did not return SOAP_Value object: $request_headers"); - return $this->fault(); + return $this->getFaultMessage(); } if ($request_headers->value) { // handle headers now @@ -297,7 +283,7 @@ if (!$f_exists && $header_val->mustunderstand && $myactor) { $this->makeFault('Server',"I don't understand header $header_val->name."); - return $this->fault(); + return $this->getFaultMessage(); } // we only handle the header if it's for us @@ -310,13 +296,9 @@ // if there are parameters to pass $hr = $this->callMethod($header_method, $header_data); # if they return a fault, then it's all over! - if (strcasecmp(get_class($hr),'SOAP_Message')==0) { - if (eregi('fault',$hr->value->name)) { - $this->fault = true; + if (strcasecmp(get_class($hr),'SOAP_Message')==0 && + stristr($hr->value->name,'fault')) { return $hr; - } - # hmm, they returned a soap_message, we have to - # de-messagize it so we can append stuff. } $header_results[] = array_shift($this->buildResult($hr, $this->return_type, $header_method, $header_val->namespace)); } @@ -338,13 +320,13 @@ $this->debug("method '$this->methodname' not found!"); $this->result = 'fault: method not found'; $this->makeFault('Server',"method '$this->methodname' not defined in service '$this->service'"); - return $this->fault(); + return $this->getFaultMessage(); } $this->debug("method '$this->methodname' exists"); if (!$request_val = $parser->getResponse()) { - return $this->fault(); + return $this->getFaultMessage(); } if (strcasecmp(get_class($request_val),'SOAP_Value') != 0) { // debug @@ -353,7 +335,7 @@ // return fault $this->makeFault('Server',"parser did not return SOAP_Value object: $request_val"); - return $this->fault(); + return $this->getFaultMessage(); } // verify that SOAP_Value objects in request match the methods signature @@ -363,7 +345,7 @@ $this->result = 'fault: request failed validation against method signature'; // return soapresp - return $this->fault(); + return $this->getFaultMessage(); } $this->debug("request data - name: $request_val->name, type: $request_val->type, value: $request_val->value"); @@ -380,10 +362,6 @@ // if return val is SOAP_Message if (strcasecmp(get_class($method_response),'SOAP_Message')==0) { - // XXX this needs to be done better - if (stristr($method_response->value->name,'fault')) { - $this->fault = true; - } return $method_response; } @@ -536,7 +514,7 @@ { if (!function_exists($methodname)) { $this->makeFault('Server',"error mapping function\n"); - return $this->fault(); + return $this->getFaultMessage(); } $this->dispatch_map[$methodname]['in'] = $in; $this->dispatch_map[$methodname]['out'] = $out; @@ -544,26 +522,14 @@ } // set up a fault - function fault() + function getFaultMessage() { - $msg = new SOAP_Message(); - $msg->method('Fault', - array( - 'faultcode' => $this->fault_code, - 'faultstring' => $this->fault_str, - 'faultactor' => $this->fault_actor, - 'faultdetail' => $this->fault_detail . $this->debug_data - ), - 'http://schemas.xmlsoap.org/soap/envelope/' - ); - return $msg; + return $this->soapfault->message(); } function makeFault($fault_code, $fault_string) { - $this->fault_code = $fault_code; - $this->fault_str = $fault_string; - $this->fault = true; + $this->soapfault = new SOAP_Fault($fault_string, $fault_code); } } ?> Index: pear/SOAP/Value.php diff -u pear/SOAP/Value.php:1.19 pear/SOAP/Value.php:1.20 --- pear/SOAP/Value.php:1.19 Wed Apr 3 21:50:46 2002 +++ pear/SOAP/Value.php Sun Apr 7 19:22:32 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Value.php,v 1.19 2002/04/04 02:50:46 shane Exp $ +// $Id: Value.php,v 1.20 2002/04/07 23:22:32 shane Exp $ // require_once 'SOAP/Base.php'; require_once 'SOAP/globals.php'; @@ -31,7 +31,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Value.php,v 1.19 2002/04/04 02:50:46 shane Exp $ +* @version $Id: Value.php,v 1.20 2002/04/07 23:22:32 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -64,12 +64,6 @@ var $type_prefix = false; /** - * - * @var string - */ - var $array_type = ''; - - /** * * @var string */ @@ -289,7 +283,7 @@ * @param * @return int */ - function _getArrayType(&$value, &$type, &$size, &$xml) + function _multiArrayType(&$value, &$type, &$size, &$xml) { foreach ($value as $array_val) { $array_types[$array_val->type] = 1; @@ -303,12 +297,12 @@ } $sz = count($value); - - if (count($array_types) == 1) { + $num_types = count($array_types); + if ($num_types == 1) { if (array_key_exists('Array', $array_types)) { // seems we have a multi dimensional array, figure it out if we do foreach ($value as $array_val) { - $numtypes = $this->_getArrayType($array_val->value, $type, $size, $xml); + $numtypes = $this->_multiArrayType($array_val->value, $type, $size, $xml); if ($numtypes > 1) return $numtypes; } @@ -327,7 +321,7 @@ } } $size = $sz; - return count($array_types); + return $num_types; } /** @@ -377,10 +371,12 @@ case SOAP_VALUE_ARRAY: // array $xmlout_type = 'SOAP-ENC:Array'; - // XXX this will be slow on larger array's. We can probably move this - // out to an external helper function. Basicly, it flattens array's to allow us - // to serialize multi-dimensional array's - $numtypes = $this->_getArrayType($soapval->value, $array_type, $ar_size, $xmlout_value); + // XXX this will be slow on larger array's. Basicly, it flattens array's to allow us + // to serialize multi-dimensional array's. We only do this if arrayType is set, + // which will typicaly only happen if we are using WSDL + if ($this->arrayType && strchr($this->arrayType,',')) { + $numtypes = $this->_multiArrayType($soapval->value, $array_type, $ar_size, $xmlout_value); + } #$numtypes = 0; $array_type_prefix = ''; if ($numtypes != 1) { @@ -391,12 +387,25 @@ $ar_size = count($soapval->value); $numtypes = count($array_types); - $array_type = $array_val->type; + if ($this->arrayType) { + $ch = strpos($this->arrayType, '['); + if ($ch) { + $array_type = substr($this->arrayType,0,$ch); + } else { + $array_type = $this->arrayType; + } + } else { + $array_type = $array_val->type; + } + if ($array_type == 'Struct') { + $array_type = 'anyType'; // should reference what schema we're using + $array_val->type_prefix = 'xsd'; + } $array_type_prefix = $array_val->type_prefix; $xmlout_offset = " SOAP-ENC:offset=\"[0]\""; } if ($numtypes > 1) { - $array_type = 'xsd:ur-type'; + $array_type = 'xsd:anyType'; // should reference what schema we're using } elseif ($numtypes == 1) { if ($array_type_prefix != '') { $array_type = $array_type_prefix . ':' . $array_type; Index: pear/SOAP/globals.php diff -u pear/SOAP/globals.php:1.11 pear/SOAP/globals.php:1.12 --- pear/SOAP/globals.php:1.11 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/globals.php Sun Apr 7 19:22:32 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: globals.php,v 1.11 2002/03/30 23:13:21 shane Exp $ +// $Id: globals.php,v 1.12 2002/04/07 23:22:32 shane Exp $ // /** @@ -25,7 +25,7 @@ * * @module globals * @package SOAP -* @version $Id: globals.php,v 1.11 2002/03/30 23:13:21 shane Exp $ +* @version $Id: globals.php,v 1.12 2002/04/07 23:22:32 shane Exp $ * @author Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more * @author Dietrich Ayala <dietrich@ganx4.com> Original Author */ @@ -115,7 +115,8 @@ 'unsignedInt' => 'integer', 'unsignedShort' => 'integer', 'unsignedByte' => 'integer', - 'positiveInteger' => 'integer' + 'positiveInteger' => 'integer', + 'anyType' => 'string' ); $SOAP_typemap[SOAP_XML_SCHEMA_1999] = array( 'i4' => 'integer', Index: pear/SOAP/Transport/HTTP.php diff -u pear/SOAP/Transport/HTTP.php:1.10 pear/SOAP/Transport/HTTP.php:1.11 --- pear/SOAP/Transport/HTTP.php:1.10 Sat Mar 30 18:17:54 2002 +++ pear/SOAP/Transport/HTTP.php Sun Apr 7 19:22:33 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: HTTP.php,v 1.10 2002/03/30 23:17:54 shane Exp $ +// $Id: HTTP.php,v 1.11 2002/04/07 23:22:33 shane Exp $ // require_once 'SOAP/globals.php'; @@ -26,7 +26,7 @@ * HTTP Transport for SOAP * * @access public -* @version $Id: HTTP.php,v 1.10 2002/03/30 23:17:54 shane Exp $ +* @version $Id: HTTP.php,v 1.11 2002/04/07 23:22:33 shane Exp $ * @package SOAP::Transport::HTTP * @author Shane Caraveo <shane@php.net> */ @@ -173,7 +173,7 @@ } if (isset($this->urlparts['user'])) { - $this->setCredentials($this->urlparts['user'], $this->urlparts['password']); + $this->setCredentials($this->urlparts['user'], $this->urlparts['pass']); } return TRUE; @@ -188,10 +188,14 @@ function _parseResponse() { if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $this->incoming_payload, $match)) { - $this->response = preg_replace("/[\r|\n]/", '', $match[2]); + #$this->response = preg_replace("/[\r|\n]/", ' ', $match[2]); + $this->response = $match[2]; // find the response error - //if (preg_match("/^HTTP\/1\.. (\d+).*/s",$match[1],$status) && - // $status[1] != 200) return FALSE; + if (preg_match("/^HTTP\/1\.. (\d+).*/s",$match[1],$status) && + $status[1] >= 400 && $status[1] < 500) { + $this->raiseSoapFault("HTTP Response $status[1] Not Found"); + return FALSE; + } // if no content, return false return strlen($this->response) > 0; } @@ -206,8 +210,11 @@ */ function &_getRequest(&$msg, $action) { + $fullpath = $this->urlparts['path']. + ($this->urlparts['query']?'?'.$this->urlparts['query']:''). + ($this->urlparts['fragment']?'#'.$this->urlparts['fragment']:''); $this->outgoing_payload = - "POST {$this->urlparts['path']} HTTP/1.0\r\n". + "POST $fullpath HTTP/1.0\r\n". "User-Agent: {$this->_userAgent}\r\n". "Host: {$this->urlparts['host']}\r\n". $this->credentials. Index: pear/SOAP/interop/client_round2.php diff -u pear/SOAP/interop/client_round2.php:1.1 pear/SOAP/interop/client_round2.php:1.2 --- pear/SOAP/interop/client_round2.php:1.1 Sat Mar 30 17:57:56 2002 +++ pear/SOAP/interop/client_round2.php Sun Apr 7 19:22:33 2002 @@ -17,7 +17,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: client_round2.php,v 1.1 2002/03/30 22:57:56 shane Exp $ +// $Id: client_round2.php,v 1.2 2002/04/07 23:22:33 shane Exp $ // set_time_limit(0); require_once 'SOAP/interop/client_round2_interop.php'; @@ -27,7 +27,7 @@ #$iop->fetchEndpoints(); // set some options -$iop->currentTest = 'GroupB'; // see $tests above +$iop->currentTest = 'base'; // see $tests above $iop->paramType = 'soapval'; // 'php' or 'soapval' $iop->useWSDL = 1; // 1= do wsdl tests $iop->numServers = 0; // 0 = all Index: pear/SOAP/interop/client_round2_interop.php diff -u pear/SOAP/interop/client_round2_interop.php:1.1 pear/SOAP/interop/client_round2_interop.php:1.2 --- pear/SOAP/interop/client_round2_interop.php:1.1 Sat Mar 30 17:57:56 2002 +++ pear/SOAP/interop/client_round2_interop.php Sun Apr 7 19:22:33 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: client_round2_interop.php,v 1.1 2002/03/30 22:57:56 shane Exp $ +// $Id: client_round2_interop.php,v 1.2 2002/04/07 23:22:33 shane Exp $ // require_once 'DB.php'; // PEAR/DB require_once 'SOAP/Client.php'; @@ -90,14 +90,22 @@ if (!$endpointArray) return; // reset the status to zero - $this->dbc->query("update endpoints set status = 0 where type='$test'"); + $res = $this->dbc->query("update endpoints set status = 0 where type='$test'"); + if (DB::isError($res)) { + die ($res->getMessage()); + } + $res->free(); // save new endpoints into database foreach($endpointArray as $k => $v){ if (array_key_exists($v['endpointName'],$endpointArray)) { - $this->dbc->query("update endpoints set endpointURL='{$v['endpointURL']}', wsdlURL='{$v['wsdlURL']}', status=1 where id={$this->endpoints[$v['endpointName']]['id']}"); + $res = $this->dbc->query("update endpoints set endpointURL='{$v['endpointURL']}', wsdlURL='{$v['wsdlURL']}', status=1 where id={$this->endpoints[$v['endpointName']]['id']}"); } else { - $this->dbc->query("insert into endpoints (endpointName,endpointURL,wsdlURL,class) values('{$v['endpointName']}','{$v['endpointURL']}','{$v['wsdlURL']}','$test')"); + $res = $this->dbc->query("insert into endpoints (endpointName,endpointURL,wsdlURL,class) values('{$v['endpointName']}','{$v['endpointURL']}','{$v['wsdlURL']}','$test')"); + } + if (DB::isError($res)) { + die ($res->getMessage()); } + $res->free(); } } @@ -245,7 +253,11 @@ "and wsdl=$this->useWSDL and function=". $this->dbc->quote($test_name); #echo "\n".$sql; - $this->dbc->query($sql); + $res = $this->dbc->query($sql); + if (DB::isError($res)) { + die ($res->getMessage()); + } + if (is_object($res)) $res->free(); $sql = "insert into results (endpoint,stamp,class,type,wsdl,function,result,error,wire) ". "values($endpoint_id,".time().",'$this->currentTest',". @@ -255,12 +267,12 @@ $this->dbc->quote($error).",". ($wire?$this->dbc->quote($wire):"''").")"; #echo "\n".$sql; - $r = $this->dbc->query($sql); + $res = $this->dbc->query($sql); - if (DB::isError($r)) { - print $sql; - die ($r->getMessage()); + if (DB::isError($res)) { + die ($res->getMessage()); } + if (is_object($res)) $res->free(); } /** @@ -362,8 +374,18 @@ $namespace = false; $soapaction = false; } else { - $soap = new SOAP_Client($endpoint_info['endpointURL']); + if (!array_key_exists('client',$endpoint_info)) { + $endpoint_info['client'] = new SOAP_Client($endpoint_info['endpointURL']); + } + $soap = $endpoint_info['client']; $namespace = $soapaction = 'http://soapinterop.org/'; + // hack to make tests work with MS SoapToolkit + // it's the only one that uses this soapaction, and breaks if + // it isn't right. Can't wait for soapaction to be fully depricated + if ($this->currentTest == 'base' && + strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) { + $soapaction = 'urn:soapinterop'; + } } // add headers to the test if ($soap_test->headers) { @@ -434,7 +456,9 @@ } } else { $fault = array('faultcode'=>'RESULT', - 'faultstring'=>'The returned result did not match what we expected to receive'); + 'faultstring'=>'The returned result did not match what we expected to receive', + 'faultdetail'=>"SENT:\n".var_dump($soap_test->result['sent']). + "\n\nRECIEVED:\n".var_dump($soap_test->result['return'])); $soap_test->setResult(0,$fault['faultcode'], $soap->wire, $fault['faultstring'], @@ -477,7 +501,7 @@ $skipendpoint = FALSE; $this->totals['servers']++; - $endpoint_info['tests'] = array(); + #$endpoint_info['tests'] = array(); if ($this->show) print "Processing $endpoint at {$endpoint_info['endpointURL']}<br>\n"; @@ -495,9 +519,10 @@ $skipfault['faultstring'], $skipfault ); - $endpoint_info['tests'][] = &$soap_test; + #$endpoint_info['tests'][] = &$soap_test; $soap_test->showTestResult($this->debug); $this->_saveResults($endpoint_info['id'], $soap_test->method_name); + $soap_test->result = NULL; continue; } @@ -510,7 +535,7 @@ $skipfault['faultstring'], $skipfault ); - $endpoint_info['tests'][] = &$soap_test; + #$endpoint_info['tests'][] = &$soap_test; $this->totals['fail']++; } else { // run the endpoint test @@ -522,10 +547,11 @@ $skipfault = $soap_test->result['fault']; $this->totals['fail']++; } - $endpoint_info['tests'][] = &$soap_test; + #$endpoint_info['tests'][] = &$soap_test; } $soap_test->showTestResult($this->debug); $this->_saveResults($endpoint_info['id'], $soap_test); + $soap_test->result = NULL; $this->totals['calls']++; } if ($this->numservers && ++$i >= $this->numservers) break; @@ -546,6 +572,8 @@ foreach($dowsdl as $usewsdl) { $this->useWSDL = $usewsdl; foreach($this->paramTypes as $ptype) { + // skip a pointless test + if ($usewsdl && $ptype == 'soapval') break; $this->paramType = $ptype; $this->doTest(); } @@ -662,6 +690,8 @@ foreach($dowsdl as $usewsdl) { $this->useWSDL = $usewsdl; foreach($this->paramTypes as $ptype) { + // skip a pointless test + if ($usewsdl && $ptype == 'soapval') break; $this->paramType = $ptype; $this->outputTable(); } Index: pear/SOAP/interop/client_round2_params.php diff -u pear/SOAP/interop/client_round2_params.php:1.1 pear/SOAP/interop/client_round2_params.php:1.2 --- pear/SOAP/interop/client_round2_params.php:1.1 Sat Mar 30 17:57:56 2002 +++ pear/SOAP/interop/client_round2_params.php Sun Apr 7 19:22:33 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: client_round2_params.php,v 1.1 2002/03/30 22:57:56 shane Exp $ +// $Id: client_round2_params.php,v 1.2 2002/04/07 23:22:33 shane Exp $ // require_once 'SOAP/Header.php'; require_once 'SOAP/Value.php'; @@ -498,7 +498,7 @@ // echoMeStructRequest with endpoint as header destination, doesn't have to understand $test = new SOAP_Test('echoVoid', ''); $test->type = 'soapval'; -$test->headers[] = new SOAP_Header('echoMeStructRequest','SOAPStruct', +$test->headers[] = new SOAP_Header('echoMeStructRequest',NULL, array( #push struct elements into one soap value new SOAP_Value('varString','string','arg'), new SOAP_Value('varInt','int',34), @@ -512,7 +512,7 @@ // echoMeStructRequest with endpoint as header destination, must understand $test = new SOAP_Test('echoVoid', ''); $test->type = 'soapval'; -$test->headers[] = new SOAP_Header('echoMeStructRequest','SOAPStruct', +$test->headers[] = new SOAP_Header('echoMeStructRequest',NULL, array( #push struct elements into one soap value new SOAP_Value('varString','string','arg'), new SOAP_Value('varInt','int',34), @@ -526,7 +526,7 @@ // echoMeStructRequest with endpoint NOT header destination, doesn't have to understand $test = new SOAP_Test('echoVoid', ''); $test->type = 'soapval'; -$test->headers[] = new SOAP_Header('echoMeStructRequest','SOAPStruct', +$test->headers[] = new SOAP_Header('echoMeStructRequest',NULL, array( #push struct elements into one soap value new SOAP_Value('varString','string','arg'), new SOAP_Value('varInt','int',34), @@ -539,7 +539,7 @@ // echoMeStructRequest with endpoint NOT header destination, must understand $test = new SOAP_Test('echoVoid', ''); $test->type = 'soapval'; -$test->headers[] = new SOAP_Header('echoMeStructRequest','SOAPStruct', +$test->headers[] = new SOAP_Header('echoMeStructRequest',NULL, array( #push struct elements into one soap value new SOAP_Value('varString','string','arg'), new SOAP_Value('varInt','int',34), Index: pear/SOAP/interop/server_round2.php diff -u pear/SOAP/interop/server_round2.php:1.1 pear/SOAP/interop/server_round2.php:1.2 --- pear/SOAP/interop/server_round2.php:1.1 Sat Mar 30 17:57:56 2002 +++ pear/SOAP/interop/server_round2.php Sun Apr 7 19:22:33 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: server_round2.php,v 1.1 2002/03/30 22:57:56 shane Exp $ +// $Id: server_round2.php,v 1.2 2002/04/07 23:22:33 shane Exp $ // require_once 'SOAP/Server.php'; @@ -28,5 +28,8 @@ require_once 'server_round2_groupC.php'; $server->service($HTTP_RAW_POST_DATA); - +#echo "Content-Length is {$_SERVER['CONTENT_LENGTH']}\n\n"; +#echo "<!---\n\nlen:".strlen($HTTP_RAW_POST_DATA)."\n\n"; +#echo "[$HTTP_RAW_POST_DATA"; +#print "]\n\nend of input data-->"; ?> Index: pear/SOAP/test/test.utility.php diff -u pear/SOAP/test/test.utility.php:1.2 pear/SOAP/test/test.utility.php:1.3 --- pear/SOAP/test/test.utility.php:1.2 Mon Feb 25 01:14:33 2002 +++ pear/SOAP/test/test.utility.php Sun Apr 7 19:22:33 2002 @@ -56,8 +56,11 @@ function parseMessage($msg) { # strip line endings - $msg = preg_replace('/\r|\n/', '', $msg); + #$msg = preg_replace('/\r|\n/', ' ', $msg); $response = new SOAP_Parser($msg); + if ($response->fault) { + return $response->fault->getFault(); + } $return = $response->getResponse(); $v = $return->decode(); if (gettype($v) == 'array' && count($v)==1) { Index: pear/SOAP/interop/echoheadersvc.wsdl +++ pear/SOAP/interop/echoheadersvc.wsdl <?xml version="1.0"?> <definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/> <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/> <import location="http://www.whitemesa.com/interop/InteropTestC.wsdl" namespace="http://soapinterop.org/"/> <service name="interopLabEchoHeader"> <port name="interopPortEchoHdr" binding="tns:InteropEchoHeaderBinding"> <soap:address location="http://localhost/soap/server_round2.php"/> </port> </service> </definitions> Index: pear/SOAP/interop/interop.wsdl +++ pear/SOAP/interop/interop.wsdl <?xml version="1.0"?> <definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soapinterop.org/"> <import location="http://www.whitemesa.com/wsdl/wmmsgrouter.xsd" namespace="http://whitemesa.com/headers/soapmsgrouter.xsd"/> <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/> <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/> <service name="interopLab"> <port name="interopTestPort" binding="tns:InteropTestSoapBinding"> <soap:address location="http://localhost/soap/server_round2.php"/> </port> </service> </definitions> Index: pear/SOAP/interop/interopB.wsdl +++ pear/SOAP/interop/interopB.wsdl <?xml version="1.0"?> <definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/"/> <import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/xsd"/> <service name="interopLabB"> <port name="interopTestPortB" binding="tns:InteropTestSoapBindingB"> <soap:address location="http://localhost/soap/server_round2.php"/> </port> </service> </definitions>
« previous php.pear.cvs (#3124) next »