Changeset 49
- Timestamp:
- 08/16/08 07:35:31 (4 years ago)
- Files:
-
- trunk/build.xml (modified) (2 diffs)
- trunk/src/bin/parser/DOMParser.php (modified) (4 diffs)
- trunk/src/bin/types/Function.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build.xml
r48 r49 29 29 <project name="SOAP_Toolkit" basedir="." default="main"> 30 30 31 <property name="version" value="0.6. 6" />31 <property name="version" value="0.6.7" /> 32 32 <property name="src.base.dir" value="src" /> 33 33 <property name="build.base.dir" value="build" /> … … 148 148 149 149 <option name="notes"> 150 FIXED: #67 3: Add LGPL code base - Added LGPL comment header to all source files, added COPYING and COPYING.LESSER to ditribution package150 FIXED: #674: Error on doc/lit wrapped messages with no elements 151 151 </option> 152 152 trunk/src/bin/parser/DOMParser.php
r48 r49 267 267 268 268 public function & GetMessageParameters($messageName, $isDoc = FALSE, $isLit = FALSE) { 269 $this->wl('GetMessageParameters:Enter', TRUE); 269 270 $query = "//*[local-name()='message'][@name='$messageName']/*[local-name()='part']"; 270 271 $partNodes = $this->xpath->query($query); 272 $this->wl("$messageName: found " . count($partNodes) . ' potential part nodes for this message', TRUE); 273 271 274 $nameAttribute = 'element'; // for document style 272 275 … … 303 306 $elemName = self::LocalName($partNode->getAttribute($nameAttribute)); 304 307 $this->wl("$messageName: using fields from element $elemName for parameters of message {$partNode->getAttribute('name')}"); 305 $query = "//*[local-name()='definitions']/*[local-name()='types']/*[local-name()='schema']/*[local-name()='element' and @name='$elemName']//*[local-name()='element']"; 306 $elemNodes = $this->xpath->query($query); 308 // Hey, guess what? Not every message element is going to have children (think void functions or fn's with no parameters) 309 // TRAC Bug #674 (http://trac.substring.no/projects/pst/ticket/674) 310 $query = "//*[local-name()='definitions']/*[local-name()='types']/*[local-name()='schema']/*[local-name()='element' and @name='$elemName']"; 311 $msgNodes = $this->xpath->query($query); 312 if ($msgNodes->length == 0) { 313 throw new Exception("Could not find a message element for $messageName"); 314 } 315 $parentNode = $msgNodes->item(0); 316 317 $elemNodes = $parentNode->getElementsByTagNameNS('element', '*'); 307 318 $this->wl("$messageName: found {$elemNodes->length} elements for type $elemName"); 308 319 foreach ($elemNodes as $elemNode) { … … 352 363 $messageTypes = $this->GetMessageParameters($messageName, $isDoc, $isLit); 353 364 354 if ($messageTypes == null || count($messageTypes) == 0) {355 throw new Exception("There are no part nodes for message type $messageName");356 }365 // if ($messageTypes == null || count($messageTypes) == 0) { 366 // throw new Exception("There are no part nodes for message type $messageName"); 367 // } 357 368 358 369 if (count($messageTypes) > 1) { 359 370 throw new Exception("More than one part node found for message type $messageName"); 360 371 } 361 $param = array_shift($messageTypes); 362 $msgTypeName = $param->getDataType(); 363 $this->wl("$messageName: found message type $msgTypeName for this message", TRUE); 364 365 return $msgTypeName; 372 if (count($messageTypes) == 1) { 373 $param = array_shift($messageTypes); 374 $msgTypeName = $param->getDataType(); 375 $this->wl("$messageName: found message type $msgTypeName for this message", TRUE); 376 return $msgTypeName; 377 } else { 378 return null; 379 } 366 380 } 367 381 … … 470 484 471 485 public function & ParseServiceFunction(DOMNode $node, $isDoc = FALSE, $isLit = FALSE) { 472 $name = Wsdl2Php_Filter_FunctionFilter::filter(trim($node->getAttribute('name')));473 $requestMessageName = $this->GetInputMessageName($node);474 $parameterNodes = $this->GetMessageParameters($requestMessageName, $isDoc, $isLit);486 $name = Wsdl2Php_Filter_FunctionFilter::filter(trim($node->getAttribute('name'))); 487 $requestMessageName = $this->GetInputMessageName($node); 488 $parameterNodes = $this->GetMessageParameters($requestMessageName, $isDoc, $isLit); 475 489 $responseMessageName = $this->GetOutputMessageName($node); 476 $returnType = $this->GetMessageTypeName($responseMessageName, $isDoc, $isLit);477 478 $function = new Wsdl2Php_Type_Function();490 $returnType = $this->GetMessageTypeName($responseMessageName, $isDoc, $isLit); 491 492 $function = new Wsdl2Php_Type_Function(); 479 493 480 494 $function->setName($name); 481 $function->setReturnType($returnType); 495 if (strlen($returnType) > 0) { 496 $function->setReturnType($returnType); 497 } 482 498 $function->setOriginalName($name); 483 499 $function->setDocumentation($this->GetDocumentationForNode($node)); trunk/src/bin/types/Function.php
r48 r49 28 28 private $originalName; 29 29 private $name; 30 private $returnType ;31 private $parameters ;30 private $returnType = 'void'; 31 private $parameters = array(); 32 32 33 33 private static $primitive_types = array('string', 'int', 'long', 'float', 'boolean', 'dateTime', 'double', 'short', 'UNKNOWN', 'base64Binary', 'decimal', 'hexBinary'); // TODO: dateTime is special, maybe use PEAR::Date or similar
