diff options
author | Ciro Mattia Gonano <ciromattia@gmail.com> | 2013-09-11 15:56:48 +0200 |
---|---|---|
committer | Ciro Mattia Gonano <ciromattia@gmail.com> | 2013-09-11 15:57:07 +0200 |
commit | 3069eaf35e833ffe4a1c1c7829dd7e168ae27420 (patch) | |
tree | d0c2e4d934cc34ba7d4232f759923b5a257dcb21 /framework/3rdParty/WsdlGen | |
parent | b833247ce597ec26159b46c8dfbea7f1e265950b (diff) |
Merge up to r3319
Diffstat (limited to 'framework/3rdParty/WsdlGen')
-rw-r--r-- | framework/3rdParty/WsdlGen/Wsdl.php | 11 | ||||
-rw-r--r-- | framework/3rdParty/WsdlGen/WsdlGenerator.php | 32 |
2 files changed, 37 insertions, 6 deletions
diff --git a/framework/3rdParty/WsdlGen/Wsdl.php b/framework/3rdParty/WsdlGen/Wsdl.php index 5d9c6aec..8cfee9cc 100644 --- a/framework/3rdParty/WsdlGen/Wsdl.php +++ b/framework/3rdParty/WsdlGen/Wsdl.php @@ -12,7 +12,7 @@ * * @author Marcus Nyeholt <tanus@users.sourceforge.net> * @author Wei Zhuo <weizhuo[at]gmail[dot]com> - * @version $Id: Wsdl.php 3188 2012-07-12 12:13:23Z ctrlaltca $ + * @version $Id: Wsdl.php 3314 2013-08-20 10:00:47Z ctrlaltca $ * @package System.Web.Services.SOAP */ @@ -90,7 +90,8 @@ class Wsdl { $this->_encoding = $encoding; $this->serviceName = $name; - if ($serviceUri == '') $serviceUri = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; + $protocol=(isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!=='off'))?'https://':'http://'; + if ($serviceUri === '') $serviceUri = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $this->serviceUri = str_replace('&', '&', $serviceUri); $this->types = new ArrayObject(); $this->targetNamespace = 'urn:'.$name.'wsdl'; @@ -167,6 +168,12 @@ class Wsdl $e = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:element'); $e->setAttribute('name', $elem['name']); $e->setAttribute('type', $elem['type']); + if($elem['minOc']!==false) + $e->setAttribute('minOccurs',$elem['minOc']); + if($elem['maxOc']!==false) + $e->setAttribute('maxOccurs',$elem['maxOc']); + if($elem['nil']!==false) + $e->setAttribute('nillable',$elem['nil']); $all->appendChild($e); } $complexType->appendChild($all); diff --git a/framework/3rdParty/WsdlGen/WsdlGenerator.php b/framework/3rdParty/WsdlGen/WsdlGenerator.php index b208fb8b..0bc2e6d4 100644 --- a/framework/3rdParty/WsdlGen/WsdlGenerator.php +++ b/framework/3rdParty/WsdlGen/WsdlGenerator.php @@ -11,7 +11,7 @@ * This file is part of the PRADO framework from {@link http://www.xisc.com} * * @author Marcus Nyeholt <tanus@users.sourceforge.net> - * @version $Id: WsdlGenerator.php 3188 2012-07-12 12:13:23Z ctrlaltca $ + * @version $Id: WsdlGenerator.php 3314 2013-08-20 10:00:47Z ctrlaltca $ * @package System.Web.Services.SOAP */ @@ -282,11 +282,35 @@ class WsdlGenerator $comment = $property->getDocComment(); if(strpos($comment, '@soapproperty') !== false) { - if (preg_match('/@var\s+(\w+(\[\])?)\s+\$(\w+)/mi', $comment, $match)) { + if(preg_match('/@var\s+([\w\.]+(\[\s*\])?)\s*?\$(.*)$/mi',$comment,$matches)) + { + // support nillable, minOccurs, maxOccurs attributes + $nillable=$minOccurs=$maxOccurs=false; + if(preg_match('/{(.+)}/',$matches[3],$attr)) + { + $matches[3]=str_replace($attr[0],'',$matches[3]); + if(preg_match_all('/((\w+)\s*=\s*(\w+))/mi',$attr[1],$attr)) + { + foreach($attr[2] as $id=>$prop) + { + if(strcasecmp($prop,'nillable')===0) + $nillable=$attr[3][$id] ? 'true' : 'false'; + elseif(strcasecmp($prop,'minOccurs')===0) + $minOccurs=(int)$attr[3][$id]; + elseif(strcasecmp($prop,'maxOccurs')===0) + $maxOccurs=(int)$attr[3][$id]; + } + } + } + $param = array(); - $param['type'] = $this->convertType($match[1]); - $param['name'] = $match[3]; + $param['type'] = $this->convertType($matches[1]); + $param['name'] = trim($matches[3]); + $param['nil'] = $nillable; + $param['minOc'] = $minOccurs; + $param['maxOc'] = $maxOccurs; $this->types[$className][] = $param; + } } } |