cvs: pear /SOAP Base.php Message.php Parser.php Transport.php Value.php WSDL.php /SOAP/Transport HTTP.php SMTP.php /SOAP/interop client_round2.php
client_round2_interop.php /SOAP/test 5.2.simpletypes.php
| From: | Shane Caraveo | Date: | Mon, 08 Apr 2002 07:11:52 +0000 |
| Subject: | cvs: pear /SOAP Base.php Message.php Parser.php Transport.php Value.php WSDL.php /SOAP/Transport HTTP.php SMTP.php /SOAP/interop client_round2.php client_round2_interop.php /SOAP/test 5.2.simpletypes.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-3132@lists.php.net to get a copy of this message | ||
shane Mon Apr 8 03:11:52 2002 EDT
Modified files:
/pear/SOAP Base.php Message.php Parser.php Transport.php Value.php
WSDL.php
/pear/SOAP/Transport HTTP.php SMTP.php
/pear/SOAP/interop client_round2.php client_round2_interop.php
/pear/SOAP/test 5.2.simpletypes.php
Log:
general cleanup work
remove lots of uneeded debug use
optimize or fix some minor things
Index: pear/SOAP/Base.php diff -u pear/SOAP/Base.php:1.5 pear/SOAP/Base.php:1.6 --- pear/SOAP/Base.php:1.5 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/Base.php Mon Apr 8 03:11:51 2002 @@ -17,13 +17,13 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Base.php,v 1.5 2002/03/30 23:13:21 shane Exp $ +// $Id: Base.php,v 1.6 2002/04/08 07:11:51 shane Exp $ // /** * Common base class of all Soap lclasses * -* @version $Id: Base.php,v 1.5 2002/03/30 23:13:21 shane Exp $ +* @version $Id: Base.php,v 1.6 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -112,8 +112,6 @@ 'SOAP_Fault', $skipmsg); } - $this->debug($this->fault->toString()); - return $this->fault; } @@ -138,10 +136,14 @@ #var $arrayInfo = ''; function QName($name) { - $s = split(':',$name); - $s = array_reverse($s); - $this->name = $s[0]; - $this->ns = $s[1]; + if (strpos($name, ':') != FALSE) { + $s = split(':',$name); + $s = array_reverse($s); + $this->name = $s[0]; + $this->ns = $s[1]; + } else { + $this->name = $name; + } # a little more magic than should be in a qname #$p = strpos($this->name, '['); @@ -153,4 +155,4 @@ #} } } -?> \ No newline at end of file +?> Index: pear/SOAP/Message.php diff -u pear/SOAP/Message.php:1.10 pear/SOAP/Message.php:1.11 --- pear/SOAP/Message.php:1.10 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/Message.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Message.php,v 1.10 2002/03/30 23:13:21 shane Exp $ +// $Id: Message.php,v 1.11 2002/04/08 07:11:51 shane Exp $ // require_once 'SOAP/globals.php'; @@ -33,7 +33,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Message.php,v 1.10 2002/03/30 23:13:21 shane Exp $ +* @version $Id: Message.php,v 1.11 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Message * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -78,9 +78,8 @@ */ function SOAP_Message($new_namespaces = NULL, $wsdl = NULL) { - $this->debug_data = "entering SOAP_Message()\n"; parent::SOAP_Base('Message'); - $this->wsdl = $wsdl; + $this->wsdl = $wsdl; if (is_array($new_namespaces)) { global $SOAP_namespaces; $i = count($SOAP_namespaces); @@ -99,8 +98,7 @@ function method($method, $params, $method_namespace = NULL) { // make method struct - $this->value = new SOAP_Value($method, 'Struct', $params, $method_namespace, NULL, $wsdl); - $this->debug_data = 'SOAP_Message() with method SOAP_Value ' . $this->value->name . "\n"; + $this->value = new SOAP_Value($method, 'Struct', $params, $method_namespace, NULL, $this->wsdl); } /** @@ -117,12 +115,9 @@ $ns_string = ''; foreach ($SOAP_namespaces as $k => $v) { - $ns_string .= "xmlns:$v=\"$k\"\n "; + $ns_string .= " xmlns:$v=\"$k\"\r\n "; } - return "<SOAP-ENV:Envelope $ns_string SOAP-ENV:encodingStyle=\"" . SOAP_SCHEMA_ENCODING . "\">\n" . - $header . - $body . - "</SOAP-ENV:Envelope>\n"; + return "<?xml version=\"1.0\"?>\r\n\r\n<SOAP-ENV:Envelope $ns_string SOAP-ENV:encodingStyle=\"" . SOAP_SCHEMA_ENCODING . "\">\r\n$header$body</SOAP-ENV:Envelope>\r\n"; } /** @@ -140,7 +135,7 @@ $payload .= $header->serialize(); } if (!$payload) return NULL; - return "<SOAP-ENV:Header>\n" . $payload . "</SOAP-ENV:Header>\n"; + return "<SOAP-ENV:Header>\r\n$payload</SOAP-ENV:Header>\r\n"; } /** @@ -153,7 +148,7 @@ */ function _makeBody($payload) { - return "<SOAP-ENV:Body>\n" . $payload . "</SOAP-ENV:Body>\n"; + return "<SOAP-ENV:Body>\r\n$payload</SOAP-ENV:Body>\r\n"; } /** @@ -165,13 +160,7 @@ { $body = $this->value?$this->_makeBody($this->value->serialize()):NULL; $header = count($this->headers)?$this->_makeHeader():NULL; - $payload = $this->_makeEnvelope($header, $body); - $this->debug($value->debug_data); - $payload = "<?xml version=\"1.0\"?>\n\n" . $payload; - if ($this->debug_flag) { - $payload .= $this->serializeDebug(); - } - $this->payload = str_replace("\n", "\r\n", $payload); + $this->payload = $this->_makeEnvelope($header, $body); } /** @@ -199,31 +188,12 @@ */ function parseResponse($data) { - $this->debug('Entering parseResponse()'); - $this->debug(" w/ data $data"); - $this->debug('about to create parser instance w/ data'); - // parse response $response = new SOAP_Parser($data); // return array of parameters $ret = $response->getResponse(); - $this->debug($response->debug_data); return $ret; } - /** - * preps debug data for encoding into SOAP::Message - * - * @return string - * @access private - */ - function serializeDebug() - { - if ($this->debug_flag) { - return "<!-- DEBUG INFO:\n" . $this->debug_data . "-->\n"; - } - - return ''; - } } -?> \ No newline at end of file +?> Index: pear/SOAP/Parser.php diff -u pear/SOAP/Parser.php:1.13 pear/SOAP/Parser.php:1.14 --- pear/SOAP/Parser.php:1.13 Sun Apr 7 19:22:32 2002 +++ pear/SOAP/Parser.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Parser.php,v 1.13 2002/04/07 23:22:32 shane Exp $ +// $Id: Parser.php,v 1.14 2002/04/08 07:11:51 shane Exp $ // 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: Parser.php,v 1.13 2002/04/07 23:22:32 shane Exp $ +* @version $Id: Parser.php,v 1.14 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Parser * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -73,38 +73,26 @@ // determines where in the message we are (envelope,header,body,method) // Check whether content has been read. if (!empty($this->xml)) { - $this->debug('Entering SOAP_Parser()'); - - //$this->debug("DATA DUMP:\n\n$xml"); - // Create an XML parser. + // prepare the xml parser $parser = xml_parser_create($this->xml_encoding); - // Set the options for parsing the XML data. - //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. xml_set_object($parser, &$this); - - // Set the element handlers for the parser. xml_set_element_handler($parser, 'startElement','endElement'); xml_set_character_data_handler($parser,'characterData'); - xml_set_default_handler($parser, 'defaultHandler'); // Parse the XML file. if (!xml_parse($parser,$this->xml,true)) { - // Display an error message. $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 + // build the response $this->soapresponse = $this->buildResponse($this->root_struct[0]); - $this->soapheaders = $this->buildResponse($this->header_struct[0]); + if (count($this->header_struct)) + $this->soapheaders = $this->buildResponse($this->header_struct[0]); } xml_parser_free($parser); - } else { - $this->debug('xml was empty, didn\'t parse!'); } } @@ -124,14 +112,10 @@ $response = NULL; if ($this->message[$pos]['children'] != '') { - $this->debug('children string = '.$this->message[$pos]['children']); $children = explode('|',$this->message[$pos]['children']); - $this->debug('it has '.count($children).' children'); foreach ($children as $c => $child_pos) { - //$this->debug("child pos $child_pos: ".$this->message[$child_pos]['name']); if ($this->message[$child_pos]['type'] != NULL) { - $this->debug('entering buildResponse() for '.$this->message[$child_pos]['name'].", array pos $c, pos: $child_pos"); $response[] = $this->buildResponse($child_pos); } } @@ -171,18 +155,15 @@ } // add current node's value if ($response) { - #print "Parser creating: {$this->message[$pos]["name"]} type: {$this->message[$pos]["type"]}\n"; $response = new SOAP_Value($this->message[$pos]["name"], $this->message[$pos]["type"] , $response, $this->message[$pos]["namespace"], $this->message[$pos]['type_namespace']); } else { - #print "Parser creating: {$this->message[$pos]["name"]} type: {$this->message[$pos]["type"]}\n"; - $this->debug('inside buildresponse: creating SOAP_Value '.$this->message[$pos]['name'].' of type '.$this->message[$pos]['type'].' and value: '.$this->message[$pos]['cdata']); $response = new SOAP_Value($this->message[$pos]['name'], $this->message[$pos]['type'] , $this->message[$pos]['cdata'], $this->message[$pos]["namespace"], $this->message[$pos]['type_namespace']); } // handle header attribute that we need - if ($this->message[$pos]['actor']) { + if (array_key_exists('actor',$this->message[$pos])) { $response->actor = $this->message[$pos]['actor']; } - if ($this->message[$pos]['mustUnderstand']) { + if (array_key_exists('mustUnderstand',$this->message[$pos])) { $response->mustunderstand = $this->message[$pos]['mustUnderstand']; } return $response; @@ -322,7 +303,6 @@ $ref_pos = $this->references[$ref]; $this->message[$pos]['cdata'] = &$this->message[$ref_pos]['cdata']; $this->message[$pos]['type'] = &$this->message[$ref_pos]['type']; - $this->message[$pos]['inval'] = &$this->message[$ref_pos]['inval']; } else { # reverse reference, store in 'need reference' if (!is_array($this->need_references[$ref])) $this->need_references[$ref] = array(); @@ -365,16 +345,6 @@ } } - // set eval str start if it has a valid type and is inside the method - if ($pos >= $this->curent_root_struct) { - $this->message[$pos]['inval'] = 'true'; - } - - // if in the process of making a soap_val, close the parentheses and move on... - if ($this->message[$pos]['inval'] == 'true') { - $this->message[$pos]['inval'] == 'false'; - } - // if tag we are currently closing is the method wrapper if ($pos == $this->curent_root_struct) { $this->status = 'body'; @@ -384,8 +354,6 @@ // set parent back to my parent $this->parent = $this->message[$pos]['parent']; - $this->debug("parsed $name end, type '".$this->message[$pos]['type']."' children = ".$this->message[$pos]['children']); - #print ("parsed $name end, type '".$this->message[$pos]['type']."' children = ".$this->message[$pos]['children']."\n"); # handle any reverse references now $idref = $this->message[$pos]['id']; @@ -396,7 +364,6 @@ $this->message[$ref_pos]['children'] = &$this->message[$pos]['children']; $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']; } @@ -412,30 +379,13 @@ $this->message[$pos]['cdata'] .= $data; } - // default handler - function defaultHandler($parser, $data) - { - //$this->debug("DEFAULT HANDLER: $data"); - } - - // function to check fault status - function fault() - { - if ($this->fault) { - return true; - } - return false; - } - // have this return a soap_val object function getResponse() { if ($this->soapresponse) { return $this->soapresponse; } - $this->debug('ERROR: did not successfully eval the msg'); - $this->fault = true; - return new SOAP_Value('Fault','Struct', array(new SOAP_Value('faultcode','string','SOAP-ENV:Parser'), new SOAP_Value('faultstring','string',"couldn't build response"))); + return $this->raiseSoapFault("couldn't build response"); } // have this return a soap_val object @@ -458,22 +408,4 @@ } } -/* -$testtext = '<?xml version=\'1.0\' encoding=\'UTF-8\'?> -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> -<SOAP-ENV:Body> -<ns1:echoStringResponse xmlns:ns1="http://soapinterop.org/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<return xsi:type="xsd:string">blah</return> -</ns1:echoStringResponse> - -</SOAP-ENV:Body> -</SOAP-ENV:Envelope> -'; - -$soapmsg = new SOAP_Parser($testtext); -$return = $soapmsg->getResponse(); -print_r($return); -$returnArray = $return->decode(); -print_r($returnArray); -*/ -?> \ No newline at end of file +?> Index: pear/SOAP/Transport.php diff -u pear/SOAP/Transport.php:1.11 pear/SOAP/Transport.php:1.12 --- pear/SOAP/Transport.php:1.11 Sat Mar 30 18:17:53 2002 +++ pear/SOAP/Transport.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Transport.php,v 1.11 2002/03/30 23:17:53 shane Exp $ +// $Id: Transport.php,v 1.12 2002/04/08 07:11:51 shane Exp $ // require_once 'SOAP/Base.php'; @@ -30,7 +30,7 @@ * no knowlege of the transport protocols is available at this level * * @access public -* @version $Id: Transport.php,v 1.11 2002/03/30 23:17:53 shane Exp $ +* @version $Id: Transport.php,v 1.12 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Transport * @author Shane Caraveo <shane@php.net> */ @@ -45,26 +45,15 @@ var $transport = NULL; /** - * Error message - * - * Used to communicate between SOAP_Transport() and send() - * - * @var string - */ - var $errmsg = ''; - - /** * SOAP::Transport constructor * * @param string $url soap endpoint url * * @access public */ - function SOAP_Transport($url, $debug = SOAP_DEBUG) + function SOAP_Transport($url) { parent::SOAP_Base('TRANSPORT'); - /* only HTTP transport for now, later look at url for scheme */ - $this->debug_flag = $debug; $urlparts = @parse_url($url); @@ -77,8 +66,7 @@ $this->transport = new SOAP_Transport_SMTP($url); return; } - $this->errmsg = "No Transport for {$urlparts['scheme']}"; - $this->raiseSoapFault($this->errmsg); + $this->raiseSoapFault("No Transport for {$urlparts['scheme']}"); } /** @@ -94,7 +82,7 @@ function &send(&$soap_data, $action = '', $timeout = 0) { if (!$this->transport) { - return $this->raiseSoapFault($this->errmsg); + return $this->fault; } $response = $this->transport->send($soap_data, $action, $timeout); @@ -102,8 +90,6 @@ return $this->raiseSoapFault($response); } - $this->debug("OUTGOING: ".$this->transport->outgoing_payload); - $this->debug("INCOMING: ".$this->transport->incoming_payload); #echo "\n OUTGOING: ".$this->transport->outgoing_payload."\n\n"; #echo "\n INCOMING: ".preg_replace("/>/",">\n",$this->transport->incoming_payload)."\n\n"; return $response; Index: pear/SOAP/Value.php diff -u pear/SOAP/Value.php:1.20 pear/SOAP/Value.php:1.21 --- pear/SOAP/Value.php:1.20 Sun Apr 7 19:22:32 2002 +++ pear/SOAP/Value.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Value.php,v 1.20 2002/04/07 23:22:32 shane Exp $ +// $Id: Value.php,v 1.21 2002/04/08 07:11:51 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.20 2002/04/07 23:22:32 shane Exp $ +* @version $Id: Value.php,v 1.21 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -122,16 +122,12 @@ global $SOAP_typemap, $SOAP_namespaces; parent::SOAP_Base('Value'); // detect type if not passed - - #print("Entering SOAP_Value - name: '$name' type: '$type' value: $value\n"); $this->name = $name; $this->wsdl = $wsdl; $this->type_namespace = $type_namespace; $this->type = $this->_getSoapType($value, $type, $name, $type_namespace); - #$this->debug("Entering SOAP_Value - name: '$name' type: '$type' value: $value"); - if ($methodNamespace) { $this->namespace = $methodNamespace; @@ -167,7 +163,7 @@ } } - if (in_array($this->type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION])) { + if (array_key_exists($this->type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION])) { // scalar $this->type_code = SOAP_VALUE_SCALAR; @@ -208,8 +204,6 @@ */ function addScalar($value, $type, $name = '') { - $this->debug("adding scalar '$name' of type '$type'"); - $this->value = $value; return true; } @@ -221,24 +215,18 @@ */ function addArray($vals) { - - $this->debug("adding array '$this->name' with ".count($vals).' vals'); $this->value = array(); if (is_array($vals) && count($vals) >= 1) { foreach ($vals as $k => $v) { - $this->debug("checking value $k : $v"); - // if SOAP_Value, add.. if (strcasecmp(get_class($v), 'SOAP_Value' ) == 0) { $this->value[] = $v; - $this->debug($v->debug_data); // else make obj and serialize } else { #$type = $this->arrayType; $type = $this->_getSoapType($v, $type, $k); $new_val = new SOAP_Value('item', $this->arrayType, $v); - $this->debug($new_val->debug_data); $this->value[] = $new_val; } } @@ -253,19 +241,16 @@ */ function addStruct($vals) { - $this->debug("adding struct '$this->name' with " . count($vals) . ' vals'); if (is_array($vals) && count($vals) >= 1) { foreach ($vals as $k => $v) { // if serialize, if SOAP_Value if (strcasecmp(get_class($v), 'SOAP_Value') == 0) { $this->value[] = $v; - $this->debug($v->debug_data); // else make obj and serialize } else { $type = NULL; $type = $this->_getSoapType($v, $type, $k); $new_val = new SOAP_Value($k, $type, $v); - $this->debug($new_val->debug_data); $this->value[] = $new_val; } } @@ -336,8 +321,6 @@ $soapval = $this; } - $this->debug("serializing '$soapval->name' of type '$soapval->type'"); - if (is_int($soapval->name)) { $soapval->name = 'item'; $soapval->prefix = ''; @@ -424,9 +407,9 @@ } if ($xmlout_type) $xmlout_type = " xsi:type=\"$xmlout_type\""; - $xml = "\n<{$xmlout_name}{$xmlout_type}{$xmlout_arrayType}{$xmlout_offset}". + $xml = "<{$xmlout_name}{$xmlout_type}{$xmlout_arrayType}{$xmlout_offset}". $this->xmlout_extra.">". - $xmlout_value."</$xmlout_name>\n"; + $xmlout_value."</$xmlout_name>\r\n"; return $xml; } @@ -454,11 +437,9 @@ $soapval = $this; } - $this->debug("inside SOAP_Value->decode for $soapval->name of type $soapval->type and value: $soapval->value"); // scalar decode if ($soapval->type_code == SOAP_VALUE_SCALAR) { if ($soapval->type == 'boolean') { - #echo strcasecmp($soapval->value,'false'); if ($soapval->value != '0' && strcasecmp($soapval->value,'false') !=0) { $soapval->value = TRUE; } else { @@ -470,11 +451,10 @@ # # THOUGHT: we could return a class instead. # $dt = new SOAP_Type_dateTime($soapval->value); # $soapval->value = $dt->toUnixtime(); - } else if (in_array($soapval->type, array_keys($SOAP_typemap[SOAP_XML_SCHEMA_VERSION]), TRUE)) { + } else if (array_key_exists($soapval->type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION])) { # if we can, lets set php's variable type settype($soapval->value, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]); } - #print "value: $soapval->value type: $soapval->type phptype: {$SOAP_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]}\n"; return $soapval->value; // array decode } elseif ($soapval->type_code == SOAP_VALUE_ARRAY) { @@ -514,25 +494,12 @@ */ function verifyType($type) { - global $SOAP_typemap, $SOAP_namespaces; - /*foreach ($SOAP_typemap as $namespace => $types) { - if (is_array($types) && in_array($type,$types)) { - return $namespace; - } - }*/ - #if ($this->wsdl && array_key_exists($type, $this->wsdl->complexTypes)) { - # # XXX should return the import uri if the complex type was imported - # return $this->wsdl->uri; - #} - foreach ($SOAP_namespaces as $uri => $prefix) { - if (is_array($SOAP_typemap[$uri]) && isset($SOAP_typemap[$uri][$type])) { - #print "returning: $uri for type $type\n"; - return $uri; - } - #print "$type not in: $uri\n"; + global $SOAP_typemap; + foreach ($SOAP_typemap as $uri => $types) { + if (array_key_exists($type,$types)) return $uri; } - #print "$type not found\n"; - return false; + return FALSE; + #return array_key_exists($type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION]); } /** @@ -568,7 +535,6 @@ if (!$type && $name) { # XXX TODO: # look up the name in the wsdl and validate the type - $this->debug("SOAP_VALUE no type for $name!"); if ($this->type) { foreach ($this->wsdl->complexTypes as $types) { if (array_key_exists($this->type, $types) && @@ -748,4 +714,4 @@ return count($names)>1; } -?> \ No newline at end of file +?> Index: pear/SOAP/WSDL.php diff -u pear/SOAP/WSDL.php:1.16 pear/SOAP/WSDL.php:1.17 --- pear/SOAP/WSDL.php:1.16 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/WSDL.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: WSDL.php,v 1.16 2002/03/30 23:13:21 shane Exp $ +// $Id: WSDL.php,v 1.17 2002/04/08 07:11:51 shane Exp $ // require_once 'SOAP/Base.php'; require_once 'SOAP/Fault.php'; @@ -38,7 +38,7 @@ * implement IDL type syntax declaration so we can generate WSDL * * @access public -* @version $Id: WSDL.php,v 1.16 2002/03/30 23:13:21 shane Exp $ +* @version $Id: WSDL.php,v 1.17 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -296,7 +296,7 @@ } } if (!$md5_wsdl) { - $fd = @file($wsdl_fname); + $fd = @file($wsdl_fname); // time consumer if (!$fd) { return $this->raiseSoapFault("Unable to retrieve WSDL", $wsdl_fname); } @@ -335,22 +335,21 @@ var $schema = ''; var $schemaStatus = ''; var $status = ''; - + var $schema_stack = array(); var $cache; // constructor - function SOAP_WSDL_Parser($uri, &$wsdl) { + function SOAP_WSDL_Parser($uri, &$wsdl, $docs=false) { parent::SOAP_Base('WSDLPARSER'); $this->cache = new SOAP_WSDL_Cache(); $this->uri = $uri; $this->wsdl = &$wsdl; + $this->docs = $docs; $this->parse($uri); } function parse($uri) { // Check whether content has been read. - // XXX implement caching - #$fd = @file($uri); $fd = $this->cache->get($uri); if (PEAR::isError($fd)) { return $this->raiseSoapFault($fd); @@ -358,17 +357,11 @@ // Create an XML parser. $parser = xml_parser_create(); - // Set the options for parsing the XML data. - //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. xml_set_object($parser, $this); - // Set the element handlers for the parser. xml_set_element_handler($parser, 'startElement', 'endElement'); - xml_set_character_data_handler($parser, 'characterData'); - //xml_set_default_handler($this->parser, 'defaultHandler'); + if ($this->docs) xml_set_character_data_handler($parser, 'characterData'); - // Parse the XML file. if (!xml_parse($parser,$fd, true)) { $detail = sprintf('XML error on line %d: %s', xml_get_current_line_number($parser), @@ -417,7 +410,7 @@ !array_key_exists($attrs['name'], $this->wsdl->complexTypes[$this->schema])) { $this->currentElement = $attrs['name']; - if ($attrs['base']) { + if (array_key_exists('base',$attrs)) { $qn = new QName($attrs['base']); $this->wsdl->complexTypes[$this->schema][$this->currentElement]['base'] = $qn->name; $this->wsdl->complexTypes[$this->schema][$this->currentElement]['baseNS'] = $qn->ns; @@ -431,7 +424,9 @@ if (array_key_exists('type',$attrs)) { $qname = new QName($attrs['type']); $attrs['type'] = $qname->name; - $attrs['namespace'] = $this->wsdl->namespaces[$qname->ns]; + if ($qname->ns && array_key_exists($qname->ns, $this->wsdl->namespaces)) { + $attrs['namespace'] = $this->wsdl->namespaces[$qname->ns]; + } } if ($parent_tag == 'schema') { # XXX this check if funky, but there are wsdl's with redefinitions, need to find out why. @@ -505,9 +500,11 @@ break; default: $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]= $attrs; - $qn = new QName($attrs['message']); - $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['message'] = $qn->name; - $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['namespace'] = $qn->ns; + if (array_key_exists('message',$attrs)) { + $qn = new QName($attrs['message']); + $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['message'] = $qn->name; + $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['namespace'] = $qn->ns; + } break; } break; @@ -561,17 +558,16 @@ case 'import': //XXX $import = ''; - if ($attrs['location']) { + if (array_key_exists('location',$attrs)) { $result = $this->parse($attrs['location'], $this->wsdl); if (PEAR::isError($result)) { return $result; } + $this->wsdl->imports[$attrs['namespace']] = array( + 'location' => $attrs['location'], + 'namespace' => $attrs['namespace']); + $this->currentImport = $attrs['namespace']; } - - $this->wsdl->imports[$attrs['namespace']] = array( - 'location' => $attrs['location'], - 'namespace' => $attrs['namespace']); - $this->currentImport = $attrs['namespace']; $this->status = 'import'; case 'types': $this->status = 'types'; Index: pear/SOAP/Transport/HTTP.php diff -u pear/SOAP/Transport/HTTP.php:1.11 pear/SOAP/Transport/HTTP.php:1.12 --- pear/SOAP/Transport/HTTP.php:1.11 Sun Apr 7 19:22:33 2002 +++ pear/SOAP/Transport/HTTP.php Mon Apr 8 03:11:51 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: HTTP.php,v 1.11 2002/04/07 23:22:33 shane Exp $ +// $Id: HTTP.php,v 1.12 2002/04/08 07:11:51 shane Exp $ // require_once 'SOAP/globals.php'; @@ -26,7 +26,7 @@ * HTTP Transport for SOAP * * @access public -* @version $Id: HTTP.php,v 1.11 2002/04/07 23:22:33 shane Exp $ +* @version $Id: HTTP.php,v 1.12 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Transport::HTTP * @author Shane Caraveo <shane@php.net> */ @@ -47,20 +47,6 @@ var $timeout = 4; /** - * Error number - * - * @var int - */ - var $errno = 0; - - /** - * Error message - * - * @var string - */ - var $errmsg = ''; - - /** * Array containing urlparts - parse_url() * * @var mixed @@ -115,7 +101,7 @@ function &send(&$msg, $action = '', $timeout = 0) { if (!$this->_validateUrl()) { - return $this->raiseSoapFault($this->errmsg); + return $this->fault; } if ($timeout) @@ -156,12 +142,11 @@ function _validateUrl() { if ( ! is_array($this->urlparts) ) { - $this->errno = 2; - $this->errmsg = "Unable to parse URL $url"; + $this->raiseSoapFault("Unable to parse URL $url"); return FALSE; } if (!isset($this->urlparts['host'])) { - $this->errmsg = "No host in URL $url"; + $this->raiseSoapFault("No host in URL $url"); return FALSE; } if (!isset($this->urlparts['port'])) { @@ -199,6 +184,7 @@ // if no content, return false return strlen($this->response) > 0; } + $this->raiseSoapFault('Invalid HTTP Response'); return FALSE; } @@ -245,15 +231,14 @@ $fp = fsockopen($this->urlparts['host'], $this->urlparts['port'], $this->errno, $this->errmsg); } if (!$fp) { - $this->errmsg = "Connect Error to {$this->urlparts['host']}:{$this->urlparts['port']}"; - return $this->raiseSoapFault($this->errmsg); + return $this->raiseSoapFault("Connect Error to {$this->urlparts['host']}:{$this->urlparts['port']}"); } if (!fputs($fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { - $this->errmsg = "Error POSTing Data to {$this->urlparts['host']}"; - return $this->raiseSoapFault($this->errmsg); + return $this->raiseSoapFault("Error POSTing Data to {$this->urlparts['host']}"); } // get reponse + // XXX time consumer while ($data = fread($fp, 32768)) { $this->incoming_payload .= $data; } @@ -261,8 +246,7 @@ fclose($fp); if (!$this->_parseResponse()) { - $this->errmsg = 'Invalid HTTP Response'; - return $this->raiseSoapFault($this->errmsg, $this->outgoing_payload."\n\n".$this->incoming_payload); + return $this->fault; } return $this->response; } @@ -282,9 +266,7 @@ * Your php must be compiled with CURL */ if (!extension_loaded('curl')) { - $this->errno = -1; - $this->errmsg = 'CURL Extension is required for HTTPS'; - return $this->raiseSoapFault($this->errmsg); + return $this->raiseSoapFault('CURL Extension is required for HTTPS'); } $this->_getRequest($msg, $action); Index: pear/SOAP/Transport/SMTP.php diff -u pear/SOAP/Transport/SMTP.php:1.5 pear/SOAP/Transport/SMTP.php:1.6 --- pear/SOAP/Transport/SMTP.php:1.5 Tue Mar 5 11:55:29 2002 +++ pear/SOAP/Transport/SMTP.php Mon Apr 8 03:11:51 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: SMTP.php,v 1.5 2002/03/05 16:55:29 uw Exp $ +// $Id: SMTP.php,v 1.6 2002/04/08 07:11:51 shane Exp $ // // Status: rough draft, untested // @@ -35,7 +35,7 @@ * SMTP Transport for SOAP * * @access public -* @version $Id: SMTP.php,v 1.5 2002/03/05 16:55:29 uw Exp $ +* @version $Id: SMTP.php,v 1.6 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Transport::SMTP * @author Shane Caraveo <shane@php.net> */ @@ -43,8 +43,6 @@ { var $credentials = ''; var $timeout = 4; // connect timeout - var $errno = 0; - var $errmsg = ''; var $urlparts = NULL; var $url = ''; var $incoming_payload = ''; @@ -77,7 +75,7 @@ function send(&$msg, $action = '', $timeout = 0) { if (!$this->_validateUrl()) { - return $this->raiseSoapFault($this->errmsg); + return $this->fault; } $headers = "From: $action\n". @@ -93,7 +91,7 @@ if ($result) { $val = new SOAP_Value('return','boolean',TRUE); } else { - $val = new SOAP_Value('Fault','struct',array( + $val = new SOAP_Value('Fault','Struct',array( new SOAP_Value('faultcode','string','SOAP-ENV:Transport:SMTP'), new SOAP_Value('faultstring','string',"couldn't send message to $action") )); @@ -132,15 +130,16 @@ function _validateUrl() { if ( ! is_array($this->urlparts) ) { - $this->errno = 2; - $this->errmsg = "Unable to parse URL $url"; + $this->raiseSoapFault("Unable to parse URL $url"); return FALSE; } if (!isset($this->urlparts['scheme']) || strcasecmp($this->urlparts['scheme'], 'mailto') != 0) { + $this->raiseSoapFault("Unable to parse URL $url"); return FALSE; } if (!isset($this->urlparts['path'])) { + $this->raiseSoapFault("Unable to parse URL $url"); return FALSE; } return TRUE; Index: pear/SOAP/interop/client_round2.php diff -u pear/SOAP/interop/client_round2.php:1.2 pear/SOAP/interop/client_round2.php:1.3 --- pear/SOAP/interop/client_round2.php:1.2 Sun Apr 7 19:22:33 2002 +++ pear/SOAP/interop/client_round2.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: client_round2.php,v 1.2 2002/04/07 23:22:33 shane Exp $ +// $Id: client_round2.php,v 1.3 2002/04/08 07:11:51 shane Exp $ // set_time_limit(0); require_once 'SOAP/interop/client_round2_interop.php'; @@ -29,11 +29,11 @@ // set some options $iop->currentTest = 'base'; // see $tests above $iop->paramType = 'soapval'; // 'php' or 'soapval' -$iop->useWSDL = 1; // 1= do wsdl tests +$iop->useWSDL = 0; // 1= do wsdl tests $iop->numServers = 0; // 0 = all $iop->specificEndpoint = ''; // test only this endpoint $iop->testMethod = ''; // test only this method -$iop->skipEndpointList = array(); // endpoints to skip +$iop->skipEndpointList = array('WASP for C++','MS SOAP ToolKit 2.0 Typed'); // endpoints to skip $this->nosave = 0; // 1= disable saving results to database // debug output $iop->show = 1; Index: pear/SOAP/interop/client_round2_interop.php diff -u pear/SOAP/interop/client_round2_interop.php:1.2 pear/SOAP/interop/client_round2_interop.php:1.3 --- pear/SOAP/interop/client_round2_interop.php:1.2 Sun Apr 7 19:22:33 2002 +++ pear/SOAP/interop/client_round2_interop.php Mon Apr 8 03:11:52 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: client_round2_interop.php,v 1.2 2002/04/07 23:22:33 shane Exp $ +// $Id: client_round2_interop.php,v 1.3 2002/04/08 07:11:52 shane Exp $ // require_once 'DB.php'; // PEAR/DB require_once 'SOAP/Client.php'; @@ -520,8 +520,8 @@ $skipfault ); #$endpoint_info['tests'][] = &$soap_test; - $soap_test->showTestResult($this->debug); - $this->_saveResults($endpoint_info['id'], $soap_test->method_name); + #$soap_test->showTestResult($this->debug); + #$this->_saveResults($endpoint_info['id'], $soap_test->method_name); $soap_test->result = NULL; continue; } Index: pear/SOAP/test/5.2.simpletypes.php diff -u pear/SOAP/test/5.2.simpletypes.php:1.3 pear/SOAP/test/5.2.simpletypes.php:1.4 --- pear/SOAP/test/5.2.simpletypes.php:1.3 Tue Mar 19 01:47:16 2002 +++ pear/SOAP/test/5.2.simpletypes.php Mon Apr 8 03:11:52 2002 @@ -38,7 +38,7 @@ new SOAP_Value("color","string","Blue") )); $val = $v->serialize(); -if (string_compare(str_replace("\r","",$expect), str_replace("\r","",$val))) { +if (string_compare(str_replace("\r\n","",$expect), str_replace("\r\n","",$val))) { print "$prefix Serialize Type OK\n"; } else { print "$prefix Serialize Type FAILED\n[$val]\n[$expect]\n"; @@ -61,12 +61,12 @@ <color xsi:type="xsd:string">Blue</color> </inputString> '; -$v = new SOAP_Value("inputString","struct",array('age'=>45, 'height'=> 5.9, 'displacement' => -450, 'color' => 'Blue')); +$v = new SOAP_Value("inputString","Struct",array('age'=>45, 'height'=> 5.9, 'displacement' => -450, 'color' => 'Blue')); $val = $v->serialize(); -if (string_compare(str_replace("\r","",$expect), str_replace("\r","",$val))) { +if (string_compare(str_replace("\r\n","",$expect), str_replace("\r\n","",$val))) { print "$prefix Serialize Unknown Type OK\n"; } else { - print "$prefix Serialize Unknown Type FAILED\n$val\n"; + print "$prefix Serialize Unknown Type FAILED\n[$val]\n[$expect]\n"; } # serialize a soap value with unknown type
Index: pear/SOAP/Base.php diff -u pear/SOAP/Base.php:1.5 pear/SOAP/Base.php:1.6 --- pear/SOAP/Base.php:1.5 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/Base.php Mon Apr 8 03:11:51 2002 @@ -17,13 +17,13 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Base.php,v 1.5 2002/03/30 23:13:21 shane Exp $ +// $Id: Base.php,v 1.6 2002/04/08 07:11:51 shane Exp $ // /** * Common base class of all Soap lclasses * -* @version $Id: Base.php,v 1.5 2002/03/30 23:13:21 shane Exp $ +* @version $Id: Base.php,v 1.6 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -112,8 +112,6 @@ 'SOAP_Fault', $skipmsg); } - $this->debug($this->fault->toString()); - return $this->fault; } @@ -138,10 +136,14 @@ #var $arrayInfo = ''; function QName($name) { - $s = split(':',$name); - $s = array_reverse($s); - $this->name = $s[0]; - $this->ns = $s[1]; + if (strpos($name, ':') != FALSE) { + $s = split(':',$name); + $s = array_reverse($s); + $this->name = $s[0]; + $this->ns = $s[1]; + } else { + $this->name = $name; + } # a little more magic than should be in a qname #$p = strpos($this->name, '['); @@ -153,4 +155,4 @@ #} } } -?> \ No newline at end of file +?> Index: pear/SOAP/Message.php diff -u pear/SOAP/Message.php:1.10 pear/SOAP/Message.php:1.11 --- pear/SOAP/Message.php:1.10 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/Message.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Message.php,v 1.10 2002/03/30 23:13:21 shane Exp $ +// $Id: Message.php,v 1.11 2002/04/08 07:11:51 shane Exp $ // require_once 'SOAP/globals.php'; @@ -33,7 +33,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Message.php,v 1.10 2002/03/30 23:13:21 shane Exp $ +* @version $Id: Message.php,v 1.11 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Message * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -78,9 +78,8 @@ */ function SOAP_Message($new_namespaces = NULL, $wsdl = NULL) { - $this->debug_data = "entering SOAP_Message()\n"; parent::SOAP_Base('Message'); - $this->wsdl = $wsdl; + $this->wsdl = $wsdl; if (is_array($new_namespaces)) { global $SOAP_namespaces; $i = count($SOAP_namespaces); @@ -99,8 +98,7 @@ function method($method, $params, $method_namespace = NULL) { // make method struct - $this->value = new SOAP_Value($method, 'Struct', $params, $method_namespace, NULL, $wsdl); - $this->debug_data = 'SOAP_Message() with method SOAP_Value ' . $this->value->name . "\n"; + $this->value = new SOAP_Value($method, 'Struct', $params, $method_namespace, NULL, $this->wsdl); } /** @@ -117,12 +115,9 @@ $ns_string = ''; foreach ($SOAP_namespaces as $k => $v) { - $ns_string .= "xmlns:$v=\"$k\"\n "; + $ns_string .= " xmlns:$v=\"$k\"\r\n "; } - return "<SOAP-ENV:Envelope $ns_string SOAP-ENV:encodingStyle=\"" . SOAP_SCHEMA_ENCODING . "\">\n" . - $header . - $body . - "</SOAP-ENV:Envelope>\n"; + return "<?xml version=\"1.0\"?>\r\n\r\n<SOAP-ENV:Envelope $ns_string SOAP-ENV:encodingStyle=\"" . SOAP_SCHEMA_ENCODING . "\">\r\n$header$body</SOAP-ENV:Envelope>\r\n"; } /** @@ -140,7 +135,7 @@ $payload .= $header->serialize(); } if (!$payload) return NULL; - return "<SOAP-ENV:Header>\n" . $payload . "</SOAP-ENV:Header>\n"; + return "<SOAP-ENV:Header>\r\n$payload</SOAP-ENV:Header>\r\n"; } /** @@ -153,7 +148,7 @@ */ function _makeBody($payload) { - return "<SOAP-ENV:Body>\n" . $payload . "</SOAP-ENV:Body>\n"; + return "<SOAP-ENV:Body>\r\n$payload</SOAP-ENV:Body>\r\n"; } /** @@ -165,13 +160,7 @@ { $body = $this->value?$this->_makeBody($this->value->serialize()):NULL; $header = count($this->headers)?$this->_makeHeader():NULL; - $payload = $this->_makeEnvelope($header, $body); - $this->debug($value->debug_data); - $payload = "<?xml version=\"1.0\"?>\n\n" . $payload; - if ($this->debug_flag) { - $payload .= $this->serializeDebug(); - } - $this->payload = str_replace("\n", "\r\n", $payload); + $this->payload = $this->_makeEnvelope($header, $body); } /** @@ -199,31 +188,12 @@ */ function parseResponse($data) { - $this->debug('Entering parseResponse()'); - $this->debug(" w/ data $data"); - $this->debug('about to create parser instance w/ data'); - // parse response $response = new SOAP_Parser($data); // return array of parameters $ret = $response->getResponse(); - $this->debug($response->debug_data); return $ret; } - /** - * preps debug data for encoding into SOAP::Message - * - * @return string - * @access private - */ - function serializeDebug() - { - if ($this->debug_flag) { - return "<!-- DEBUG INFO:\n" . $this->debug_data . "-->\n"; - } - - return ''; - } } -?> \ No newline at end of file +?> Index: pear/SOAP/Parser.php diff -u pear/SOAP/Parser.php:1.13 pear/SOAP/Parser.php:1.14 --- pear/SOAP/Parser.php:1.13 Sun Apr 7 19:22:32 2002 +++ pear/SOAP/Parser.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Parser.php,v 1.13 2002/04/07 23:22:32 shane Exp $ +// $Id: Parser.php,v 1.14 2002/04/08 07:11:51 shane Exp $ // 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: Parser.php,v 1.13 2002/04/07 23:22:32 shane Exp $ +* @version $Id: Parser.php,v 1.14 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Parser * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -73,38 +73,26 @@ // determines where in the message we are (envelope,header,body,method) // Check whether content has been read. if (!empty($this->xml)) { - $this->debug('Entering SOAP_Parser()'); - - //$this->debug("DATA DUMP:\n\n$xml"); - // Create an XML parser. + // prepare the xml parser $parser = xml_parser_create($this->xml_encoding); - // Set the options for parsing the XML data. - //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. xml_set_object($parser, &$this); - - // Set the element handlers for the parser. xml_set_element_handler($parser, 'startElement','endElement'); xml_set_character_data_handler($parser,'characterData'); - xml_set_default_handler($parser, 'defaultHandler'); // Parse the XML file. if (!xml_parse($parser,$this->xml,true)) { - // Display an error message. $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 + // build the response $this->soapresponse = $this->buildResponse($this->root_struct[0]); - $this->soapheaders = $this->buildResponse($this->header_struct[0]); + if (count($this->header_struct)) + $this->soapheaders = $this->buildResponse($this->header_struct[0]); } xml_parser_free($parser); - } else { - $this->debug('xml was empty, didn\'t parse!'); } } @@ -124,14 +112,10 @@ $response = NULL; if ($this->message[$pos]['children'] != '') { - $this->debug('children string = '.$this->message[$pos]['children']); $children = explode('|',$this->message[$pos]['children']); - $this->debug('it has '.count($children).' children'); foreach ($children as $c => $child_pos) { - //$this->debug("child pos $child_pos: ".$this->message[$child_pos]['name']); if ($this->message[$child_pos]['type'] != NULL) { - $this->debug('entering buildResponse() for '.$this->message[$child_pos]['name'].", array pos $c, pos: $child_pos"); $response[] = $this->buildResponse($child_pos); } } @@ -171,18 +155,15 @@ } // add current node's value if ($response) { - #print "Parser creating: {$this->message[$pos]["name"]} type: {$this->message[$pos]["type"]}\n"; $response = new SOAP_Value($this->message[$pos]["name"], $this->message[$pos]["type"] , $response, $this->message[$pos]["namespace"], $this->message[$pos]['type_namespace']); } else { - #print "Parser creating: {$this->message[$pos]["name"]} type: {$this->message[$pos]["type"]}\n"; - $this->debug('inside buildresponse: creating SOAP_Value '.$this->message[$pos]['name'].' of type '.$this->message[$pos]['type'].' and value: '.$this->message[$pos]['cdata']); $response = new SOAP_Value($this->message[$pos]['name'], $this->message[$pos]['type'] , $this->message[$pos]['cdata'], $this->message[$pos]["namespace"], $this->message[$pos]['type_namespace']); } // handle header attribute that we need - if ($this->message[$pos]['actor']) { + if (array_key_exists('actor',$this->message[$pos])) { $response->actor = $this->message[$pos]['actor']; } - if ($this->message[$pos]['mustUnderstand']) { + if (array_key_exists('mustUnderstand',$this->message[$pos])) { $response->mustunderstand = $this->message[$pos]['mustUnderstand']; } return $response; @@ -322,7 +303,6 @@ $ref_pos = $this->references[$ref]; $this->message[$pos]['cdata'] = &$this->message[$ref_pos]['cdata']; $this->message[$pos]['type'] = &$this->message[$ref_pos]['type']; - $this->message[$pos]['inval'] = &$this->message[$ref_pos]['inval']; } else { # reverse reference, store in 'need reference' if (!is_array($this->need_references[$ref])) $this->need_references[$ref] = array(); @@ -365,16 +345,6 @@ } } - // set eval str start if it has a valid type and is inside the method - if ($pos >= $this->curent_root_struct) { - $this->message[$pos]['inval'] = 'true'; - } - - // if in the process of making a soap_val, close the parentheses and move on... - if ($this->message[$pos]['inval'] == 'true') { - $this->message[$pos]['inval'] == 'false'; - } - // if tag we are currently closing is the method wrapper if ($pos == $this->curent_root_struct) { $this->status = 'body'; @@ -384,8 +354,6 @@ // set parent back to my parent $this->parent = $this->message[$pos]['parent']; - $this->debug("parsed $name end, type '".$this->message[$pos]['type']."' children = ".$this->message[$pos]['children']); - #print ("parsed $name end, type '".$this->message[$pos]['type']."' children = ".$this->message[$pos]['children']."\n"); # handle any reverse references now $idref = $this->message[$pos]['id']; @@ -396,7 +364,6 @@ $this->message[$ref_pos]['children'] = &$this->message[$pos]['children']; $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']; } @@ -412,30 +379,13 @@ $this->message[$pos]['cdata'] .= $data; } - // default handler - function defaultHandler($parser, $data) - { - //$this->debug("DEFAULT HANDLER: $data"); - } - - // function to check fault status - function fault() - { - if ($this->fault) { - return true; - } - return false; - } - // have this return a soap_val object function getResponse() { if ($this->soapresponse) { return $this->soapresponse; } - $this->debug('ERROR: did not successfully eval the msg'); - $this->fault = true; - return new SOAP_Value('Fault','Struct', array(new SOAP_Value('faultcode','string','SOAP-ENV:Parser'), new SOAP_Value('faultstring','string',"couldn't build response"))); + return $this->raiseSoapFault("couldn't build response"); } // have this return a soap_val object @@ -458,22 +408,4 @@ } } -/* -$testtext = '<?xml version=\'1.0\' encoding=\'UTF-8\'?> -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> -<SOAP-ENV:Body> -<ns1:echoStringResponse xmlns:ns1="http://soapinterop.org/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<return xsi:type="xsd:string">blah</return> -</ns1:echoStringResponse> - -</SOAP-ENV:Body> -</SOAP-ENV:Envelope> -'; - -$soapmsg = new SOAP_Parser($testtext); -$return = $soapmsg->getResponse(); -print_r($return); -$returnArray = $return->decode(); -print_r($returnArray); -*/ -?> \ No newline at end of file +?> Index: pear/SOAP/Transport.php diff -u pear/SOAP/Transport.php:1.11 pear/SOAP/Transport.php:1.12 --- pear/SOAP/Transport.php:1.11 Sat Mar 30 18:17:53 2002 +++ pear/SOAP/Transport.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Transport.php,v 1.11 2002/03/30 23:17:53 shane Exp $ +// $Id: Transport.php,v 1.12 2002/04/08 07:11:51 shane Exp $ // require_once 'SOAP/Base.php'; @@ -30,7 +30,7 @@ * no knowlege of the transport protocols is available at this level * * @access public -* @version $Id: Transport.php,v 1.11 2002/03/30 23:17:53 shane Exp $ +* @version $Id: Transport.php,v 1.12 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Transport * @author Shane Caraveo <shane@php.net> */ @@ -45,26 +45,15 @@ var $transport = NULL; /** - * Error message - * - * Used to communicate between SOAP_Transport() and send() - * - * @var string - */ - var $errmsg = ''; - - /** * SOAP::Transport constructor * * @param string $url soap endpoint url * * @access public */ - function SOAP_Transport($url, $debug = SOAP_DEBUG) + function SOAP_Transport($url) { parent::SOAP_Base('TRANSPORT'); - /* only HTTP transport for now, later look at url for scheme */ - $this->debug_flag = $debug; $urlparts = @parse_url($url); @@ -77,8 +66,7 @@ $this->transport = new SOAP_Transport_SMTP($url); return; } - $this->errmsg = "No Transport for {$urlparts['scheme']}"; - $this->raiseSoapFault($this->errmsg); + $this->raiseSoapFault("No Transport for {$urlparts['scheme']}"); } /** @@ -94,7 +82,7 @@ function &send(&$soap_data, $action = '', $timeout = 0) { if (!$this->transport) { - return $this->raiseSoapFault($this->errmsg); + return $this->fault; } $response = $this->transport->send($soap_data, $action, $timeout); @@ -102,8 +90,6 @@ return $this->raiseSoapFault($response); } - $this->debug("OUTGOING: ".$this->transport->outgoing_payload); - $this->debug("INCOMING: ".$this->transport->incoming_payload); #echo "\n OUTGOING: ".$this->transport->outgoing_payload."\n\n"; #echo "\n INCOMING: ".preg_replace("/>/",">\n",$this->transport->incoming_payload)."\n\n"; return $response; Index: pear/SOAP/Value.php diff -u pear/SOAP/Value.php:1.20 pear/SOAP/Value.php:1.21 --- pear/SOAP/Value.php:1.20 Sun Apr 7 19:22:32 2002 +++ pear/SOAP/Value.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Value.php,v 1.20 2002/04/07 23:22:32 shane Exp $ +// $Id: Value.php,v 1.21 2002/04/08 07:11:51 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.20 2002/04/07 23:22:32 shane Exp $ +* @version $Id: Value.php,v 1.21 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -122,16 +122,12 @@ global $SOAP_typemap, $SOAP_namespaces; parent::SOAP_Base('Value'); // detect type if not passed - - #print("Entering SOAP_Value - name: '$name' type: '$type' value: $value\n"); $this->name = $name; $this->wsdl = $wsdl; $this->type_namespace = $type_namespace; $this->type = $this->_getSoapType($value, $type, $name, $type_namespace); - #$this->debug("Entering SOAP_Value - name: '$name' type: '$type' value: $value"); - if ($methodNamespace) { $this->namespace = $methodNamespace; @@ -167,7 +163,7 @@ } } - if (in_array($this->type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION])) { + if (array_key_exists($this->type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION])) { // scalar $this->type_code = SOAP_VALUE_SCALAR; @@ -208,8 +204,6 @@ */ function addScalar($value, $type, $name = '') { - $this->debug("adding scalar '$name' of type '$type'"); - $this->value = $value; return true; } @@ -221,24 +215,18 @@ */ function addArray($vals) { - - $this->debug("adding array '$this->name' with ".count($vals).' vals'); $this->value = array(); if (is_array($vals) && count($vals) >= 1) { foreach ($vals as $k => $v) { - $this->debug("checking value $k : $v"); - // if SOAP_Value, add.. if (strcasecmp(get_class($v), 'SOAP_Value' ) == 0) { $this->value[] = $v; - $this->debug($v->debug_data); // else make obj and serialize } else { #$type = $this->arrayType; $type = $this->_getSoapType($v, $type, $k); $new_val = new SOAP_Value('item', $this->arrayType, $v); - $this->debug($new_val->debug_data); $this->value[] = $new_val; } } @@ -253,19 +241,16 @@ */ function addStruct($vals) { - $this->debug("adding struct '$this->name' with " . count($vals) . ' vals'); if (is_array($vals) && count($vals) >= 1) { foreach ($vals as $k => $v) { // if serialize, if SOAP_Value if (strcasecmp(get_class($v), 'SOAP_Value') == 0) { $this->value[] = $v; - $this->debug($v->debug_data); // else make obj and serialize } else { $type = NULL; $type = $this->_getSoapType($v, $type, $k); $new_val = new SOAP_Value($k, $type, $v); - $this->debug($new_val->debug_data); $this->value[] = $new_val; } } @@ -336,8 +321,6 @@ $soapval = $this; } - $this->debug("serializing '$soapval->name' of type '$soapval->type'"); - if (is_int($soapval->name)) { $soapval->name = 'item'; $soapval->prefix = ''; @@ -424,9 +407,9 @@ } if ($xmlout_type) $xmlout_type = " xsi:type=\"$xmlout_type\""; - $xml = "\n<{$xmlout_name}{$xmlout_type}{$xmlout_arrayType}{$xmlout_offset}". + $xml = "<{$xmlout_name}{$xmlout_type}{$xmlout_arrayType}{$xmlout_offset}". $this->xmlout_extra.">". - $xmlout_value."</$xmlout_name>\n"; + $xmlout_value."</$xmlout_name>\r\n"; return $xml; } @@ -454,11 +437,9 @@ $soapval = $this; } - $this->debug("inside SOAP_Value->decode for $soapval->name of type $soapval->type and value: $soapval->value"); // scalar decode if ($soapval->type_code == SOAP_VALUE_SCALAR) { if ($soapval->type == 'boolean') { - #echo strcasecmp($soapval->value,'false'); if ($soapval->value != '0' && strcasecmp($soapval->value,'false') !=0) { $soapval->value = TRUE; } else { @@ -470,11 +451,10 @@ # # THOUGHT: we could return a class instead. # $dt = new SOAP_Type_dateTime($soapval->value); # $soapval->value = $dt->toUnixtime(); - } else if (in_array($soapval->type, array_keys($SOAP_typemap[SOAP_XML_SCHEMA_VERSION]), TRUE)) { + } else if (array_key_exists($soapval->type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION])) { # if we can, lets set php's variable type settype($soapval->value, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]); } - #print "value: $soapval->value type: $soapval->type phptype: {$SOAP_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]}\n"; return $soapval->value; // array decode } elseif ($soapval->type_code == SOAP_VALUE_ARRAY) { @@ -514,25 +494,12 @@ */ function verifyType($type) { - global $SOAP_typemap, $SOAP_namespaces; - /*foreach ($SOAP_typemap as $namespace => $types) { - if (is_array($types) && in_array($type,$types)) { - return $namespace; - } - }*/ - #if ($this->wsdl && array_key_exists($type, $this->wsdl->complexTypes)) { - # # XXX should return the import uri if the complex type was imported - # return $this->wsdl->uri; - #} - foreach ($SOAP_namespaces as $uri => $prefix) { - if (is_array($SOAP_typemap[$uri]) && isset($SOAP_typemap[$uri][$type])) { - #print "returning: $uri for type $type\n"; - return $uri; - } - #print "$type not in: $uri\n"; + global $SOAP_typemap; + foreach ($SOAP_typemap as $uri => $types) { + if (array_key_exists($type,$types)) return $uri; } - #print "$type not found\n"; - return false; + return FALSE; + #return array_key_exists($type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION]); } /** @@ -568,7 +535,6 @@ if (!$type && $name) { # XXX TODO: # look up the name in the wsdl and validate the type - $this->debug("SOAP_VALUE no type for $name!"); if ($this->type) { foreach ($this->wsdl->complexTypes as $types) { if (array_key_exists($this->type, $types) && @@ -748,4 +714,4 @@ return count($names)>1; } -?> \ No newline at end of file +?> Index: pear/SOAP/WSDL.php diff -u pear/SOAP/WSDL.php:1.16 pear/SOAP/WSDL.php:1.17 --- pear/SOAP/WSDL.php:1.16 Sat Mar 30 18:13:21 2002 +++ pear/SOAP/WSDL.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: WSDL.php,v 1.16 2002/03/30 23:13:21 shane Exp $ +// $Id: WSDL.php,v 1.17 2002/04/08 07:11:51 shane Exp $ // require_once 'SOAP/Base.php'; require_once 'SOAP/Fault.php'; @@ -38,7 +38,7 @@ * implement IDL type syntax declaration so we can generate WSDL * * @access public -* @version $Id: WSDL.php,v 1.16 2002/03/30 23:13:21 shane Exp $ +* @version $Id: WSDL.php,v 1.17 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -296,7 +296,7 @@ } } if (!$md5_wsdl) { - $fd = @file($wsdl_fname); + $fd = @file($wsdl_fname); // time consumer if (!$fd) { return $this->raiseSoapFault("Unable to retrieve WSDL", $wsdl_fname); } @@ -335,22 +335,21 @@ var $schema = ''; var $schemaStatus = ''; var $status = ''; - + var $schema_stack = array(); var $cache; // constructor - function SOAP_WSDL_Parser($uri, &$wsdl) { + function SOAP_WSDL_Parser($uri, &$wsdl, $docs=false) { parent::SOAP_Base('WSDLPARSER'); $this->cache = new SOAP_WSDL_Cache(); $this->uri = $uri; $this->wsdl = &$wsdl; + $this->docs = $docs; $this->parse($uri); } function parse($uri) { // Check whether content has been read. - // XXX implement caching - #$fd = @file($uri); $fd = $this->cache->get($uri); if (PEAR::isError($fd)) { return $this->raiseSoapFault($fd); @@ -358,17 +357,11 @@ // Create an XML parser. $parser = xml_parser_create(); - // Set the options for parsing the XML data. - //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. xml_set_object($parser, $this); - // Set the element handlers for the parser. xml_set_element_handler($parser, 'startElement', 'endElement'); - xml_set_character_data_handler($parser, 'characterData'); - //xml_set_default_handler($this->parser, 'defaultHandler'); + if ($this->docs) xml_set_character_data_handler($parser, 'characterData'); - // Parse the XML file. if (!xml_parse($parser,$fd, true)) { $detail = sprintf('XML error on line %d: %s', xml_get_current_line_number($parser), @@ -417,7 +410,7 @@ !array_key_exists($attrs['name'], $this->wsdl->complexTypes[$this->schema])) { $this->currentElement = $attrs['name']; - if ($attrs['base']) { + if (array_key_exists('base',$attrs)) { $qn = new QName($attrs['base']); $this->wsdl->complexTypes[$this->schema][$this->currentElement]['base'] = $qn->name; $this->wsdl->complexTypes[$this->schema][$this->currentElement]['baseNS'] = $qn->ns; @@ -431,7 +424,9 @@ if (array_key_exists('type',$attrs)) { $qname = new QName($attrs['type']); $attrs['type'] = $qname->name; - $attrs['namespace'] = $this->wsdl->namespaces[$qname->ns]; + if ($qname->ns && array_key_exists($qname->ns, $this->wsdl->namespaces)) { + $attrs['namespace'] = $this->wsdl->namespaces[$qname->ns]; + } } if ($parent_tag == 'schema') { # XXX this check if funky, but there are wsdl's with redefinitions, need to find out why. @@ -505,9 +500,11 @@ break; default: $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]= $attrs; - $qn = new QName($attrs['message']); - $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['message'] = $qn->name; - $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['namespace'] = $qn->ns; + if (array_key_exists('message',$attrs)) { + $qn = new QName($attrs['message']); + $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['message'] = $qn->name; + $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['namespace'] = $qn->ns; + } break; } break; @@ -561,17 +558,16 @@ case 'import': //XXX $import = ''; - if ($attrs['location']) { + if (array_key_exists('location',$attrs)) { $result = $this->parse($attrs['location'], $this->wsdl); if (PEAR::isError($result)) { return $result; } + $this->wsdl->imports[$attrs['namespace']] = array( + 'location' => $attrs['location'], + 'namespace' => $attrs['namespace']); + $this->currentImport = $attrs['namespace']; } - - $this->wsdl->imports[$attrs['namespace']] = array( - 'location' => $attrs['location'], - 'namespace' => $attrs['namespace']); - $this->currentImport = $attrs['namespace']; $this->status = 'import'; case 'types': $this->status = 'types'; Index: pear/SOAP/Transport/HTTP.php diff -u pear/SOAP/Transport/HTTP.php:1.11 pear/SOAP/Transport/HTTP.php:1.12 --- pear/SOAP/Transport/HTTP.php:1.11 Sun Apr 7 19:22:33 2002 +++ pear/SOAP/Transport/HTTP.php Mon Apr 8 03:11:51 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: HTTP.php,v 1.11 2002/04/07 23:22:33 shane Exp $ +// $Id: HTTP.php,v 1.12 2002/04/08 07:11:51 shane Exp $ // require_once 'SOAP/globals.php'; @@ -26,7 +26,7 @@ * HTTP Transport for SOAP * * @access public -* @version $Id: HTTP.php,v 1.11 2002/04/07 23:22:33 shane Exp $ +* @version $Id: HTTP.php,v 1.12 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Transport::HTTP * @author Shane Caraveo <shane@php.net> */ @@ -47,20 +47,6 @@ var $timeout = 4; /** - * Error number - * - * @var int - */ - var $errno = 0; - - /** - * Error message - * - * @var string - */ - var $errmsg = ''; - - /** * Array containing urlparts - parse_url() * * @var mixed @@ -115,7 +101,7 @@ function &send(&$msg, $action = '', $timeout = 0) { if (!$this->_validateUrl()) { - return $this->raiseSoapFault($this->errmsg); + return $this->fault; } if ($timeout) @@ -156,12 +142,11 @@ function _validateUrl() { if ( ! is_array($this->urlparts) ) { - $this->errno = 2; - $this->errmsg = "Unable to parse URL $url"; + $this->raiseSoapFault("Unable to parse URL $url"); return FALSE; } if (!isset($this->urlparts['host'])) { - $this->errmsg = "No host in URL $url"; + $this->raiseSoapFault("No host in URL $url"); return FALSE; } if (!isset($this->urlparts['port'])) { @@ -199,6 +184,7 @@ // if no content, return false return strlen($this->response) > 0; } + $this->raiseSoapFault('Invalid HTTP Response'); return FALSE; } @@ -245,15 +231,14 @@ $fp = fsockopen($this->urlparts['host'], $this->urlparts['port'], $this->errno, $this->errmsg); } if (!$fp) { - $this->errmsg = "Connect Error to {$this->urlparts['host']}:{$this->urlparts['port']}"; - return $this->raiseSoapFault($this->errmsg); + return $this->raiseSoapFault("Connect Error to {$this->urlparts['host']}:{$this->urlparts['port']}"); } if (!fputs($fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { - $this->errmsg = "Error POSTing Data to {$this->urlparts['host']}"; - return $this->raiseSoapFault($this->errmsg); + return $this->raiseSoapFault("Error POSTing Data to {$this->urlparts['host']}"); } // get reponse + // XXX time consumer while ($data = fread($fp, 32768)) { $this->incoming_payload .= $data; } @@ -261,8 +246,7 @@ fclose($fp); if (!$this->_parseResponse()) { - $this->errmsg = 'Invalid HTTP Response'; - return $this->raiseSoapFault($this->errmsg, $this->outgoing_payload."\n\n".$this->incoming_payload); + return $this->fault; } return $this->response; } @@ -282,9 +266,7 @@ * Your php must be compiled with CURL */ if (!extension_loaded('curl')) { - $this->errno = -1; - $this->errmsg = 'CURL Extension is required for HTTPS'; - return $this->raiseSoapFault($this->errmsg); + return $this->raiseSoapFault('CURL Extension is required for HTTPS'); } $this->_getRequest($msg, $action); Index: pear/SOAP/Transport/SMTP.php diff -u pear/SOAP/Transport/SMTP.php:1.5 pear/SOAP/Transport/SMTP.php:1.6 --- pear/SOAP/Transport/SMTP.php:1.5 Tue Mar 5 11:55:29 2002 +++ pear/SOAP/Transport/SMTP.php Mon Apr 8 03:11:51 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: SMTP.php,v 1.5 2002/03/05 16:55:29 uw Exp $ +// $Id: SMTP.php,v 1.6 2002/04/08 07:11:51 shane Exp $ // // Status: rough draft, untested // @@ -35,7 +35,7 @@ * SMTP Transport for SOAP * * @access public -* @version $Id: SMTP.php,v 1.5 2002/03/05 16:55:29 uw Exp $ +* @version $Id: SMTP.php,v 1.6 2002/04/08 07:11:51 shane Exp $ * @package SOAP::Transport::SMTP * @author Shane Caraveo <shane@php.net> */ @@ -43,8 +43,6 @@ { var $credentials = ''; var $timeout = 4; // connect timeout - var $errno = 0; - var $errmsg = ''; var $urlparts = NULL; var $url = ''; var $incoming_payload = ''; @@ -77,7 +75,7 @@ function send(&$msg, $action = '', $timeout = 0) { if (!$this->_validateUrl()) { - return $this->raiseSoapFault($this->errmsg); + return $this->fault; } $headers = "From: $action\n". @@ -93,7 +91,7 @@ if ($result) { $val = new SOAP_Value('return','boolean',TRUE); } else { - $val = new SOAP_Value('Fault','struct',array( + $val = new SOAP_Value('Fault','Struct',array( new SOAP_Value('faultcode','string','SOAP-ENV:Transport:SMTP'), new SOAP_Value('faultstring','string',"couldn't send message to $action") )); @@ -132,15 +130,16 @@ function _validateUrl() { if ( ! is_array($this->urlparts) ) { - $this->errno = 2; - $this->errmsg = "Unable to parse URL $url"; + $this->raiseSoapFault("Unable to parse URL $url"); return FALSE; } if (!isset($this->urlparts['scheme']) || strcasecmp($this->urlparts['scheme'], 'mailto') != 0) { + $this->raiseSoapFault("Unable to parse URL $url"); return FALSE; } if (!isset($this->urlparts['path'])) { + $this->raiseSoapFault("Unable to parse URL $url"); return FALSE; } return TRUE; Index: pear/SOAP/interop/client_round2.php diff -u pear/SOAP/interop/client_round2.php:1.2 pear/SOAP/interop/client_round2.php:1.3 --- pear/SOAP/interop/client_round2.php:1.2 Sun Apr 7 19:22:33 2002 +++ pear/SOAP/interop/client_round2.php Mon Apr 8 03:11:51 2002 @@ -17,7 +17,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: client_round2.php,v 1.2 2002/04/07 23:22:33 shane Exp $ +// $Id: client_round2.php,v 1.3 2002/04/08 07:11:51 shane Exp $ // set_time_limit(0); require_once 'SOAP/interop/client_round2_interop.php'; @@ -29,11 +29,11 @@ // set some options $iop->currentTest = 'base'; // see $tests above $iop->paramType = 'soapval'; // 'php' or 'soapval' -$iop->useWSDL = 1; // 1= do wsdl tests +$iop->useWSDL = 0; // 1= do wsdl tests $iop->numServers = 0; // 0 = all $iop->specificEndpoint = ''; // test only this endpoint $iop->testMethod = ''; // test only this method -$iop->skipEndpointList = array(); // endpoints to skip +$iop->skipEndpointList = array('WASP for C++','MS SOAP ToolKit 2.0 Typed'); // endpoints to skip $this->nosave = 0; // 1= disable saving results to database // debug output $iop->show = 1; Index: pear/SOAP/interop/client_round2_interop.php diff -u pear/SOAP/interop/client_round2_interop.php:1.2 pear/SOAP/interop/client_round2_interop.php:1.3 --- pear/SOAP/interop/client_round2_interop.php:1.2 Sun Apr 7 19:22:33 2002 +++ pear/SOAP/interop/client_round2_interop.php Mon Apr 8 03:11:52 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: client_round2_interop.php,v 1.2 2002/04/07 23:22:33 shane Exp $ +// $Id: client_round2_interop.php,v 1.3 2002/04/08 07:11:52 shane Exp $ // require_once 'DB.php'; // PEAR/DB require_once 'SOAP/Client.php'; @@ -520,8 +520,8 @@ $skipfault ); #$endpoint_info['tests'][] = &$soap_test; - $soap_test->showTestResult($this->debug); - $this->_saveResults($endpoint_info['id'], $soap_test->method_name); + #$soap_test->showTestResult($this->debug); + #$this->_saveResults($endpoint_info['id'], $soap_test->method_name); $soap_test->result = NULL; continue; } Index: pear/SOAP/test/5.2.simpletypes.php diff -u pear/SOAP/test/5.2.simpletypes.php:1.3 pear/SOAP/test/5.2.simpletypes.php:1.4 --- pear/SOAP/test/5.2.simpletypes.php:1.3 Tue Mar 19 01:47:16 2002 +++ pear/SOAP/test/5.2.simpletypes.php Mon Apr 8 03:11:52 2002 @@ -38,7 +38,7 @@ new SOAP_Value("color","string","Blue") )); $val = $v->serialize(); -if (string_compare(str_replace("\r","",$expect), str_replace("\r","",$val))) { +if (string_compare(str_replace("\r\n","",$expect), str_replace("\r\n","",$val))) { print "$prefix Serialize Type OK\n"; } else { print "$prefix Serialize Type FAILED\n[$val]\n[$expect]\n"; @@ -61,12 +61,12 @@ <color xsi:type="xsd:string">Blue</color> </inputString> '; -$v = new SOAP_Value("inputString","struct",array('age'=>45, 'height'=> 5.9, 'displacement' => -450, 'color' => 'Blue')); +$v = new SOAP_Value("inputString","Struct",array('age'=>45, 'height'=> 5.9, 'displacement' => -450, 'color' => 'Blue')); $val = $v->serialize(); -if (string_compare(str_replace("\r","",$expect), str_replace("\r","",$val))) { +if (string_compare(str_replace("\r\n","",$expect), str_replace("\r\n","",$val))) { print "$prefix Serialize Unknown Type OK\n"; } else { - print "$prefix Serialize Unknown Type FAILED\n$val\n"; + print "$prefix Serialize Unknown Type FAILED\n[$val]\n[$expect]\n"; } # serialize a soap value with unknown type