26 #require_once 'Zend/Server/Interface.php'; 30 #require_once 'Zend/Soap/Wsdl.php'; 34 #require_once 'Zend/Server/Reflection.php'; 38 #require_once 'Zend/Server/Abstract.php'; 42 #require_once 'Zend/Uri.php'; 85 protected $_operationBodyStyle = array(
'use' =>
'encoded',
'encodingStyle' =>
"http://schemas.xmlsoap.org/soap/encoding/");
92 protected $_bindingStyle = array(
'style' =>
'rpc',
'transport' =>
'http://schemas.xmlsoap.org/soap/http');
108 public function __construct($strategy =
true, $uri=
null, $wsdlClass=
null)
117 if($wsdlClass !==
null) {
132 if (!is_string($uri) && !($uri instanceof
Zend_Uri)) {
133 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 140 $this->_wsdl->setUri($uri);
153 if($this->_uri !==
null) {
176 if (!is_string($wsdlClass) && !
is_subclass_of($wsdlClass,
'Zend_Soap_Wsdl')) {
177 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 180 $this->_wsdlClass = $wsdlClass;
208 if(!isset($operationStyle[
'use'])) {
209 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 212 $this->_operationBodyStyle = $operationStyle;
226 if(isset($bindingStyle[
'style'])) {
227 $this->_bindingStyle[
'style'] = $bindingStyle[
'style'];
229 if(isset($bindingStyle[
'transport'])) {
230 $this->_bindingStyle[
'transport'] = $bindingStyle[
'transport'];
243 if (isset($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] ==
'on') {
256 if(isset($_SERVER[
'HTTP_HOST'])) {
257 $host = $_SERVER[
'HTTP_HOST'];
259 $host = $_SERVER[
'SERVER_NAME'];
271 if (isset($_SERVER[
'HTTP_X_ORIGINAL_URL'])) {
272 $requestUri = $_SERVER[
'HTTP_X_ORIGINAL_URL'];
273 }
elseif (isset($_SERVER[
'HTTP_X_REWRITE_URL'])) {
274 $requestUri = $_SERVER[
'HTTP_X_REWRITE_URL'];
275 }
elseif (isset($_SERVER[
'REQUEST_URI'])) {
276 $requestUri = $_SERVER[
'REQUEST_URI'];
277 }
elseif (isset($_SERVER[
'ORIG_PATH_INFO'])) {
278 $requestUri = $_SERVER[
'ORIG_PATH_INFO'];
280 $requestUri = $_SERVER[
'SCRIPT_NAME'];
282 if( (
$pos = strpos($requestUri,
"?")) !==
false) {
283 $requestUri = substr($requestUri, 0,
$pos);
297 $this->_strategy = $strategy;
299 $this->_wsdl->setComplexTypeStrategy($strategy);
317 $wsdl =
new $this->_wsdlClass(
$class, $uri, $this->_strategy);
320 $wsdl->addSchemaTypeSection();
322 $port = $wsdl->addPortType(
$class .
'Port');
323 $binding = $wsdl->addBinding(
$class .
'Binding',
'tns:' .
$class.
'Port');
325 $wsdl->addSoapBinding($binding, $this->_bindingStyle[
'style'], $this->_bindingStyle[
'transport']);
326 $wsdl->addService(
$class .
'Service',
$class .
'Port',
'tns:' .
$class .
'Binding', $uri);
327 foreach ($this->_reflection->reflectClass(
$class)->getMethods() as
$method) {
330 $this->_wsdl = $wsdl;
348 if (!is_array($function)) {
349 $function = (array) $function;
355 $parts = explode(
'.', basename($_SERVER[
'SCRIPT_NAME']));
360 $wsdl->addSchemaTypeSection();
362 $port = $wsdl->addPortType(
$name .
'Port');
363 $binding = $wsdl->addBinding(
$name .
'Binding',
'tns:' .
$name.
'Port');
365 $wsdl->addSoapBinding($binding, $this->_bindingStyle[
'style'], $this->_bindingStyle[
'transport']);
366 $wsdl->addService(
$name .
'Service',
$name .
'Port',
'tns:' .
$name .
'Binding', $uri);
371 foreach ($function as $func) {
372 $method = $this->_reflection->reflectFunction($func);
375 $this->_wsdl = $wsdl;
395 $maxNumArgumentsOfPrototype = -1;
396 foreach ($function->getPrototypes() as $tmpPrototype) {
397 $numParams = count($tmpPrototype->getParameters());
398 if ($numParams > $maxNumArgumentsOfPrototype) {
399 $maxNumArgumentsOfPrototype = $numParams;
400 $prototype = $tmpPrototype;
403 if ($prototype ===
null) {
404 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 410 if ($this->_bindingStyle[
'style'] ==
'document') {
413 foreach ($prototype->getParameters() as $param) {
414 $sequenceElement = array(
415 'name' => $param->getName(),
416 'type' => $wsdl->getType($param->getType())
418 if ($param->isOptional()) {
419 $sequenceElement[
'nillable'] =
'true';
421 $sequence[] = $sequenceElement;
424 'name' => $function->getName(),
425 'sequence' => $sequence
428 $args[
'parameters'] = array(
'element' => $wsdl->addElement(
$element));
431 foreach ($prototype->getParameters() as $param) {
432 $args[$param->getName()] = array(
'type' => $wsdl->getType($param->getType()));
435 $wsdl->addMessage($function->getName() .
'In', $args);
437 $isOneWayMessage =
false;
438 if($prototype->getReturnType() ==
"void") {
439 $isOneWayMessage =
true;
442 if($isOneWayMessage ==
false) {
445 if ($this->_bindingStyle[
'style'] ==
'document') {
448 if ($prototype->getReturnType() !=
"void") {
450 'name' => $function->getName() .
'Result',
451 'type' => $wsdl->getType($prototype->getReturnType())
455 'name' => $function->getName() .
'Response',
456 'sequence' => $sequence
459 $args[
'parameters'] = array(
'element' => $wsdl->addElement(
$element));
460 }
else if ($prototype->getReturnType() !=
"void") {
462 $args[
'return'] = array(
'type' => $wsdl->getType($prototype->getReturnType()));
464 $wsdl->addMessage($function->getName() .
'Out', $args);
468 if($isOneWayMessage ==
false) {
469 $portOperation = $wsdl->addPortOperation($port, $function->getName(),
'tns:' . $function->getName() .
'In',
'tns:' . $function->getName() .
'Out');
471 $portOperation = $wsdl->addPortOperation($port, $function->getName(),
'tns:' . $function->getName() .
'In',
false);
473 $desc = $function->getDescription();
474 if (strlen($desc) > 0) {
475 $wsdl->addDocumentation($portOperation, $desc);
479 if ($this->_bindingStyle[
'style'] ==
'rpc' && !isset($this->_operationBodyStyle[
'namespace'])) {
480 $this->_operationBodyStyle[
'namespace'] =
''.$uri;
484 if($isOneWayMessage ==
false) {
489 $wsdl->addSoapOperation($operation, $uri .
'#' .$function->getName());
492 $this->_functions[] = $function->getName();
504 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 516 header(
'Content-Type: text/xml');
518 $this->_wsdl->dump();
528 public function dump($filename)
530 if($this->_wsdl !==
null) {
531 return $this->_wsdl->dump($filename);
536 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 549 if($this->_wsdl !==
null) {
550 return $this->_wsdl->toXml();
555 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 578 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 590 #require_once "Zend/Soap/AutoDiscover/Exception.php"; 608 return $this->_wsdl->getType(
$type);
getRequestUriWithoutParameters()
loadFunctions($definition)
is_subclass_of($obj, $className)
elseif(isset( $params[ 'redirect_parent']))
static factory($uri='http', $className=null)
setBindingStyle(array $bindingStyle=array())
setOperationBodyStyle(array $operationStyle=array())
_addFunctionToWsdl($function, $wsdl, $port, $binding)
__construct($strategy=true, $uri=null, $wsdlClass=null)
addFunction($function, $namespace='')
$_option $_optionId $class
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
setClass($class, $namespace='', $argv=null)
setComplexTypeStrategy($strategy)
fault($fault=null, $code=null)
if(!isset($_GET['name'])) $name