Skip to content

Commit

Permalink
Merge pull request #5 from g19i85g/bugfixes
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
borodulin committed Jul 16, 2015
2 parents 894cd79 + 9ae4da4 commit d60b5eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
10 changes: 4 additions & 6 deletions WebService.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ public function generateWsdl()
if(is_object($this->provider))
$providerClass=get_class($this->provider);
else{
\Yii::autoload($this->provider);
$providerClass=$this->provider;
}
if($this->wsdlCacheDuration>0 && $this->cacheID!==false && ($cache=\Yii::$app->get($this->cacheID,false))!==null)
Expand Down Expand Up @@ -241,7 +240,7 @@ public function run()
// We need to end application explicitly because of
// http://bugs.php.net/bug.php?id=49513
\Yii::$app->state = Application::STATE_AFTER_REQUEST;
\Yii::$app->trigger(Application::EVENT_AFTER_REQUEST);
\Yii::$app->trigger(Application::EVENT_AFTER_REQUEST);
$reflect = new \ReflectionClass($e);
$server->fault($reflect->getShortName(), $message);
exit(1);
Expand Down Expand Up @@ -283,7 +282,6 @@ protected function getOptions()
$options['encoding']=$this->encoding;
foreach($this->classMap as $type=>$className)
{
\Yii::autoload($className);
if(is_int($type))
$type=$className;
$options['classmap'][$type]=$className;
Expand Down Expand Up @@ -326,7 +324,7 @@ public function __call($name,$arguments)
{
return call_user_func_array(array($this->object,$name),$arguments);
}

/**
* Returns the fully qualified name of this class.
* @return string the fully qualified name of this class.
Expand Down Expand Up @@ -377,9 +375,9 @@ public function __call($name,$arguments)
{
$result = call_user_func_array(array($this->object, $name), $arguments);
}
return $result === null ? $result : array($name . 'Result' => $result);
return $result === null ? $result : array($name . 'Result' => $result);
}

/**
* Returns the fully qualified name of this class.
* @return string the fully qualified name of this class.
Expand Down
15 changes: 7 additions & 8 deletions WsdlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,15 @@ public function generateWsdl($className, $serviceUrl, $encoding='UTF-8')
$this->types=array();
$this->elements=array();
$this->messages=array();

$reflection=new \ReflectionClass($className);

if($this->serviceName===null)
$this->serviceName=$reflection->getShortName();

if($this->namespace===null)
$this->namespace='urn:'.str_replace('\\','/',$className).'wsdl';

foreach($reflection->getMethods() as $method)
{
if($method->isPublic())
Expand Down Expand Up @@ -379,9 +379,8 @@ protected function processType($type)
}
else
{ // process class / complex type
\Yii::autoload($type);
$class=new \ReflectionClass($type);

$type=$class->getShortName();

$comment=$class->getDocComment();
Expand Down Expand Up @@ -430,7 +429,7 @@ protected function processType($type)
$example=trim($match[1]);

$this->types[$type]['properties'][$property->getName()]=array(
$this->processType(str_replace('\\','/',$matches[1])),
$this->processType($matches[1]),
trim($matches[3]),
$attributes['nillable'],
$attributes['minOccurs'],
Expand Down Expand Up @@ -559,7 +558,7 @@ protected function addTypes($dom)
$attribute=$dom->createElement('xsd:attribute');
$attribute->setAttribute('ref','soap-enc:arrayType');
$attribute->setAttribute('arrayType',(isset(self::$typeMap[$arrayType]) ? 'xsd:' : 'tns:') .$arrayType.'[]');

$restriction->appendChild($attribute);
$complexContent->appendChild($restriction);
$complexType->appendChild($complexContent);
Expand All @@ -579,9 +578,9 @@ protected function addTypes($dom)
elseif(is_array($xmlType))
{
$pathInfo = pathinfo(str_replace('\\', '/', $phpType));

$complexType->setAttribute('name', $pathInfo['basename']);

//$complexType->setAttribute('name',$phpType);
if($xmlType['custom_wsdl']!==false)
{
Expand Down

0 comments on commit d60b5eb

Please sign in to comment.