From 54ae6f62b0f4daf8418dce328ec8ad786e8f1c15 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 24 Nov 2022 20:36:09 +0100 Subject: [PATCH] Added filter and pagination to Product --- Layout/default/Contract/Index.php | 4 +- Layout/default/Product/Index.php | 88 +- Layout/default/Productgroup/Index.php | 68 + Layout/default/menu.php | 1 + application/Product/ProductController.php | 45 +- application/Product/ProductModel.php | 81 +- application/Productgroup/Productgroup.php | 60 + .../Productgroup/ProductgroupController.php | 26 + .../Productgroup/ProductgroupModel.php | 35 +- application/Producttech/ProducttechModel.php | 2 +- lib/nusoap/changelog | 648 -- lib/nusoap/class.nusoap_base.php | 996 -- lib/nusoap/class.soap_fault.php | 90 - lib/nusoap/class.soap_parser.php | 643 -- lib/nusoap/class.soap_server.php | 1127 --- lib/nusoap/class.soap_transport_http.php | 1307 --- lib/nusoap/class.soap_val.php | 107 - lib/nusoap/class.soapclient.php | 991 -- lib/nusoap/class.wsdl.php | 1938 ---- lib/nusoap/class.wsdlcache.php | 209 - lib/nusoap/class.xmlschema.php | 973 -- lib/nusoap/docs/docs/CVS/Entries | 11 - lib/nusoap/docs/docs/CVS/Repository | 1 - lib/nusoap/docs/docs/CVS/Root | 1 - lib/nusoap/docs/docs/__filesource/CVS/Entries | 4 - .../docs/docs/__filesource/CVS/Repository | 1 - lib/nusoap/docs/docs/__filesource/CVS/Root | 1 - .../fsource_nusoap__class.wsdlcache.php.html | 229 - .../fsource_nusoap__nusoap.php.html | 8228 ----------------- .../fsource_nusoap__nusoapmime.php.html | 521 -- lib/nusoap/docs/docs/blank.html | 13 - lib/nusoap/docs/docs/classtrees_nusoap.html | 46 - lib/nusoap/docs/docs/elementindex.html | 3290 ------- lib/nusoap/docs/docs/elementindex_nusoap.html | 3287 ------- lib/nusoap/docs/docs/errors.html | 50 - lib/nusoap/docs/docs/index.html | 24 - lib/nusoap/docs/docs/li_nusoap.html | 59 - lib/nusoap/docs/docs/media/CVS/Entries | 3 - lib/nusoap/docs/docs/media/CVS/Repository | 1 - lib/nusoap/docs/docs/media/CVS/Root | 1 - lib/nusoap/docs/docs/media/banner.css | 33 - .../docs/docs/media/images/AbstractClass.png | Bin 620 -> 0 bytes .../docs/media/images/AbstractClass_logo.png | Bin 1232 -> 0 bytes .../docs/docs/media/images/AbstractMethod.png | Bin 696 -> 0 bytes .../media/images/AbstractPrivateClass.png | Bin 848 -> 0 bytes .../images/AbstractPrivateClass_logo.png | Bin 1615 -> 0 bytes .../media/images/AbstractPrivateMethod.png | Bin 874 -> 0 bytes lib/nusoap/docs/docs/media/images/CVS/Entries | 46 - .../docs/docs/media/images/CVS/Repository | 1 - lib/nusoap/docs/docs/media/images/CVS/Root | 1 - lib/nusoap/docs/docs/media/images/Class.png | Bin 570 -> 0 bytes .../docs/docs/media/images/Class_logo.png | Bin 1600 -> 0 bytes .../docs/docs/media/images/Constant.png | Bin 752 -> 0 bytes .../docs/docs/media/images/Constructor.png | Bin 865 -> 0 bytes .../docs/docs/media/images/Destructor.png | Bin 956 -> 0 bytes .../docs/docs/media/images/Function.png | Bin 596 -> 0 bytes lib/nusoap/docs/docs/media/images/Global.png | Bin 712 -> 0 bytes lib/nusoap/docs/docs/media/images/I.png | Bin 148 -> 0 bytes lib/nusoap/docs/docs/media/images/Index.png | Bin 584 -> 0 bytes lib/nusoap/docs/docs/media/images/L.png | Bin 153 -> 0 bytes lib/nusoap/docs/docs/media/images/Lminus.png | Bin 219 -> 0 bytes lib/nusoap/docs/docs/media/images/Lplus.png | Bin 224 -> 0 bytes lib/nusoap/docs/docs/media/images/Method.png | Bin 661 -> 0 bytes lib/nusoap/docs/docs/media/images/Page.png | Bin 592 -> 0 bytes .../docs/docs/media/images/Page_logo.png | Bin 1369 -> 0 bytes .../docs/docs/media/images/PrivateClass.png | Bin 790 -> 0 bytes .../docs/media/images/PrivateClass_logo.png | Bin 1836 -> 0 bytes .../docs/docs/media/images/PrivateMethod.png | Bin 918 -> 0 bytes .../docs/media/images/PrivateVariable.png | Bin 772 -> 0 bytes lib/nusoap/docs/docs/media/images/T.png | Bin 152 -> 0 bytes lib/nusoap/docs/docs/media/images/Tminus.png | Bin 207 -> 0 bytes lib/nusoap/docs/docs/media/images/Tplus.png | Bin 222 -> 0 bytes .../docs/docs/media/images/Variable.png | Bin 688 -> 0 bytes lib/nusoap/docs/docs/media/images/blank.png | Bin 144 -> 0 bytes .../docs/docs/media/images/class_folder.png | Bin 633 -> 0 bytes lib/nusoap/docs/docs/media/images/empty.png | Bin 90 -> 0 bytes lib/nusoap/docs/docs/media/images/file.png | Bin 462 -> 0 bytes lib/nusoap/docs/docs/media/images/folder.png | Bin 492 -> 0 bytes .../docs/media/images/function_folder.png | Bin 605 -> 0 bytes .../docs/docs/media/images/next_button.png | Bin 657 -> 0 bytes .../media/images/next_button_disabled.png | Bin 543 -> 0 bytes lib/nusoap/docs/docs/media/images/package.png | Bin 668 -> 0 bytes .../docs/docs/media/images/package_folder.png | Bin 564 -> 0 bytes .../docs/media/images/previous_button.png | Bin 644 -> 0 bytes .../media/images/previous_button_disabled.png | Bin 541 -> 0 bytes .../docs/media/images/private_class_logo.png | Bin 1836 -> 0 bytes .../docs/docs/media/images/tutorial.png | Bin 431 -> 0 bytes .../docs/media/images/tutorial_folder.png | Bin 572 -> 0 bytes .../docs/docs/media/images/up_button.png | Bin 668 -> 0 bytes lib/nusoap/docs/docs/media/stylesheet.css | 146 - lib/nusoap/docs/docs/nusoap/CVS/Entries | 15 - lib/nusoap/docs/docs/nusoap/CVS/Repository | 1 - lib/nusoap/docs/docs/nusoap/CVS/Root | 1 - lib/nusoap/docs/docs/nusoap/XMLSchema.html | 331 - .../docs/nusoap/_class_wsdlcache_php.html | 77 - lib/nusoap/docs/docs/nusoap/_nusoap_php.html | 315 - .../docs/docs/nusoap/_nusoapmime_php.html | 142 - lib/nusoap/docs/docs/nusoap/nusoap_base.html | 1577 ---- .../docs/docs/nusoap/nusoap_client.html | 2304 ----- .../docs/docs/nusoap/nusoap_client_mime.html | 846 -- lib/nusoap/docs/docs/nusoap/nusoap_fault.html | 457 - .../docs/docs/nusoap/nusoap_parser.html | 1324 --- .../docs/docs/nusoap/nusoap_server.html | 1620 ---- .../docs/docs/nusoap/nusoap_server_mime.html | 774 -- .../docs/docs/nusoap/nusoap_wsdlcache.html | 568 -- .../docs/docs/nusoap/nusoap_xmlschema.html | 1462 --- .../docs/docs/nusoap/nusoapservermime.html | 374 - lib/nusoap/docs/docs/nusoap/soap_fault.html | 230 - lib/nusoap/docs/docs/nusoap/soap_parser.html | 339 - lib/nusoap/docs/docs/nusoap/soap_server.html | 339 - .../docs/docs/nusoap/soap_transport_http.html | 1765 ---- lib/nusoap/docs/docs/nusoap/soapclient.html | 411 - .../docs/docs/nusoap/soapclientmime.html | 446 - lib/nusoap/docs/docs/nusoap/soapval.html | 523 -- lib/nusoap/docs/docs/nusoap/wsdl.html | 2129 ----- lib/nusoap/docs/docs/nusoap/wsdlcache.html | 130 - lib/nusoap/docs/docs/packages.html | 29 - lib/nusoap/nusoap.php | 8148 ---------------- lib/nusoap/nusoapmime.php | 501 - 119 files changed, 377 insertions(+), 52238 deletions(-) create mode 100644 Layout/default/Productgroup/Index.php delete mode 100644 lib/nusoap/changelog delete mode 100644 lib/nusoap/class.nusoap_base.php delete mode 100644 lib/nusoap/class.soap_fault.php delete mode 100644 lib/nusoap/class.soap_parser.php delete mode 100644 lib/nusoap/class.soap_server.php delete mode 100644 lib/nusoap/class.soap_transport_http.php delete mode 100644 lib/nusoap/class.soap_val.php delete mode 100644 lib/nusoap/class.soapclient.php delete mode 100644 lib/nusoap/class.wsdl.php delete mode 100644 lib/nusoap/class.wsdlcache.php delete mode 100644 lib/nusoap/class.xmlschema.php delete mode 100644 lib/nusoap/docs/docs/CVS/Entries delete mode 100644 lib/nusoap/docs/docs/CVS/Repository delete mode 100644 lib/nusoap/docs/docs/CVS/Root delete mode 100644 lib/nusoap/docs/docs/__filesource/CVS/Entries delete mode 100644 lib/nusoap/docs/docs/__filesource/CVS/Repository delete mode 100644 lib/nusoap/docs/docs/__filesource/CVS/Root delete mode 100644 lib/nusoap/docs/docs/__filesource/fsource_nusoap__class.wsdlcache.php.html delete mode 100644 lib/nusoap/docs/docs/__filesource/fsource_nusoap__nusoap.php.html delete mode 100644 lib/nusoap/docs/docs/__filesource/fsource_nusoap__nusoapmime.php.html delete mode 100644 lib/nusoap/docs/docs/blank.html delete mode 100644 lib/nusoap/docs/docs/classtrees_nusoap.html delete mode 100644 lib/nusoap/docs/docs/elementindex.html delete mode 100644 lib/nusoap/docs/docs/elementindex_nusoap.html delete mode 100644 lib/nusoap/docs/docs/errors.html delete mode 100644 lib/nusoap/docs/docs/index.html delete mode 100644 lib/nusoap/docs/docs/li_nusoap.html delete mode 100644 lib/nusoap/docs/docs/media/CVS/Entries delete mode 100644 lib/nusoap/docs/docs/media/CVS/Repository delete mode 100644 lib/nusoap/docs/docs/media/CVS/Root delete mode 100644 lib/nusoap/docs/docs/media/banner.css delete mode 100644 lib/nusoap/docs/docs/media/images/AbstractClass.png delete mode 100644 lib/nusoap/docs/docs/media/images/AbstractClass_logo.png delete mode 100644 lib/nusoap/docs/docs/media/images/AbstractMethod.png delete mode 100644 lib/nusoap/docs/docs/media/images/AbstractPrivateClass.png delete mode 100644 lib/nusoap/docs/docs/media/images/AbstractPrivateClass_logo.png delete mode 100644 lib/nusoap/docs/docs/media/images/AbstractPrivateMethod.png delete mode 100644 lib/nusoap/docs/docs/media/images/CVS/Entries delete mode 100644 lib/nusoap/docs/docs/media/images/CVS/Repository delete mode 100644 lib/nusoap/docs/docs/media/images/CVS/Root delete mode 100644 lib/nusoap/docs/docs/media/images/Class.png delete mode 100644 lib/nusoap/docs/docs/media/images/Class_logo.png delete mode 100644 lib/nusoap/docs/docs/media/images/Constant.png delete mode 100644 lib/nusoap/docs/docs/media/images/Constructor.png delete mode 100644 lib/nusoap/docs/docs/media/images/Destructor.png delete mode 100644 lib/nusoap/docs/docs/media/images/Function.png delete mode 100644 lib/nusoap/docs/docs/media/images/Global.png delete mode 100644 lib/nusoap/docs/docs/media/images/I.png delete mode 100644 lib/nusoap/docs/docs/media/images/Index.png delete mode 100644 lib/nusoap/docs/docs/media/images/L.png delete mode 100644 lib/nusoap/docs/docs/media/images/Lminus.png delete mode 100644 lib/nusoap/docs/docs/media/images/Lplus.png delete mode 100644 lib/nusoap/docs/docs/media/images/Method.png delete mode 100644 lib/nusoap/docs/docs/media/images/Page.png delete mode 100644 lib/nusoap/docs/docs/media/images/Page_logo.png delete mode 100644 lib/nusoap/docs/docs/media/images/PrivateClass.png delete mode 100644 lib/nusoap/docs/docs/media/images/PrivateClass_logo.png delete mode 100644 lib/nusoap/docs/docs/media/images/PrivateMethod.png delete mode 100644 lib/nusoap/docs/docs/media/images/PrivateVariable.png delete mode 100644 lib/nusoap/docs/docs/media/images/T.png delete mode 100644 lib/nusoap/docs/docs/media/images/Tminus.png delete mode 100644 lib/nusoap/docs/docs/media/images/Tplus.png delete mode 100644 lib/nusoap/docs/docs/media/images/Variable.png delete mode 100644 lib/nusoap/docs/docs/media/images/blank.png delete mode 100644 lib/nusoap/docs/docs/media/images/class_folder.png delete mode 100644 lib/nusoap/docs/docs/media/images/empty.png delete mode 100644 lib/nusoap/docs/docs/media/images/file.png delete mode 100644 lib/nusoap/docs/docs/media/images/folder.png delete mode 100644 lib/nusoap/docs/docs/media/images/function_folder.png delete mode 100644 lib/nusoap/docs/docs/media/images/next_button.png delete mode 100644 lib/nusoap/docs/docs/media/images/next_button_disabled.png delete mode 100644 lib/nusoap/docs/docs/media/images/package.png delete mode 100644 lib/nusoap/docs/docs/media/images/package_folder.png delete mode 100644 lib/nusoap/docs/docs/media/images/previous_button.png delete mode 100644 lib/nusoap/docs/docs/media/images/previous_button_disabled.png delete mode 100644 lib/nusoap/docs/docs/media/images/private_class_logo.png delete mode 100644 lib/nusoap/docs/docs/media/images/tutorial.png delete mode 100644 lib/nusoap/docs/docs/media/images/tutorial_folder.png delete mode 100644 lib/nusoap/docs/docs/media/images/up_button.png delete mode 100644 lib/nusoap/docs/docs/media/stylesheet.css delete mode 100644 lib/nusoap/docs/docs/nusoap/CVS/Entries delete mode 100644 lib/nusoap/docs/docs/nusoap/CVS/Repository delete mode 100644 lib/nusoap/docs/docs/nusoap/CVS/Root delete mode 100644 lib/nusoap/docs/docs/nusoap/XMLSchema.html delete mode 100644 lib/nusoap/docs/docs/nusoap/_class_wsdlcache_php.html delete mode 100644 lib/nusoap/docs/docs/nusoap/_nusoap_php.html delete mode 100644 lib/nusoap/docs/docs/nusoap/_nusoapmime_php.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_base.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_client.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_client_mime.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_fault.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_parser.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_server.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_server_mime.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_wsdlcache.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoap_xmlschema.html delete mode 100644 lib/nusoap/docs/docs/nusoap/nusoapservermime.html delete mode 100644 lib/nusoap/docs/docs/nusoap/soap_fault.html delete mode 100644 lib/nusoap/docs/docs/nusoap/soap_parser.html delete mode 100644 lib/nusoap/docs/docs/nusoap/soap_server.html delete mode 100644 lib/nusoap/docs/docs/nusoap/soap_transport_http.html delete mode 100644 lib/nusoap/docs/docs/nusoap/soapclient.html delete mode 100644 lib/nusoap/docs/docs/nusoap/soapclientmime.html delete mode 100644 lib/nusoap/docs/docs/nusoap/soapval.html delete mode 100644 lib/nusoap/docs/docs/nusoap/wsdl.html delete mode 100644 lib/nusoap/docs/docs/nusoap/wsdlcache.html delete mode 100644 lib/nusoap/docs/docs/packages.html delete mode 100644 lib/nusoap/nusoap.php delete mode 100644 lib/nusoap/nusoapmime.php diff --git a/Layout/default/Contract/Index.php b/Layout/default/Contract/Index.php index 7a6251331..96064df5f 100644 --- a/Layout/default/Contract/Index.php +++ b/Layout/default/Contract/Index.php @@ -96,8 +96,8 @@ - id?> - $contract->owner_id])?>" target="_blank">owner->getCompanyOrName()?> + $contract->id])?>">id?> + $contract->owner_id])?>" target="_blank"> owner->getCompanyOrName()?> $contract->id])?>">product->name?> $contract->id])?>">matchcode?> + + + + + +
@@ -34,8 +109,8 @@
- - + + @@ -69,12 +144,17 @@
- - + +
+ + diff --git a/Layout/default/Productgroup/Index.php b/Layout/default/Productgroup/Index.php new file mode 100644 index 000000000..8f291d324 --- /dev/null +++ b/Layout/default/Productgroup/Index.php @@ -0,0 +1,68 @@ +getUrl($Mod,"Index"); + $pagination_baseurl_params = ["filter" => $filter]; + $pagination_entity_name = "Produktgruppen"; +?> + + + +
+
+
+
+ +
+

Produkte

+
+
+
+ + +
+ +
+ + diff --git a/Layout/default/menu.php b/Layout/default/menu.php index 297c42f30..b62ed67c1 100644 --- a/Layout/default/menu.php +++ b/Layout/default/menu.php @@ -31,6 +31,7 @@
  • ["addresstype" => ["supplier"]]])?>"> Lieferanten
  • --> +
  • "> Produktgruppen
  • "> Produkte
  • "> Technologien
  • "> Benutzer
  • diff --git a/application/Product/ProductController.php b/application/Product/ProductController.php index a6ca54caf..c9d80018f 100644 --- a/application/Product/ProductController.php +++ b/application/Product/ProductController.php @@ -18,7 +18,48 @@ class ProductController extends mfBaseController { if(!$this->me->is(["Admin"])) { $this->redirect("Dashboard"); } - $this->layout()->set("products", ProductModel::getAll()); + + $filter = []; + if(is_array($this->request->filter)) { + $filter = $this->request->filter; + } + + $this->layout->set("filter", $filter); + + if($filter) { + $filter = $this->getPreparedFilter($filter); + } + + // pagination defaults + $pagination = []; + $pagination['start'] = 0; + $pagination['count'] = 20; + $pagination['maxItems'] = 0; + + if(is_numeric($this->request->s)) { + $pagination['start'] = intval($this->request->s); + } + + $pagination['maxItems'] = ProductModel::count($filter); + $this->layout()->set("pagination", $pagination); + + $products = ProductModel::search($filter, $pagination); + $this->layout()->set("products", $products); + } + + private function getPreparedFilter($filter) { + $new_filter = []; + + if(array_key_exists("name", $filter)) { + $new_filter['name%'] = $filter['name']; + unset($filter['name']); + } + + foreach($filter as $name => $value) { + $new_filter[$name] = $value; + } + + return $new_filter; } protected function addAction() { @@ -276,7 +317,7 @@ class ProductController extends mfBaseController { } - $products = array_merge($products, ProductModel::search(["nameLike" => $search])); + $products = array_merge($products, ProductModel::search(["name%" => $search])); if(!is_array($products) && !count($products)) { return false; diff --git a/application/Product/ProductModel.php b/application/Product/ProductModel.php index ad869f938..4def0073a 100644 --- a/application/Product/ProductModel.php +++ b/application/Product/ProductModel.php @@ -92,21 +92,55 @@ class ProductModel { return null; } - public static function search($filter) { + public static function count($filter) { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $sql = "SELECT COUNT(*) as cnt FROM ( + SELECT `Product`.id FROM `Product` + LEFT JOIN ProductAttribute ON (ProductAttribute.product_id = Product.id) + LEFT JOIN Producttech ON (Product.producttech_id = Producttech.id) + LEFT JOIN ProducttechAttribute ON (ProducttechAttribute.producttech_id = Producttech.id) + WHERE $where + GROUP BY Product.id + ) as p + "; + + mfLoghandler::singleton()->debug($sql); + $res = $db->query($sql); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + return $data->cnt; + } + return 0; + } + + public static function search($filter, $limit=false) { $items = []; $db = FronkDB::singleton(); $where = self::getSqlFilter($filter); $sql = "SELECT Product.* FROM `Product` + LEFT JOIN Productgroup ON (Productgroup.id = Product.id) LEFT JOIN ProductAttribute ON (ProductAttribute.product_id = Product.id) LEFT JOIN Producttech ON (Product.producttech_id = Producttech.id) LEFT JOIN ProducttechAttribute ON (ProducttechAttribute.producttech_id = Producttech.id) WHERE $where - GROUP BY Product.id"; + GROUP BY Product.id + ORDER BY Productgroup.name,Producttech.name,Product.name + "; + + mfLoghandler::singleton()->debug($sql); + if(is_array($limit) && count($limit)) { + if(is_numeric($limit['start']) && is_numeric($limit['count'])) { + $sql .= " LIMIT ".$limit['start'].", ".$limit['count']; + } elseif(is_numeric($count)) { + $sql .= " LIMIT ".$limit['count']; + } + } $res = $db->query($sql); - //$res = $db->select("Product", "*", "$where ORDER BY name, producttech_id"); if($db->num_rows($res)) { while($data = $db->fetch_object($res)) { $items[] = new Product($data); @@ -124,7 +158,7 @@ class ProductModel { if(array_key_exists("id", $filter)) { $id = $db->escape($filter['id']); if($id) { - $where .= " AND Product.`id` like '%$id%'"; + $where .= " AND Product.`id` = '$id'"; } } @@ -132,13 +166,27 @@ class ProductModel { $productgroup_id = $filter['productgroup_id']; if(is_numeric($productgroup_id)) { $where .= " AND productgroup_id=$productgroup_id"; + } elseif(is_array($productgroup_id) && count($productgroup_id)) { + $where .= " AND Product.productgroup_id IN (". implode(",", $productgroup_id).")"; } } + if(array_key_exists("producttech_id", $filter)) { $producttech_id = $filter['producttech_id']; if(is_numeric($producttech_id)) { - $where .= " AND producttech_id=$producttech_id"; + $where .= " AND Product.producttech_id=$producttech_id"; + } elseif(is_array($producttech_id) && count($producttech_id)) { + $where .= " AND Product.producttech_id IN (". implode(",", $producttech_id).")"; + } + } + + if(array_key_exists("sla_id", $filter)) { + $sla_id = $filter['sla_id']; + if(is_numeric($sla_id)) { + $where .= " AND sla_id=$sla_id"; + } elseif(is_array($sla_id) && count($sla_id)) { + $where .= " AND Product.sla_id IN (". implode(",", $sla_id).")"; } } @@ -149,13 +197,32 @@ class ProductModel { } } - if(array_key_exists("nameLike", $filter)) { - $name = $db->escape($filter['nameLike']); + if(array_key_exists("name%", $filter)) { + $name = $db->escape($filter['name%']); if($name) { $where .= " AND Product.`name` like '%$name%'"; } } + if(array_key_exists("external", $filter)) { + $external = $filter['external']; + if(is_numeric($external)) { + if($external) { + $where .= " AND Product.external=1"; + } else { + $where .= " AND Product.external=0"; + } + } + } + + + if(array_key_exists("customer_type", $filter)) { + $customer_type = $db->escape($filter['customer_type']); + if($customer_type) { + $where .= " AND Producttech.`customer_type` = '$customer_type'"; + } + } + if(array_key_exists("attributename", $filter)) { $attributename = $db->escape($filter['attributename']); if($attributename) { diff --git a/application/Productgroup/Productgroup.php b/application/Productgroup/Productgroup.php index 7263f6835..66f82cb19 100644 --- a/application/Productgroup/Productgroup.php +++ b/application/Productgroup/Productgroup.php @@ -1,5 +1,65 @@ $name == null) { + + if(!$this->id) { + return null; + } + + if($name == "products") { + $this->products = mfValuecache::singleton()->get("Productgroup-id-".$this->id."-Products"); + if($this->products === null) { + $this->products = ProductModel::search(['productgroup_id' => $this->id]); + if($this->products) { + mfValuecache::singleton()->set("Productgroup-id-".$this->id."-Products", $this->products); + } + } + return $this->products; + } + + if($name == "creator") { + $this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by); + if($this->creator === null) { + $this->creator = new User($this->create_by); + if($this->creator->id) { + mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator); + } + } + return $this->creator; + } + + if($name == "editor") { + $this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by); + if($this->editor === null) { + $this->editor = new User($this->edit_by); + if($this->editor->id) { + mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor); + } + } + return $this->editor; + } + + + $classname = ucfirst($name); + $idfield = $name."_id"; + $this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield); + if(!$this->$name) { + $this->$name = new $classname($this->$idfield); + } + + if($this->$name->id) { + mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name); + return $this->$name; + } else { + return null; + } + + } + + return $this->$name; + } } \ No newline at end of file diff --git a/application/Productgroup/ProductgroupController.php b/application/Productgroup/ProductgroupController.php index 3d777b748..0fed5a2bd 100644 --- a/application/Productgroup/ProductgroupController.php +++ b/application/Productgroup/ProductgroupController.php @@ -15,7 +15,33 @@ class ProductgroupController extends mfBaseController { } protected function indexAction() { + $this->layout()->setTemplate("Productgroup/Index"); + $filter = []; + if(is_array($this->request->filter)) { + $filter = $this->request->filter; + } + + $this->layout->set("filter", $filter); + + if($filter) { + $filter = $this->getPreparedFilter($filter); + } + + // pagination defaults + $pagination = []; + $pagination['start'] = 0; + $pagination['count'] = 20; + $pagination['maxItems'] = 0; + + if(is_numeric($this->request->s)) { + $pagination['start'] = intval($this->request->s); + } + + $pagination['maxItems'] = ProductgroupModel::count($filter); + $this->layout()->set("pagination", $pagination); + $productgroups = ProductgroupModel::search($filter, $pagination); + $this->layout()->set("productgroups", $productgroups); } protected function addAction() { diff --git a/application/Productgroup/ProductgroupModel.php b/application/Productgroup/ProductgroupModel.php index 184d946f1..e418345d6 100644 --- a/application/Productgroup/ProductgroupModel.php +++ b/application/Productgroup/ProductgroupModel.php @@ -34,21 +34,6 @@ class ProductgroupModel { return $model; } - public static function getOne($id) { - if(!is_numeric($id) || !$id) { - throw new Exception("Invalid number", 400); - } - $item = []; - $db = FronkDB::singleton(); - - $res = $db->select("Productgroup", "*", "id=$id LIMIT 1"); - if($db->num_rows($res)) { - $data = $db->fetch_object($res); - $item = new Productgroup($data); - } - return $item; - } - public static function getAll() { $items = []; @@ -64,7 +49,7 @@ class ProductgroupModel { } - public static function getFirst() { + public static function getFirst($filter) { $db = FronkDB::singleton(); $where = self::getSqlFilter($filter); @@ -81,7 +66,23 @@ class ProductgroupModel { return null; } - public static function search($filter) { + public static function count($filter) { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $sql = "SELECT COUNT(*) as cnt FROM `Productgroup` + WHERE $where + "; + + $res = $db->query($sql); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + return $data->cnt; + } + return 0; + } + + public static function search($filter, $limit = false) { $items = []; $db = FronkDB::singleton(); diff --git a/application/Producttech/ProducttechModel.php b/application/Producttech/ProducttechModel.php index df2540111..8c6b4427f 100644 --- a/application/Producttech/ProducttechModel.php +++ b/application/Producttech/ProducttechModel.php @@ -65,7 +65,7 @@ class ProducttechModel { } - public static function getFirst() { + public static function getFirst($filter) { $db = FronkDB::singleton(); $where = self::getSqlFilter($filter); diff --git a/lib/nusoap/changelog b/lib/nusoap/changelog deleted file mode 100644 index b76580e2d..000000000 --- a/lib/nusoap/changelog +++ /dev/null @@ -1,648 +0,0 @@ -2003-07-21, version 0.6.5 -- soap_transport_http: SOAPAction header is quoted again, fixes problem w/ Weblogic Server -- applied Jason Levitt patch for proper array serialization, fixes problem w/ Amazon shopping cart services -- fixed null value serialization -- applied patch from "BZC ToOn'S" - fixes wsdl serialization when no parameters -- applied John's patch, implementing compression for the server - -2003-07-22, version 0.6.5 -- soap_server: fixed bug causing charset encoding not to be passed to the parser -- soap_fault: added default encoding to the fault serialization -- soap_parser: changed the parser to pre-load the parent's result array when processing scalar values. This increases parsing speed. - -2003-07-23, version 0.6.5 -- soap_base: fix code that overwrites user-supplied attributes in serialize_val -- soap_base: use arrays-of-arrays rather than attempting multi-dimensional in serialize_val -- xmlschema: emit import statements and qualify all elements with prefix in serializeSchema (better interop with validation tools) -- soapclient: get xml character encoding from HTTP Content-Type header if provided, e.g. text/xml;charset="UTF-8" -- soapclient: use headers in call if provided (previously ignored this parameter) -- soap_server: in parse_request, if neither getallheaders nor $_SERVER are available, use $HTTP_SERVER_VARS to get SOAPAction and xml encoding - -2003-07-24, version 0.6.5 -- soap_transport_http: apply patch from Steven Brown "if the server closes connection prematurely, nusoap would spin trying to read data that isn't there" - -2003-07-25, version 0.6.5 -- wsdl: apply patch from Sven to workaround single schema limitation -- wsdl: apply a variant of the patch from Holger to handle empty values for array by serializing an array with 0 elements -- xmlschema: remove the redundant default namespace attribute on the schema element; everything in xsd is explicitly specified as being from xsd -- soap_transport_http: fix setCredentials and add TODO comments in sendHTTPS about what to change if this setCredentials stays - -2003-07-30, version 0.6.5 -- nusoap_base: change documentation of soap_defencoding to specify it is the encoding for outgoing messages -- nusoap_base: only change &, <, > to entities, not all HTML entities -- soap_transport_http: update the Content-Type header in sendRequest, since soap_defencoding could be changed after ctor is called -- soap_server: use soap_defencoding instead of charset_encoding -- soap_server: read encoding from _SERVER if available -- nusoap_base: do entity translation for string parameters with an xsd type specified (thanks David Derr) - -2003-07-31, version 0.6.5 -- soap_transport_http: add proxy authentication -- soap_transport_http: build payload the same way for http and https -- wsdl: add proxy authentication -- soapclient: add proxy authentication -- soapclient: allow proxy information in ctor, so that it can be used for wsdl - -2003-08-01, version 0.6.5 -- soap_transport_http: close a persistent connection that's at EOF -- soap_transport_http: prevent conflicts between setEncoding and usePersistentConnection -- soap_transport_http: fix use of $headers instead of $this->incoming_headers in getResponse -- soapclient: improve handling of persistent connections -- soapclient: force xml_encoding to upper case -- soap_server: let the Web server decide whether to close the connection (no Connection: close header) -- soap_server: force xml_encoding to upper case - -2003-08-04, version 0.6.5 -- soap_parser: use XML type information to pick a PHP data type; also decode base64 -- soap_server: read all HTTP headers when using _SERVER or HTTP_SERVER_VARS -- soap_server: add gzip encoding support for outgoing messages -- soap_transport_http: deflate is gzcompress/gzuncompress (cf. http://archive.develooper.com/libwww@perl.org/msg04650.html) -- soap_transport_http: clean use of persistentConnection so it's always a set boolean -- soapclient: add responseData member to access deflated/gunzipped payload - -2003-08-05, version 0.6.5 -- soap_server: look multiple places when setting debug_flag - -2003-08-07, version 0.6.5 -- nusoap_base: serialize specified type (e.g. ArrayOfString) even for simple array -- wsdl: only specify encodingStyle in the input/output soap bindings when it is not empty (thanks Guillaume) - -2003-08-15, version 0.6.5 -- soap_parser: fix parsing of elements with no XSD type specified -- soap_parser: use PHP string type for XSD long and unsignedLong types - -2003-08-16, version 0.6.5 -- soap_parser: fix code generating warning (thanks Torsten) - -2003-08-19, version 0.6.5 -- soap_parser: fix another line of code generating a warning (thanks Torsten) - -2003-08-22, version 0.6.5 -- soap_server: remove all '--' from debug_str; previous code changed '---' to '- --' -- wsdl, soapclient, soap_parser: patch submitted by Mark Spavin as described by - the following... -> Changes for the multiple/nested imports from the wsdl file. This builds an -> array of files not just the last one and also checks for relative paths to -> the parent. This will then get the imported files from the remote site -> instead of your local disk. Local wsdl files should still work (untested). -> -> Changes for multiple encoding sytles as previously posted - -2003-08-24, version 0.6.5 -- wsdl, soapclient: fix some PHP notices from previous update - -2003-08-26, version 0.6.5 -- wsdl: support multiple SOAP ports -- soapclient, soap_server: when no charset is specified, use UTF-8, even though HTTP specifies US-ASCII. -- soap_transport_http: do not prepend $host with 'ssl://' for https (is this required for older cURL versions?) - -2003-08-27, version 0.6.5 -- soap_server: support compressed request messages (thanks John Huong) -- soap_parser: deserialize Apache Vector as an array -- xmlschema: use $this->typemap in getPHPType (which is not used) -- soapclient, wsdl: check for WSDL errors after serializing parameters -- nusoap_base: add serialization of Apache Map (when not using WSDL) -- wsdl: add serialization of Apache Map (when using WSDL) -- wsdl: only change &, <, > to entities, not all HTML entities - -2003-08-28, version 0.6.5 -- soap_transport_http: disable cURL verification of peer and server (formerly the cURL default) -- soap_transport_http: mingle cURL code with straight http, so sendHTTP is no longer needed - -2003-08-29, version 0.6.6 -- soap_transport_http: add setContentType -- soapclient: call setContentType using new getHTTPContentType and getHTTPContentTypeCharset - -2003-09-05, version 0.6.6 -- wsdl: add some more code to handle null/nil values (but there's still a way to go) - -2003-10-21, version 0.6.6 -- soap_transport_http: only include port in Host header if it was specified in the URL -- soap_transport_http: add some code to use OpenSSL for PHP ssl:// scheme, but comment out since it's not ready -- soap_server: use $_SERVER['PHP_SELF'] if $GLOBALS['PHP_SELF'] is not set -- wsdl: add WSDL request and response and transport debug to debug -- wsdl: handle custom type extending xmlschema namespace (GLUE ... Thanks Matt) -- soap_parser: add param to docs -- soapclient: add getHTTPBody, getHTTPContentType, getHTTPContentTypeCharset (anticipating MIME subclass) - -2003-10-28, version 0.6.6 -- nusoap_base: add expandEntities method -- wsdl: use expandEntities -- soap_fault: use expandEntities -- soap_transport_http: Allow credentials to be included in URL, rather than requiring setCredentials -- soap_transport_http: Merge HTTP headers that span multiple lines -- soap_parser: Properly set errors in ctor -- soapclient: Pass headers to parseResponse and parse them in that method - -2003-10-30, version 0.6.6 -- xmlschema: Add some information for the related type to an element - -2003-12-09, version 0.6.6 -- nusoap_base: Add some namespace methods previously in xmlschema -- xmlschema: Improve parsing of complexType, element and simpleType -- xmlschema: Improve serialization -- xmlschema: Track imports -- xmlschema: Track elementFormDefault and form attributes -- wsdl: Support multiple (note that setting $server->wsdl->schemaTargetNamespace no longer does anything! Use configureWSDL instead.) -- wsdl: Use form attribute of element to control namespace specification -- wsdl: Support chained imports (A imports B which imports C) -- wsdl: Include port in endpoint address when serializing -- soap_server: Fix use of style (rpc|document) and use (encoded|literal) -- soap_server: Support _SERVER[CONTENT_TYPE] in addition to _SERVER[HTTP_CONTENT_TYPE] -- soap_server: Support wsdl with multiple -- soap_client: Remove a var_dump -- soap_client: Add style and use parameters to call method to support doc/lit without WSDL -- soap_transport_http: Check that $this->fp exists when doing persistent connections - -2003-12-17, version 0.6.6 -- soap_server: pass namespaces to xmlschema constructor -- wsdl: post-process after all imports -- wsdl: remove some debug, add some error handling -- xmlschema: allow enclosing namespaces to be specified in constructor -- xmlschema: improve handling of compositors and simple types - -2004-01-08, version 0.6.6 -- soap_server: when requested WSDL is in a file, return to client using passthru (thanks Ingo Fischer) -- soapclient: have proxy inherit more client state -- soapclient: allow timeout and response timeout to be specified in the constructor -- wsdl: allow timeout and response timeout to be specified in the constructor -- soap_transport_http: allow response timeout to be specified in send and sendHTTPS - -2004-01-28, version 0.6.6 -- wsdl: add namespace for array and scalar when form is qualified -- wsdl: fix a bug in which data type of complexType elements were ignored in serialization -- wsdl: enhance handling of URLs with file scheme -- wsdl: add addSimpleType -- xmlschema: add addSimpleType -- xmlschema: always set phpType elements -- soapclient: allow a wsdl instance to be specified in constructor -- soap_server: allow a wsdl instance to be specified in constructor (not tested!) -- soap_server: fix default SOAPAction created in register method -- soap_transport_http: accept chunking with LF separators in addition to CRLF. -- wsdlcache: added class -- nusoapmime: fix comments - -2004-02-23, version 0.6.6 -- soap_transport_http: don't try to unchunk cURL data, since cURL already does it -- soap_transport_http: append CVS revision to version in User-Agent -- wsdl: serialize boolean as true|false, not 1|0, to agree with XML Schema -- soap_server: always exit() after returning WSDL -- soap_server: use the WSDL URL scheme as the default endpoint URL scheme -- soap_server: append CVS revision to version in X-SOAP-Server -- nusoap_base: add (CVS) revision -- wsdlcache: synchronize using a per-WSDL lock file (Thanks Ingo) -- wsdlcache: add cache lifetime, after which cache contents are invalidated (Thanks Ingo) - -2004-03-15, version 0.6.6 -- nusoap_base: add isArraySimpleOrStruct method -- soap_server: improve WSDL URL scheme determination -- soap_server: only deflate/gzip payloads > 1024 bytes -- soap_server: fix parameter order in fault method (always used as faultcode, faultstring) -- soap_server: refactor parse_request into multiple functions (for sanity) -- soap_server: set the namespace on the Response element to the same as the request -- soap_server: name the return value element 'return' by default -- soap_server: added and documented data fields, so that service programmers can use them if desired -- soap_parser: standardize parsing error message -- soap_parser: fix document and responseHeaders so they are the correct XML text (as documented) -- soap_transport_http: fix read from persistent connection -- soapclient: clean up debugging for persistent connection -- wsdl: enforce correct naming of messages parts when an associative array is used for parameters -- wsdl: better serialization of null values -- wsdl: standardize parsing error message -- xmlschema: standardize parsing error message - -2004-03-24, version 0.6.7 -- soap_transport_http: add digest authentication (based on code by Kevin A. Miller) -- xmlschema: improve parsing of import elements -- wsdl: do schema imports even if there are no wsdl imports - -2004-04-12, version 0.6.7 -- wsdl: serialize multiple elements when maxOccurs="unbounded" and value is an array -- wsdl: serialize soapval values (used to force an XML type, e.g. when WSDL uses an abstract type) -- nusoapmime: do not require nusoap.php (it is now the programmer's responsibility) - -2004-04-21, version 0.6.7 -- soap_parser: parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element) -- soap_server: do not wrap response in a response element for a document style service - -2004-04-30, version 0.6.7 -- soap_transport_http: allow digest auth params to be separated by "," as well as ", " -- soap_transport_http: re-initialize incoming headers for each response -- soap_server: add methodreturnisliteralxml property to allow service function to return XML as a string -- soapclient: improve rpc/literal support -- soapclient: allow XML string as call params in addition to array -- soapclient: support document style and literal encoding when not using WSDL - -2004-05-05, version 0.6.7 -- wsdl: serialize PHP objects for WSDL XML Schema complexTypes, in addition to associative arrays -- wsdl: fix WSDL generation when there is no encodingStyle -- soap_transport_http: suppress fsockopen warnings -- soap_transport_http: detect socket timeouts when reading (0 bytes returned) -- soap_transport_http: read chunked content "in-line" so it works on a persistent connection -- nusoap_base: serialize boolean as true|false, not 1|0, to agree with XML Schema -- nusoap_base: serialize array of struct differently than array of array - -2004-06-25, version 0.6.8 -- soap_server: prefer gzip to deflate, since IE does not like our deflate -- soap_server: move webDescription to the wsdl class -- soap_server: allow class and instance method calls for service (thanks Ingo Fischer and Roland Knall) -- wsdl: get webDescription from the soap_server class -- wsdl: allow compression from the server -- wsdl: fix serialization of soapval without a type -- wsdl: propagate debug value from query string to SOAP endpoint in programmatic WSDL generation -- nusoap_base: add anyType, anySimpleType for 2001 XML Schema -- nusoap_base: provide additional debug functions -- soap_transport_http: ignore Content-Length when chunked encoding is used -- soap_transport_http: remove ':' from username for Basic authentication (cf. RFC 2617) -- soap_transport_http: urldecode username and password taken from URL -- soap_transport_http: use raw inflate/deflate for IE/IIS compatibility, rather than having Zlib headers according to HTTP 1.1 spec -- soap_transport_http: attempt to handle the case when both the service application and Web server compress the response -- soapclient: when creating proxy methods, replace '.' in operation name with '__' in function name -- soapclient: initialize requestHeaders in proxy -- general: use new debug methods; never access debug_str directly - -2004-09-30, version 0.6.8 -- soapclient: do not allow getProxy call when WSDL is not used -- soapclient: use ISO-8859-1 as the charset if not specified in the Content-Type header -- soapclient: when an empty string is specified for the call namespace, do not put the method element in a namespace -- soapclient: let soap_transport_http check for SSL support -- soapclient: have proxy inherit soap_defencoding from the client from which it is generated -- soapclient: do not assume that 'ns1' is an unused namespace prefix; always generate namespace prefixes randomly -- soap_parser: compare any encoding in the XML declaration to the charset from the HTTP Content-Type header (thanks Ingo Fischer) -- soap_parser: improve parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element) -- soap_server: use ISO-8859-1 as the charset if not specified in the Content-Type header -- soap_server: allow suppression of automatic UTF-8 decoding -- soap_server: fix a bug when call_user_func_array() is used -- soap_transport_http: correct digest authentication through a proxy -- wsdl: serialize SOAP-ENC types similarly to XSD types -- xmlschema: force unprefixed type into default namespace -- xmlschema: fix serialization of definition of simple types - -2004-10-01, version 0.6.8 -- soap_parser: handle default namespace attributes -- soap_server: add default_utf8 field -- soap_server: support literal encoding (with RPC style) -- soap_transport_http: parse HTTP status and generate error for 300, 302-307, 400, 401-417, 501-505 (thanks for the idea Ghislain) -- soap_transport_http: follow HTTP redirection (HTTP status 301 and Location header) (thanks for the idea Ghislain) -- xmlschema: allow any attributes to be specified in an element of a complexType, e.g., abstract, default, form, minOccurs, maxOccurs, nillable (thanks Jirka Pech for the original patch) - -2004-10-02, version 0.6.8 -- soapclient: read/write cookies (thanks Ingo) -- soap_server: change faultcode on non-resendable faults to Client -- soap_transport_http: read/write cookies (thanks Ingo) - -2004-10-05, version 0.6.8 -- wsdl: add addElement method -- wsdl: support the document style in the register method -- xmlschema: parse unnamed simpleTypes, rather than ignoring them -- xmlschema: include untyped elements when parsing a complexType -- xmlschema: add addElement method - -2004-10-14, version 0.6.8 -- soapclient: support client certificates -- soap_parser: deserialize attributes, prefixing names with "!" -- soap_server: notify the client with HTML when WSDL is requested but not supported by service -- soap_transport_http: support client certificates -- wsdl: support defaults for elements of a complexType -- wsdl: serialize elements from complexType extension base -- wsdl: serialize data (associative array elements) as attributes according to XML Schema -- xmlschema: record extension base if present for a complexType - -2004-12-15, version 0.6.8 -- nusoap_base: add 2000 XML Schema (rare, but used by Akamai) -- soap_parser: avoid deserializing more common attributes that are not data -- soap_parser: be lax when HTTP specifies ISO-8859-1 (the default) and XML specifies UTF-8 (the norm) -- soap_server: account for the fact that get_class_methods returns methods in all lower case (thanks Steve Haldane) -- soap_transport_http: parse digest info that includes '=' in the data (thanks Jinsuk Kim) -- wsdl: feably handle some cases for literal serialization of form="unqualified" elements -- wsdl: don't serialize the decimal portion of a PHP double when the XML type is long -- wsdl: fix serialization of attributes for complexType that is an extension -- wsdlcache: enhance diagnostics -- xmlschema: handle untyped elements -- xmlschema: handle WSDL for SOAP Array that uses the base attribute plus a sequence of element - -2005-01-22, version 0.6.8 -- wsdl: allow an element in one schema to have a type from another schema - -2005-01-24, version 0.6.8 -- xmlschema: correctly parse nested complexType definitions - -2005-02-14, version 0.6.8 -- nusoap_base: fix a bug in which attributes were sometimes not serialized with a value -- nusoap_base: improve serialization of null values (thanks Dominique Stender) -- soap_parser: parse null values by handling the nil attribute (thanks Dominique Stender) -- soap_server: set character encoding for a fault to be the same as for the server (thanks Mark Scott) -- soap_server: correctly check for null value returned from method when WSDL is used (without WSDL, cannot distinguish whether NULL or void return is desired) -- soapclient: for document style, call should always return an array rooted at the response part (all bets are off when there are multiple parts) -- xmlschema: save enumeration values parsed from WSDL - -2005-02-10, version 0.6.9 -- soapclient: only set SOAP headers when they are specified in call params (so setHeaders still works) - -2005-04-04, version 0.6.9 -- soap_server: use get_class instead of is_a (thanks Thomas Noel) -- soapclient: use get_class instead of is_a (thanks Thomas Noel) -- soapclient: add setEndpoint method -- soap_transport_http: fix client certificates (thanks Doug Anarino and Eryan Eriobowo) - -2005-04-29, version 0.6.9 -- nusoap_base: add global variable and methods for setting debug level -- nusoap_base: use xsd:anyType instead of xsd:ur-type to serialize arrays with multiple element types (thanks Ingo Fischer) -- nusoap_base: expand entities in attributes (thanks Gaetano Giunta) -- soapclient: call parent constructor -- soapval: call parent constructor -- soap_fault: call parent constructor -- soap_parser: call parent constructor -- soap_server: assume get_class_methods always returns lower case for PHP 4.x only -- soap_server: call parent constructor -- soap_transport_http: do nothing in setEncoding if gzdeflate is not present (thanks Franck Touanen for pointing this out) -- soap_transport_http: fix check for server request for digest authentication (thanks Mark Spavin) -- soap_transport_http: call parent constructor -- wsdl: fix documentation page popup of one method after another (thanks Owen) -- wsdl: call parent constructor -- wsdl: expand entities in attributes (thanks Gaetano Giunta) -- xmlschema: call parent constructor - -2005-06-03, version 0.6.9 -- nusoap_base: serialize empty arrays as having elements xsd:anyType[0] -- nusoap_base: add encodingStyle parameter to serializeEnvelope -- nusoap_base: serialize xsi:type with nil values -- nusoap_base: improve debug and comments -- soap_parser: correctly parse an empty array to an empty array, not an empty string -- soap_parser: improve debug and comments -- soap_server: specify encodingStyle for envelope when WSDL is used -- soapclient: factor out new getProxyClassCode method -- soapclient: specify encodingStyle for envelope -- soapclient: improve debug and comments -- wsdl: add namespace for Apache SOAP types if a variable of such type is serialized -- wsdl: serialize nil value for nillable elements when no value is provided -- wsdl: serialize xsi:type with nil values -- wsdl: copy attributes as well as elements to an element from its complexType -- wsdl: specify encodingStyle for operations -- wsdl: improve debug and comments -- xmlschema: improve debug and comments - -2005-06-03, version 0.7.0 -- nusoap_base: improve debug and comments -- nusoap_base: fix version, which should have been 0.7.0 since 2005-03-04 - -2005-06-06, version 0.7.1 -- nusoap_base: adjust numeric element names for serialization, instead of forcing them to 'soapVal' -- nusoapmime: add type=text/xml to multipart/related (thanks Emmanuel Cordonnier) -- soap_fault: fix serialization of detail -- soap_server: check required parameters for register method -- soap_server: when getallheaders is used, massage header names -- soap_server: use SOAPAction to determine operation when doc/lit service does not wrap parameters in an element with the method name (thanks Peter Hrastnik) -- soap_transport_http: correctly handle multiple HTTP/1.1 100 responses for https (thanks Jan Slabon) -- wsdl: fixed documentation for addComplexType (thanks Csintalan Ádám) -- wsdl: serialize array data when maxOccurs = 'unbounded' OR maxOccurs > 1 (thanks Dominique Schreckling) -- wsdl: when serializing a string == 'false' as a boolean, set the value to false -- wsdl: when serializing a complexType, require the PHP value supplied to be an array - -2005-07-01, version 0.7.1 -- nusoap_base: Allow SOAP headers to be supplied as an array like parameters -- soap_parser: de-serialize simpleContent that accompanies complexContent -- soap_server: append debug information when programmatically-defined WSDL is returned -- soap_transport_http: Add debug when an outgoing header is set -- soapclient: Allow SOAP headers to be supplied as an array like parameters -- xmlschema: serialize attributes more generally, rather than assuming they are for SOAP 1.1 Array -- wsdl: when serializing, look up types by namespace, not prefix (simple programmatic doc/lit WSDL now seems to work) -- wsdl: process namespace declarations first when parsing an element - -2005-07-27, version 0.7.1 -- nusoap_base: do not override supplied element name with class name when serializing an object in serialize_val -- nusoap_base: remove http://soapinterop.org/xsd (si) from namespaces array -- nusoapmime: add nusoapservermime class to implement MIME attachments on the server -- soap_fault: improve documentation -- soap_server: improve documentation -- soap_server: make consistent use of _SERVER and HTTP_SERVER_VARS -- soap_server: make all incoming HTTP header keys lower case -- soap_server: add hook functions to support subclassing for MIME attachments -- soap_transport_http: remove an unnecessary global statement -- soapclient: when creating a proxy, make $params within each function an associative array -- soapval: improve documentation -- wsdl: when serializing complexType elements, used typed serialization if there is either a type or a reference for the element -- wsdl: allow PHP objects to be serialized as SOAP structs in serializeType -- wsdl: for WSDL and XML Schema imports, don't forget to use the TCP port number (thanks Luca GIOPPO) -- wsdl: make consistent use of _SERVER and HTTP_SERVER_VARS -- xmlschema: improve documentation - -2005-07-31, version 0.7.2 -- nusoap_base: correctly serialize attributes in serialize_val (thanks Hidran Arias) -- soap_parser: when resolving references, do not assume that buildVal returns an array (thanks Akshell) -- soap_parser: removed decode_entities, which does not work (thanks Martin Sarsale) -- soap_server: fix a bug parsing headers from _SERVER and HTTP_SERVER_VARS (thanks Bert Catsburg) -- soap_server: parse all "headers" from HTTP_SERVER_VARS (not just HTTP_*) -- soap_server: use PHP_SELF instead of SCRIPT_NAME for WSDL endpoint -- soap_server: when generating a fault while debug_flag is true, put debug into faultdetail -- wsdl: add enumeration parameter to addSimpleType -- xmlschema: add enumeration parameter to addSimpleType - -2006-02-02, version 0.7.2 -- soapclient: initialize paramArrayStr to improve proxy generation -- soap_parser: handle PHP5 soapclient's incorrect transmission of WSDL-described SOAP encoded arrays. -- soap_server: don't assume _SERVER['HTTPS'] is set; try HTTP_SERVER_VARS['HTTPS'] if it is not -- soap_server: "flatten out" the parameter array to call_user_func_array (thanks André Mamitzsch) -- soap_server: make thrown exceptions conform to specs -- wsdl: use serialize_val to serialize an array when the XSD type is soapenc:Array (JBoss/Axis does this) -- wsdl: change formatting of serialized XML for the WSDL -- xmlschema: change formatting of namespaces when serializing XML for the schema - -2006-04-07, version 0.7.2 -- soap_server: if methodparams is not an array, call call_user_func_array with an empty array (thanks Eric Grossi) -- wsdl: distinguish parts with element specified from those with type specified by suffixing element names with ^ -- wsdl: do a case-insensitive match on schema URI when looking for type -- xmlschema: only get element (not type) when name has ^ suffix - -2006-05-16, version 0.7.2 -- soapclient: add getHeader to get parsed SOAP Header -- soap_parser: check status when receiving Header or Body element -- soap_parser: add soapheader -- soap_server: add requestHeader with parsed SOAP Header - -2006-06-15, version 0.7.2 -- wsdl: fix bug in addComplexType (thanks Maarten Meijer) -- soap_transport_http: change cURL message - -2007-03-19, version 0.7.2 -- soapclient: declare as nusoapclient, then also subclass soapclient if SOAP extension not loaded -- soapclientmime: declare as nusoapclientmime, then also subclass soapclientmime if SOAP extension not loaded - -2007-03-28, version 0.7.2 -- nusoap_base: fix serialization of a soapval when its value is a soapval -- soapval: fix serialization of a soapval when its value is a soapval -- soapval: add __toString (cf. http://article.gmane.org/gmane.comp.php.nusoap.general/2776) -- nusoapclient: use lazy retrieval of WSDL instead of always getting it in the constructor -- nusoapclient: fix getProxy that was broken in last revision -- wsdl: add ability to set authorization credentials and retrieve WSDL outside of constructor - -2007-04-05, version 0.7.2 -- nusoapclientmime: don't rely exclusively on Content-Disposition to distinguish the root part from attachment; also check Content-Type (thanks Ben Bosman) -- nusoapclientmime: obey RFC 2045 Section 5.1 (thanks Chris Butler) -- nusoapservermime: don't rely exclusively on Content-Disposition to distinguish the root part from attachment; also check Content-Type (thanks Ben Bosman) -- nusoapservermime: obey RFC 2045 Section 5.1 (thanks Chris Butler) -- nusoap_base: remove extra whitespace from some XML elements -- nusoap_base: allow SOAP headers to be specified as an associative array (thanks Unique) -- nusoap_base: implement __toString -- nusoap_base: improve doc accuracy and consistency (thanks Martin K?gler) -- iso8601_to_timestamp: avoid problem with negative hours after calculation, etc. (thanks Guntram Trebs) -- nusoapclient: support user-settable cURL options (thanks Ciprian Popovici) -- nusoapclient: call SOAP 1.2 binding operations if no SOAP 1.1 present (there is no reason to believe this will always work!) -- nusoapclient: improve doc accuracy and consistency (thanks Martin K?gler) -- soap_server: don't try to use eval to call function when any parameter is an object -- soap_server: don't print return value within debug string; returned objects would need __toString in PHP 5.2 -- soap_server: use URL scheme for WSDL access as the scheme in SOAPAction -- soap_server: strip port number from server name (some FastCGI implementations include port in server name) -- soap_transport_http: support user-settable cURL options (thanks Ciprian Popovici) -- soap_transport_http: use cURL for NTLM authentication -- soap_transport_http: make digest authentication work for GET as well as POST -- soap_transport_http: improve doc accuracy and consistency (thanks Martin K?gler) -- soapval: remove __toString -- wsdl: set operation style if necessary, but do not override one already provided (thanks Raffaele Capobianco) -- wsdl: check SOAP 1.2 binding operations if no SOAP 1.1 present -- wsdl: improve doc accuracy and consistency (thanks Martin K?gler) -- xmlschema: fix simpleType serialization -- xmlschema: improve doc accuracy and consistency (thanks Martin K?gler) - -2007-04-09, version 0.7.2 -- nusoapclient: set decode_utf8 when creating a proxy (thanks Dmitri Dmitrienko) -- nusoapclient: rename class to nusoap_client -- soap_fault: also provide a class named nusoap_fault -- soap_parser: also provide a class named nusoap_parser -- soap_server: also provide a class named nusoap_server -- soap_transport_http: skip HTTP responses 301 and 401 when using cURL -- soap_transport_http: don't force HTTP Connection header when using cURL -- soap_transport_http: don't set HTTP Host and Content-Length headers when using cURL -- soap_transport_http: support CURLOPT_SSLCERTPASSWD (thanks David Blanco) -- wsdl: support user-settable cURL options (thanks Ciprian Popovici) -- wsdl: serialize parameters for non-SOAP 1.1 binding operations (there is no reason to believe this will always work!) -- xmlschema: also provide a class named nusoap_xmlschema -- nusoapclientmime: rename class to nusoap_client_mime -- nusoapservermime: rename class to nusoap_server_mime - -2007-04-11, version 0.7.2 -- nusoap_client: enable cURL usage to be forced (thanks Giunta Gaetano) -- soap_transport_http: enable cURL proxy usage (thanks Giunta Gaetano) -- soap_transport_http: enable cURL usage to be forced (thanks Giunta Gaetano) -- soap_transport_http: use cURL's HTTP authentication options for basic, digest -- wsdl: enable cURL usage to be forced (thanks Giunta Gaetano) - -2007-04-12, version 0.7.2 -- nusoap_client: add debug -- nusoap_xmlschema: don't add elements of complexTypes to elements array (thanks Heiko Hund) -- soap_transport_http: set cURL connection timeout if supported -- soap_transport_http: add debug when setting cURL option -- soap_transport_http: fix digest authentication broken in previous revision -- wsdl: add debug -- wsdlcache: address some issues with non-existing cache-files and PHP Warnings which came in such cases (thanks Ingo Fischer) -- wsdlcache: change class name to nusoap_wsdlcache - -2007-04-13, version 0.7.2 -- wsdl: wrap parameters if unwrapped values are supplied and WSDL specifies Microsoft-style wrapping - -2007-04-16, version 0.7.2 -- nusoap_base: avoid warning in getDebugAsXMLComment -- nusoap_client: small debug change -- nusoap_client_mime: set responseData when the root part is found - -2007-04-17, version 0.7.2 -- soap_transport_http: improve detection of undefined cURL options (thanks Ingo Fischer) - -2007-05-28, version 0.7.2 -- soap_transport_http: support digest authentication opaque feature (cf. RFC 2617) (thanks Daniel Lacroix) -- soap_transport_http: check safe_mode and open_basedir before setting CURLOPT_FOLLOWLOCATION -- soap_transport_http: skip "HTTP/1.0 200 Connection established" header when cURL returns it (thanks Raimund Jacob) -- nusoap_client: improve handling when getProxy is called and WSDL is not being used -- nusoap_base: add comments about which specifications are used/implemented by NuSOAP -- nusoap_xmlschema: create names for unnamed types that are unique by scope within XML Schema - -2007-06-11, version 0.7.2 -- wsdl: wrap return value if unwrapped value is supplied and WSDL specifies Microsoft-style wrapping - -2007-06-22, version 0.7.2 -- nusoap_xmlschema: fix serialization of simpleType restriction (thanks Rizwan Tejpar) - -2007-07-30, version 0.7.2 -- nusoap_server: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) -- nusoap_client: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) - -2007-10-21, version 0.7.2 -- nusoap_server: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) -- nusoap_client: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) - -2007-10-26, version 0.7.2 -- nusoap_server: Fix munging of _SERVER variables that start with HTTP_ (thanks Thomas Wieczorek) - -2007-10-30, version 0.7.2 -- nusoap_xmlschema: Serialize values for elementFormDefault, attributeFormDefault -- wsdl: Improve consistency between doc/lit schema auto-wrapping and client's parsed schema -- nusoap_server: Correct bug that placed encodingType in Envelope for doc/lit -- nusoap_server: Specify elementFormDefault for schema within doc/lit wsdl - -2007-10-31, version 0.7.2 -- wsdl: Fix typo in parametersMatchWrapped (thanks Sam Stepanyan) -- soap_transport_http: Fix three typos in setProxy (thanks Sam Stepanyan) -- nusoap_xmlschema: Fix typo in serializeTypeDef (thanks Sam Stepanyan) - -2007-11-06, version 1.0rc1 -- wsdl: Improve handling of return values from doc/lit methods -- nusoap_server: Handle case when method is not in a namespace - -2007-11-27, version 1.0rc1 -- nusoap_server: always try to invoke service for a POST -- nusoap_server: only return Location: for WSDL at http://... -- nusoap_base: change some syntax associated with globalDebugLevel - -2008-01-08, version 1.0rc1 -- nusoap_server: fix a typo where = was used instead of == (thanks J. (Johan) Bosma) - -2008-01-10, version 1.0rc1 -- nusoap_client: handle case where request or response has no content-type header (thanks Ingo Fischer) -- nusoap_server: handle case where request or response has no content-type header (thanks Ingo Fischer) -- wsdl: change CSS for .title in webDescription (thanks Marcus Uy) - -2008-01-25, version 1.0rc1 -- nusoap_xmlschema: when an element is of a complexType that is an extension, copy extensionBase from the type -- nusoap_xmlschema: do not apply elementFormDefault to globally defined elements - -2008-02-11, version 1.0rc1 -- wsdl: internally set form of wrapped parameter elements to unqualified (so server handles correctly) - -2008-03-03, version 1.0.rc1 -- nusoap_xmlschema: fix extension when base type has no explicit prefix -- nusoap_xmlschema: support XML Schema include -- wsdl: improve support for sequence by serializing inherited attributes and elements first - -2008-03-04, version 1.0.rc1 -- wsdl: allow WSDL port name to be specified in getOperations -- nusoap_client: allow WSDL port name to be specified in ctor - -2008-03-06, version 1.0rc1 -- wsdl: fix some port name variable references -- nusoap_base: change comments regarding preferred mode of support -- wsdl2nusoap: initial revision - -2008-03-14, version 1.0rc1 -- nusoap_base: fix timezone offset in timestamp_to_iso8601 (thanks Mario Trojan) - -2008-03-27, version 1.0rc1 -- nusoap_server: fix bug setting encodingStyle in serialize_return (thanks Luca Gobbo) - -2008-05-15, version 1.0rc1 -- nusoap_parser: handle case where Header or Body tags are used within SOAP messages (thanks Sergey Zhuravlev) - -2008-08-26, version 1.0rc1 -- wsdl: serialize simpleContent for complexType -- wsdl: avoid serializing complexType elements with no value and minOccurs = 0 regardless of nillability - -2010-04-26, version 0.9.5 -- nusoap_xmlschema: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- wsdl: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- soap_transport_http: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- soap_transport_http: remove call to deprecated function set_magic_quotes_runtime -- nusoap_server: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- nusoap_server: check that value is an object before calling get_class (thanks Pier-Luc Duchaine) -- nusoap_parser: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- nusoap_client: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- nusoap_client: do not assign the return value of new by reference (it is deprecated) (thanks Pier-Luc Duchaine) -- nusoap_base: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- nusoapmime: do not assign the return value of new by reference (it is deprecated) diff --git a/lib/nusoap/class.nusoap_base.php b/lib/nusoap/class.nusoap_base.php deleted file mode 100644 index 4ed92a751..000000000 --- a/lib/nusoap/class.nusoap_base.php +++ /dev/null @@ -1,996 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.nusoap_base.php,v 1.56 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_base { - /** - * Identification for HTTP headers. - * - * @var string - * @access private - */ - var $title = 'NuSOAP'; - /** - * Version for HTTP headers. - * - * @var string - * @access private - */ - var $version = '0.9.5'; - /** - * CVS revision for HTTP headers. - * - * @var string - * @access private - */ - var $revision = '$Revision: 1.56 $'; - /** - * Current error string (manipulated by getError/setError) - * - * @var string - * @access private - */ - var $error_str = ''; - /** - * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) - * - * @var string - * @access private - */ - var $debug_str = ''; - /** - * toggles automatic encoding of special characters as entities - * (should always be true, I think) - * - * @var boolean - * @access private - */ - var $charencoding = true; - /** - * the debug level for this instance - * - * @var integer - * @access private - */ - var $debugLevel; - - /** - * set schema version - * - * @var string - * @access public - */ - var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'; - - /** - * charset encoding for outgoing messages - * - * @var string - * @access public - */ - var $soap_defencoding = 'ISO-8859-1'; - //var $soap_defencoding = 'UTF-8'; - - /** - * namespaces in an array of prefix => uri - * - * this is "seeded" by a set of constants, but it may be altered by code - * - * @var array - * @access public - */ - var $namespaces = array( - 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', - 'xsd' => 'http://www.w3.org/2001/XMLSchema', - 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/' - ); - - /** - * namespaces used in the current context, e.g. during serialization - * - * @var array - * @access private - */ - var $usedNamespaces = array(); - - /** - * XML Schema types in an array of uri => (array of xml type => php type) - * is this legacy yet? - * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. - * @var array - * @access public - */ - var $typemap = array( - 'http://www.w3.org/2001/XMLSchema' => array( - 'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double', - 'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'', - 'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string', - // abstract "any" types - 'anyType'=>'string','anySimpleType'=>'string', - // derived datatypes - 'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'', - 'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer', - 'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer', - 'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''), - 'http://www.w3.org/2000/10/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://www.w3.org/1999/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'), - 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'), - 'http://xml.apache.org/xml-soap' => array('Map') - ); - - /** - * XML entities to convert - * - * @var array - * @access public - * @deprecated - * @see expandEntities - */ - var $xmlEntities = array('quot' => '"','amp' => '&', - 'lt' => '<','gt' => '>','apos' => "'"); - - /** - * constructor - * - * @access public - */ - function nusoap_base() { - $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * gets the global debug level, which applies to future instances - * - * @return integer Debug level 0-9, where 0 turns off - * @access public - */ - function getGlobalDebugLevel() { - return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * sets the global debug level, which applies to future instances - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setGlobalDebugLevel($level) { - $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level; - } - - /** - * gets the debug level for this instance - * - * @return int Debug level 0-9, where 0 turns off - * @access public - */ - function getDebugLevel() { - return $this->debugLevel; - } - - /** - * sets the debug level for this instance - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setDebugLevel($level) { - $this->debugLevel = $level; - } - - /** - * adds debug data to the instance debug string with formatting - * - * @param string $string debug data - * @access private - */ - function debug($string){ - if ($this->debugLevel > 0) { - $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n"); - } - } - - /** - * adds debug data to the instance debug string without formatting - * - * @param string $string debug data - * @access public - */ - function appendDebug($string){ - if ($this->debugLevel > 0) { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str .= $string; - } - } - - /** - * clears the current debug data for this instance - * - * @access public - */ - function clearDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str = ''; - } - - /** - * gets the current debug data for this instance - * - * @return debug data - * @access public - */ - function &getDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - return $this->debug_str; - } - - /** - * gets the current debug data for this instance as an XML comment - * this may change the contents of the debug data - * - * @return debug data as an XML comment - * @access public - */ - function &getDebugAsXMLComment() { - // it would be nice to use a memory stream here to use - // memory more efficiently - while (strpos($this->debug_str, '--')) { - $this->debug_str = str_replace('--', '- -', $this->debug_str); - } - $ret = ""; - return $ret; - } - - /** - * expands entities, e.g. changes '<' to '<'. - * - * @param string $val The string in which to expand entities. - * @access private - */ - function expandEntities($val) { - if ($this->charencoding) { - $val = str_replace('&', '&', $val); - $val = str_replace("'", ''', $val); - $val = str_replace('"', '"', $val); - $val = str_replace('<', '<', $val); - $val = str_replace('>', '>', $val); - } - return $val; - } - - /** - * returns error string if present - * - * @return mixed error string or false - * @access public - */ - function getError(){ - if($this->error_str != ''){ - return $this->error_str; - } - return false; - } - - /** - * sets error string - * - * @return boolean $string error string - * @access private - */ - function setError($str){ - $this->error_str = $str; - } - - /** - * detect if array is a simple array or a struct (associative array) - * - * @param mixed $val The PHP array - * @return string (arraySimple|arrayStruct) - * @access private - */ - function isArraySimpleOrStruct($val) { - $keyList = array_keys($val); - foreach ($keyList as $keyListValue) { - if (!is_int($keyListValue)) { - return 'arrayStruct'; - } - } - return 'arraySimple'; - } - - /** - * serializes PHP values in accordance w/ section 5. Type information is - * not serialized if $use == 'literal'. - * - * @param mixed $val The value to serialize - * @param string $name The name (local part) of the XML element - * @param string $type The XML schema type (local part) for the element - * @param string $name_ns The namespace for the name of the XML element - * @param string $type_ns The namespace for the type of the element - * @param array $attributes The attributes to serialize as name=>value pairs - * @param string $use The WSDL "use" (encoded|literal) - * @param boolean $soapval Whether this is called from soapval. - * @return string The serialized element, possibly with child elements - * @access public - */ - function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) { - $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval"); - $this->appendDebug('value=' . $this->varDump($val)); - $this->appendDebug('attributes=' . $this->varDump($attributes)); - - if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) { - $this->debug("serialize_val: serialize soapval"); - $xml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - $this->debug("serialize_val of soapval returning $xml"); - return $xml; - } - // force valid name if necessary - if (is_numeric($name)) { - $name = '__numeric_' . $name; - } elseif (! $name) { - $name = 'noname'; - } - // if name has ns, add ns prefix to name - $xmlns = ''; - if($name_ns){ - $prefix = 'nu'.rand(1000,9999); - $name = $prefix.':'.$name; - $xmlns .= " xmlns:$prefix=\"$name_ns\""; - } - // if type is prefixed, create type prefix - if($type_ns != '' && $type_ns == $this->namespaces['xsd']){ - // need to fix this. shouldn't default to xsd if no ns specified - // w/o checking against typemap - $type_prefix = 'xsd'; - } elseif($type_ns){ - $type_prefix = 'ns'.rand(1000,9999); - $xmlns .= " xmlns:$type_prefix=\"$type_ns\""; - } - // serialize attributes if present - $atts = ''; - if($attributes){ - foreach($attributes as $k => $v){ - $atts .= " $k=\"".$this->expandEntities($v).'"'; - } - } - // serialize null value - if (is_null($val)) { - $this->debug("serialize_val: serialize null"); - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$xmlns$atts/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // serialize if an xsd built-in primitive type - if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ - $this->debug("serialize_val: serialize xsd built-in primitive type"); - if (is_bool($val)) { - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - } else if (is_string($val)) { - $val = $this->expandEntities($val); - } - if ($use == 'literal') { - $xml = "<$name$xmlns$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // detect type and serialize - $xml = ''; - switch(true) { - case (is_bool($val) || $type == 'boolean'): - $this->debug("serialize_val: serialize boolean"); - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val"; - } - break; - case (is_int($val) || is_long($val) || $type == 'int'): - $this->debug("serialize_val: serialize int"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val"; - } - break; - case (is_float($val)|| is_double($val) || $type == 'float'): - $this->debug("serialize_val: serialize float"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val"; - } - break; - case (is_string($val) || $type == 'string'): - $this->debug("serialize_val: serialize string"); - $val = $this->expandEntities($val); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val"; - } - break; - case is_object($val): - $this->debug("serialize_val: serialize object"); - if (get_class($val) == 'soapval') { - $this->debug("serialize_val: serialize soapval object"); - $pXml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - } else { - if (! $name) { - $name = get_class($val); - $this->debug("In serialize_val, used class name $name as element name"); - } else { - $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val)); - } - foreach(get_object_vars($val) as $k => $v){ - $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$pXml"; - } else { - $xml .= "<$name$xmlns$type_str$atts>$pXml"; - } - break; - break; - case (is_array($val) || $type): - // detect if struct or array - $valueType = $this->isArraySimpleOrStruct($val); - if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){ - $this->debug("serialize_val: serialize array"); - $i = 0; - if(is_array($val) && count($val)> 0){ - foreach($val as $v){ - if(is_object($v) && get_class($v) == 'soapval'){ - $tt_ns = $v->type_ns; - $tt = $v->type; - } elseif (is_array($v)) { - $tt = $this->isArraySimpleOrStruct($v); - } else { - $tt = gettype($v); - } - $array_types[$tt] = 1; - // TODO: for literal, the name should be $name - $xml .= $this->serialize_val($v,'item',false,false,false,false,$use); - ++$i; - } - if(count($array_types) > 1){ - $array_typename = 'xsd:anyType'; - } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) { - if ($tt == 'integer') { - $tt = 'int'; - } - $array_typename = 'xsd:'.$tt; - } elseif(isset($tt) && $tt == 'arraySimple'){ - $array_typename = 'SOAP-ENC:Array'; - } elseif(isset($tt) && $tt == 'arrayStruct'){ - $array_typename = 'unnamed_struct_use_soapval'; - } else { - // if type is prefixed, create type prefix - if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){ - $array_typename = 'xsd:' . $tt; - } elseif ($tt_ns) { - $tt_prefix = 'ns' . rand(1000, 9999); - $array_typename = "$tt_prefix:$tt"; - $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\""; - } else { - $array_typename = $tt; - } - } - $array_type = $i; - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\""; - } - // empty array - } else { - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\""; - } - } - // TODO: for array in literal, there is no wrapper here - $xml = "<$name$xmlns$type_str$atts>".$xml.""; - } else { - // got a struct - $this->debug("serialize_val: serialize struct"); - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>"; - } else { - $xml .= "<$name$xmlns$type_str$atts>"; - } - foreach($val as $k => $v){ - // Apache Map - if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') { - $xml .= ''; - $xml .= $this->serialize_val($k,'key',false,false,false,false,$use); - $xml .= $this->serialize_val($v,'value',false,false,false,false,$use); - $xml .= ''; - } else { - $xml .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - $xml .= ""; - } - break; - default: - $this->debug("serialize_val: serialize unknown"); - $xml .= 'not detected, got '.gettype($val).' for '.$val; - break; - } - $this->debug("serialize_val returning $xml"); - return $xml; - } - - /** - * serializes a message - * - * @param string $body the XML of the SOAP body - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param array $namespaces optional the namespaces used in generating the body and headers - * @param string $style optional (rpc|document) - * @param string $use optional (encoded|literal) - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @return string the message - * @access public - */ - function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){ - // TODO: add an option to automatically run utf8_encode on $body and $headers - // if $this->soap_defencoding is UTF-8. Not doing this automatically allows - // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1 - - $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle"); - $this->debug("headers:"); - $this->appendDebug($this->varDump($headers)); - $this->debug("namespaces:"); - $this->appendDebug($this->varDump($namespaces)); - - // serialize namespaces - $ns_string = ''; - foreach(array_merge($this->namespaces,$namespaces) as $k => $v){ - $ns_string .= " xmlns:$k=\"$v\""; - } - if($encodingStyle) { - $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string"; - } - - // serialize headers - if($headers){ - if (is_array($headers)) { - $xml = ''; - foreach ($headers as $k => $v) { - if (is_object($v) && get_class($v) == 'soapval') { - $xml .= $this->serialize_val($v, false, false, false, false, false, $use); - } else { - $xml .= $this->serialize_val($v, $k, false, false, false, false, $use); - } - } - $headers = $xml; - $this->debug("In serializeEnvelope, serialized array of headers to $headers"); - } - $headers = "".$headers.""; - } - // serialize envelope - return - 'soap_defencoding .'"?'.">". - '". - $headers. - "". - $body. - "". - ""; - } - - /** - * formats a string to be inserted into an HTML stream - * - * @param string $str The string to format - * @return string The formatted string - * @access public - * @deprecated - */ - function formatDump($str){ - $str = htmlspecialchars($str); - return nl2br($str); - } - - /** - * contracts (changes namespace to prefix) a qualified name - * - * @param string $qname qname - * @return string contracted qname - * @access private - */ - function contractQname($qname){ - // get element namespace - //$this->xdebug("Contract $qname"); - if (strrpos($qname, ':')) { - // get unqualified name - $name = substr($qname, strrpos($qname, ':') + 1); - // get ns - $ns = substr($qname, 0, strrpos($qname, ':')); - $p = $this->getPrefixFromNamespace($ns); - if ($p) { - return $p . ':' . $name; - } - return $qname; - } else { - return $qname; - } - } - - /** - * expands (changes prefix to namespace) a qualified name - * - * @param string $qname qname - * @return string expanded qname - * @access private - */ - function expandQname($qname){ - // get element prefix - if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){ - // get unqualified name - $name = substr(strstr($qname,':'),1); - // get ns prefix - $prefix = substr($qname,0,strpos($qname,':')); - if(isset($this->namespaces[$prefix])){ - return $this->namespaces[$prefix].':'.$name; - } else { - return $qname; - } - } else { - return $qname; - } - } - - /** - * returns the local part of a prefixed string - * returns the original string, if not prefixed - * - * @param string $str The prefixed string - * @return string The local part - * @access public - */ - function getLocalPart($str){ - if($sstr = strrchr($str,':')){ - // get unqualified name - return substr( $sstr, 1 ); - } else { - return $str; - } - } - - /** - * returns the prefix part of a prefixed string - * returns false, if not prefixed - * - * @param string $str The prefixed string - * @return mixed The prefix or false if there is no prefix - * @access public - */ - function getPrefix($str){ - if($pos = strrpos($str,':')){ - // get prefix - return substr($str,0,$pos); - } - return false; - } - - /** - * pass it a prefix, it returns a namespace - * - * @param string $prefix The prefix - * @return mixed The namespace, false if no namespace has the specified prefix - * @access public - */ - function getNamespaceFromPrefix($prefix){ - if (isset($this->namespaces[$prefix])) { - return $this->namespaces[$prefix]; - } - //$this->setError("No namespace registered for prefix '$prefix'"); - return false; - } - - /** - * returns the prefix for a given namespace (or prefix) - * or false if no prefixes registered for the given namespace - * - * @param string $ns The namespace - * @return mixed The prefix, false if the namespace has no prefixes - * @access public - */ - function getPrefixFromNamespace($ns) { - foreach ($this->namespaces as $p => $n) { - if ($ns == $n || $ns == $p) { - $this->usedNamespaces[$p] = $n; - return $p; - } - } - return false; - } - - /** - * returns the time in ODBC canonical form with microseconds - * - * @return string The time in ODBC canonical form with microseconds - * @access public - */ - function getmicrotime() { - if (function_exists('gettimeofday')) { - $tod = gettimeofday(); - $sec = $tod['sec']; - $usec = $tod['usec']; - } else { - $sec = time(); - $usec = 0; - } - return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec); - } - - /** - * Returns a string with the output of var_dump - * - * @param mixed $data The variable to var_dump - * @return string The output of var_dump - * @access public - */ - function varDump($data) { - ob_start(); - var_dump($data); - $ret_val = ob_get_contents(); - ob_end_clean(); - return $ret_val; - } - - /** - * represents the object as a string - * - * @return string - * @access public - */ - function __toString() { - return $this->varDump($this); - } -} - -// XML Schema Datatype Helper Functions - -//xsd:dateTime helpers - -/** -* convert unix timestamp to ISO 8601 compliant date string -* -* @param int $timestamp Unix time stamp -* @param boolean $utc Whether the time stamp is UTC or local -* @return mixed ISO 8601 date string or false -* @access public -*/ -function timestamp_to_iso8601($timestamp,$utc=true){ - $datestr = date('Y-m-d\TH:i:sO',$timestamp); - $pos = strrpos($datestr, "+"); - if ($pos === FALSE) { - $pos = strrpos($datestr, "-"); - } - if ($pos !== FALSE) { - if (strlen($datestr) == $pos + 5) { - $datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2); - } - } - if($utc){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - - if(preg_match($pattern,$datestr,$regs)){ - return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]); - } - return false; - } else { - return $datestr; - } -} - -/** -* convert ISO 8601 compliant date string to unix timestamp -* -* @param string $datestr ISO 8601 compliant date string -* @return mixed Unix timestamp (int) or false -* @access public -*/ -function iso8601_to_timestamp($datestr){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - if(preg_match($pattern,$datestr,$regs)){ - // not utc - if($regs[8] != 'Z'){ - $op = substr($regs[8],0,1); - $h = substr($regs[8],1,2); - $m = substr($regs[8],strlen($regs[8])-2,2); - if($op == '-'){ - $regs[4] = $regs[4] + $h; - $regs[5] = $regs[5] + $m; - } elseif($op == '+'){ - $regs[4] = $regs[4] - $h; - $regs[5] = $regs[5] - $m; - } - } - return gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); -// return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z"); - } else { - return false; - } -} - -/** -* sleeps some number of microseconds -* -* @param string $usec the number of microseconds to sleep -* @access public -* @deprecated -*/ -function usleepWindows($usec) -{ - $start = gettimeofday(); - - do - { - $stop = gettimeofday(); - $timePassed = 1000000 * ($stop['sec'] - $start['sec']) - + $stop['usec'] - $start['usec']; - } - while ($timePassed < $usec); -} - - -?> \ No newline at end of file diff --git a/lib/nusoap/class.soap_fault.php b/lib/nusoap/class.soap_fault.php deleted file mode 100644 index 1515b5035..000000000 --- a/lib/nusoap/class.soap_fault.php +++ /dev/null @@ -1,90 +0,0 @@ - -* @version $Id: class.soap_fault.php,v 1.14 2007/04/11 15:49:47 snichol Exp $ -* @access public -*/ -class nusoap_fault extends nusoap_base { - /** - * The fault code (client|server) - * @var string - * @access private - */ - var $faultcode; - /** - * The fault actor - * @var string - * @access private - */ - var $faultactor; - /** - * The fault string, a description of the fault - * @var string - * @access private - */ - var $faultstring; - /** - * The fault detail, typically a string or array of string - * @var mixed - * @access private - */ - var $faultdetail; - - /** - * constructor - * - * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) - * @param string $faultactor only used when msg routed between multiple actors - * @param string $faultstring human readable error message - * @param mixed $faultdetail detail, typically a string or array of string - */ - function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ - parent::nusoap_base(); - $this->faultcode = $faultcode; - $this->faultactor = $faultactor; - $this->faultstring = $faultstring; - $this->faultdetail = $faultdetail; - } - - /** - * serialize a fault - * - * @return string The serialization of the fault instance. - * @access public - */ - function serialize(){ - $ns_string = ''; - foreach($this->namespaces as $k => $v){ - $ns_string .= "\n xmlns:$k=\"$v\""; - } - $return_msg = - 'soap_defencoding.'"?>'. - '\n". - ''. - ''. - $this->serialize_val($this->faultcode, 'faultcode'). - $this->serialize_val($this->faultactor, 'faultactor'). - $this->serialize_val($this->faultstring, 'faultstring'). - $this->serialize_val($this->faultdetail, 'detail'). - ''. - ''. - ''; - return $return_msg; - } -} - -/** - * Backward compatibility - */ -class soap_fault extends nusoap_fault { -} - - -?> \ No newline at end of file diff --git a/lib/nusoap/class.soap_parser.php b/lib/nusoap/class.soap_parser.php deleted file mode 100644 index f6932aa26..000000000 --- a/lib/nusoap/class.soap_parser.php +++ /dev/null @@ -1,643 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_parser.php,v 1.42 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_parser extends nusoap_base { - - var $xml = ''; - var $xml_encoding = ''; - var $method = ''; - var $root_struct = ''; - var $root_struct_name = ''; - var $root_struct_namespace = ''; - var $root_header = ''; - var $document = ''; // incoming SOAP body (text) - // determines where in the message we are (envelope,header,body,method) - var $status = ''; - var $position = 0; - var $depth = 0; - var $default_namespace = ''; - var $namespaces = array(); - var $message = array(); - var $parent = ''; - var $fault = false; - var $fault_code = ''; - var $fault_str = ''; - var $fault_detail = ''; - var $depth_array = array(); - var $debug_flag = true; - var $soapresponse = NULL; // parsed SOAP Body - var $soapheader = NULL; // parsed SOAP Header - var $responseHeaders = ''; // incoming SOAP headers (text) - var $body_position = 0; - // for multiref parsing: - // array of id => pos - var $ids = array(); - // array of id => hrefs => pos - var $multirefs = array(); - // toggle for auto-decoding element content - var $decode_utf8 = true; - - /** - * constructor that actually does the parsing - * - * @param string $xml SOAP message - * @param string $encoding character encoding scheme of message - * @param string $method method for which XML is parsed (unused?) - * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1 - * @access public - */ - function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ - parent::nusoap_base(); - $this->xml = $xml; - $this->xml_encoding = $encoding; - $this->method = $method; - $this->decode_utf8 = $decode_utf8; - - // Check whether content has been read. - if(!empty($xml)){ - // Check XML encoding - $pos_xml = strpos($xml, '', $pos_xml + 2) - $pos_xml + 1); - if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) { - $xml_encoding = $res[1]; - if (strtoupper($xml_encoding) != $encoding) { - $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'"; - $this->debug($err); - if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { - $this->setError($err); - return; - } - // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed - } else { - $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration'); - } - } else { - $this->debug('No encoding specified in XML declaration'); - } - } else { - $this->debug('No XML declaration'); - } - $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding); - // Create an XML parser - why not xml_parser_create_ns? - $this->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($this->parser, XML_OPTION_CASE_FOLDING, 0); - xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element','end_element'); - xml_set_character_data_handler($this->parser,'character_data'); - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $err = sprintf('XML error parsing SOAP payload on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser))); - $this->debug($err); - $this->debug("XML payload:\n" . $xml); - $this->setError($err); - } else { - $this->debug('in nusoap_parser ctor, message:'); - $this->appendDebug($this->varDump($this->message)); - $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name); - // get final value - $this->soapresponse = $this->message[$this->root_struct]['result']; - // get header value - if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){ - $this->soapheader = $this->message[$this->root_header]['result']; - } - // resolve hrefs/ids - if(sizeof($this->multirefs) > 0){ - foreach($this->multirefs as $id => $hrefs){ - $this->debug('resolving multirefs for id: '.$id); - $idVal = $this->buildVal($this->ids[$id]); - if (is_array($idVal) && isset($idVal['!id'])) { - unset($idVal['!id']); - } - foreach($hrefs as $refPos => $ref){ - $this->debug('resolving href at pos '.$refPos); - $this->multirefs[$id][$refPos] = $idVal; - } - } - } - } - xml_parser_free($this->parser); - } else { - $this->debug('xml was empty, didn\'t parse!'); - $this->setError('xml was empty, didn\'t parse!'); - } - } - - /** - * start-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @param array $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) { - // position in a total number of elements, starting from 0 - // update class level pos - $pos = $this->position++; - // and set mine - $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>''); - // depth = how many levels removed from root? - // set mine as current global depth and increment global depth value - $this->message[$pos]['depth'] = $this->depth++; - - // else add self as child to whoever the current parent is - if($pos != 0){ - $this->message[$this->parent]['children'] .= '|'.$pos; - } - // set my parent - $this->message[$pos]['parent'] = $this->parent; - // set self as current parent - $this->parent = $pos; - // set self as current value for this depth - $this->depth_array[$this->depth] = $pos; - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - // set status - if ($name == 'Envelope' && $this->status == '') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'envelope') { - $this->root_header = $pos; - $this->status = 'header'; - } elseif ($name == 'Body' && $this->status == 'envelope'){ - $this->status = 'body'; - $this->body_position = $pos; - // set method - } elseif($this->status == 'body' && $pos == ($this->body_position+1)) { - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->message[$pos]['type'] = 'struct'; - $this->debug("found root struct $this->root_struct_name, pos $this->root_struct"); - } - // set my status - $this->message[$pos]['status'] = $this->status; - // set name - $this->message[$pos]['name'] = htmlspecialchars($name); - // set attrs - $this->message[$pos]['attrs'] = $attrs; - - // loop through atts, logging ns and type declarations - $attstr = ''; - foreach($attrs as $key => $value){ - $key_prefix = $this->getPrefix($key); - $key_localpart = $this->getLocalPart($key); - // if ns declarations, add to class level array of valid namespaces - if($key_prefix == 'xmlns'){ - if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){ - $this->XMLSchemaVersion = $value; - $this->namespaces['xsd'] = $this->XMLSchemaVersion; - $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance'; - } - $this->namespaces[$key_localpart] = $value; - // set method namespace - if($name == $this->root_struct_name){ - $this->methodNamespace = $value; - } - // if it's a type declaration, set type - } elseif($key_localpart == 'type'){ - if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') { - // do nothing: already processed arrayType - } else { - $value_prefix = $this->getPrefix($value); - $value_localpart = $this->getLocalPart($value); - $this->message[$pos]['type'] = $value_localpart; - $this->message[$pos]['typePrefix'] = $value_prefix; - if(isset($this->namespaces[$value_prefix])){ - $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; - } else if(isset($attrs['xmlns:'.$value_prefix])) { - $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix]; - } - // should do something here with the namespace of specified type? - } - } elseif($key_localpart == 'arrayType'){ - $this->message[$pos]['type'] = 'array'; - /* do arrayType ereg here - [1] arrayTypeValue ::= atype asize - [2] atype ::= QName rank* - [3] rank ::= '[' (',')* ']' - [4] asize ::= '[' length~ ']' - [5] length ::= nextDimension* Digit+ - [6] nextDimension ::= Digit+ ',' - */ - $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/'; - if(preg_match($expr,$value,$regs)){ - $this->message[$pos]['typePrefix'] = $regs[1]; - $this->message[$pos]['arrayTypePrefix'] = $regs[1]; - if (isset($this->namespaces[$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]]; - } else if (isset($attrs['xmlns:'.$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]]; - } - $this->message[$pos]['arrayType'] = $regs[2]; - $this->message[$pos]['arraySize'] = $regs[3]; - $this->message[$pos]['arrayCols'] = $regs[4]; - } - // specifies nil value (or not) - } elseif ($key_localpart == 'nil'){ - $this->message[$pos]['nil'] = ($value == 'true' || $value == '1'); - // some other attribute - } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') { - $this->message[$pos]['xattrs']['!' . $key] = $value; - } - - if ($key == 'xmlns') { - $this->default_namespace = $value; - } - // log id - if($key == 'id'){ - $this->ids[$value] = $pos; - } - // root - if($key_localpart == 'root' && $value == 1){ - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->debug("found root struct $this->root_struct_name, pos $pos"); - } - // for doclit - $attstr .= " $key=\"$value\""; - } - // get namespace - must be done after namespace atts are processed - if(isset($prefix)){ - $this->message[$pos]['namespace'] = $this->namespaces[$prefix]; - $this->default_namespace = $this->namespaces[$prefix]; - } else { - $this->message[$pos]['namespace'] = $this->default_namespace; - } - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } elseif($this->root_struct_name != ''){ - $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } - - /** - * end-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name) { - // position of current element is equal to the last value left in depth_array for my depth - $pos = $this->depth_array[$this->depth--]; - - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - - // build to native type - if(isset($this->body_position) && $pos > $this->body_position){ - // deal w/ multirefs - if(isset($this->message[$pos]['attrs']['href'])){ - // get id - $id = substr($this->message[$pos]['attrs']['href'],1); - // add placeholder to href array - $this->multirefs[$id][$pos] = 'placeholder'; - // add set a reference to it as the result value - $this->message[$pos]['result'] =& $this->multirefs[$id][$pos]; - // build complexType values - } elseif($this->message[$pos]['children'] != ''){ - // if result has already been generated (struct/array) - if(!isset($this->message[$pos]['result'])){ - $this->message[$pos]['result'] = $this->buildVal($pos); - } - // build complexType values of attributes and possibly simpleContent - } elseif (isset($this->message[$pos]['xattrs'])) { - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - if (isset($this->message[$pos]['type'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata']; - } - } - } - $this->message[$pos]['result'] = $this->message[$pos]['xattrs']; - // set value of simpleType (or nil complexType) - } else { - //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']); - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['type'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['result'] = $this->message[$pos]['cdata']; - } - } - - /* add value to parent's result, if parent is struct/array - $parent = $this->message[$pos]['parent']; - if($this->message[$parent]['type'] != 'map'){ - if(strtolower($this->message[$parent]['type']) == 'array'){ - $this->message[$parent]['result'][] = $this->message[$pos]['result']; - } else { - $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result']; - } - } - */ - } - } - - // for doclit - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= ""; - } - } elseif($pos >= $this->root_struct){ - $this->document .= ""; - } - // switch status - if ($pos == $this->root_struct){ - $this->status = 'body'; - $this->root_struct_namespace = $this->message[$pos]['namespace']; - } elseif ($pos == $this->root_header) { - $this->status = 'envelope'; - } elseif ($name == 'Body' && $this->status == 'body') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'header') { // will never happen - $this->status = 'envelope'; - } elseif ($name == 'Envelope' && $this->status == 'envelope') { - $this->status = ''; - } - // set parent back to my parent - $this->parent = $this->message[$pos]['parent']; - } - - /** - * element content handler - * - * @param resource $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data){ - $pos = $this->depth_array[$this->depth]; - if ($this->xml_encoding=='UTF-8'){ - // TODO: add an option to disable this for folks who want - // raw UTF-8 that, e.g., might not map to iso-8859-1 - // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); - if($this->decode_utf8){ - $data = utf8_decode($data); - } - } - $this->message[$pos]['cdata'] .= $data; - // for doclit - if($this->status == 'header'){ - $this->responseHeaders .= $data; - } else { - $this->document .= $data; - } - } - - /** - * get the parsed message (SOAP Body) - * - * @return mixed - * @access public - * @deprecated use get_soapbody instead - */ - function get_response(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Body (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapbody(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Header (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapheader(){ - return $this->soapheader; - } - - /** - * get the unparsed SOAP Header - * - * @return string XML or empty if no Header - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * decodes simple types into PHP variables - * - * @param string $value value to decode - * @param string $type XML type to decode - * @param string $typens XML type namespace to decode - * @return mixed PHP value - * @access private - */ - function decodeSimple($value, $type, $typens) { - // TODO: use the namespace! - if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') { - return (string) $value; - } - if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') { - return (int) $value; - } - if ($type == 'float' || $type == 'double' || $type == 'decimal') { - return (double) $value; - } - if ($type == 'boolean') { - if (strtolower($value) == 'false' || strtolower($value) == 'f') { - return false; - } - return (boolean) $value; - } - if ($type == 'base64' || $type == 'base64Binary') { - $this->debug('Decode base64 value'); - return base64_decode($value); - } - // obscure numeric types - if ($type == 'nonPositiveInteger' || $type == 'negativeInteger' - || $type == 'nonNegativeInteger' || $type == 'positiveInteger' - || $type == 'unsignedInt' - || $type == 'unsignedShort' || $type == 'unsignedByte') { - return (int) $value; - } - // bogus: parser treats array with no elements as a simple type - if ($type == 'array') { - return array(); - } - // everything else - return (string) $value; - } - - /** - * builds response structures for compound values (arrays/structs) - * and scalars - * - * @param integer $pos position in node tree - * @return mixed PHP value - * @access private - */ - function buildVal($pos){ - if(!isset($this->message[$pos]['type'])){ - $this->message[$pos]['type'] = ''; - } - $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']); - // if there are children... - if($this->message[$pos]['children'] != ''){ - $this->debug('in buildVal, there are children'); - $children = explode('|',$this->message[$pos]['children']); - array_shift($children); // knock off empty - // md array - if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){ - $r=0; // rowcount - $c=0; // colcount - foreach($children as $child_pos){ - $this->debug("in buildVal, got an MD array element: $r, $c"); - $params[$r][] = $this->message[$child_pos]['result']; - $c++; - if($c == $this->message[$pos]['arrayCols']){ - $c = 0; - $r++; - } - } - // array - } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){ - $this->debug('in buildVal, adding array '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $params[] = &$this->message[$child_pos]['result']; - } - // apache Map type: java hashtable - } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){ - $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $kv = explode("|",$this->message[$child_pos]['children']); - $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result']; - } - // generic compound type - //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') { - } else { - // Apache Vector type: treat as an array - $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']); - if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') { - $notstruct = 1; - } else { - $notstruct = 0; - } - // - foreach($children as $child_pos){ - if($notstruct){ - $params[] = &$this->message[$child_pos]['result']; - } else { - if (isset($params[$this->message[$child_pos]['name']])) { - // de-serialize repeated element name into an array - if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) { - $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]); - } - $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result']; - } else { - $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result']; - } - } - } - } - if (isset($this->message[$pos]['xattrs'])) { - $this->debug('in buildVal, handling attributes'); - foreach ($this->message[$pos]['xattrs'] as $n => $v) { - $params[$n] = $v; - } - } - // handle simpleContent - if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - $this->debug('in buildVal, handling simpleContent'); - if (isset($this->message[$pos]['type'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $params['!'] = $this->message[$pos]['cdata']; - } - } - } - $ret = is_array($params) ? $params : array(); - $this->debug('in buildVal, return:'); - $this->appendDebug($this->varDump($ret)); - return $ret; - } else { - $this->debug('in buildVal, no children, building scalar'); - $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : ''; - if (isset($this->message[$pos]['type'])) { - $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $ret = $this->message[$pos]['cdata']; - $this->debug("in buildVal, return: $ret"); - return $ret; - } - } -} - -/** - * Backward compatibility - */ -class soap_parser extends nusoap_parser { -} - - -?> \ No newline at end of file diff --git a/lib/nusoap/class.soap_server.php b/lib/nusoap/class.soap_server.php deleted file mode 100644 index 4f1321d3f..000000000 --- a/lib/nusoap/class.soap_server.php +++ /dev/null @@ -1,1127 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_server.php,v 1.63 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_server extends nusoap_base { - /** - * HTTP headers of request - * @var array - * @access private - */ - var $headers = array(); - /** - * HTTP request - * @var string - * @access private - */ - var $request = ''; - /** - * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $requestHeaders = ''; - /** - * SOAP Headers from request (parsed) - * @var mixed - * @access public - */ - var $requestHeader = NULL; - /** - * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $document = ''; - /** - * SOAP payload for request (text) - * @var string - * @access public - */ - var $requestSOAP = ''; - /** - * requested method namespace URI - * @var string - * @access private - */ - var $methodURI = ''; - /** - * name of method requested - * @var string - * @access private - */ - var $methodname = ''; - /** - * method parameters from request - * @var array - * @access private - */ - var $methodparams = array(); - /** - * SOAP Action from request - * @var string - * @access private - */ - var $SOAPAction = ''; - /** - * character set encoding of incoming (request) messages - * @var string - * @access public - */ - var $xml_encoding = ''; - /** - * toggles whether the parser decodes element content w/ utf8_decode() - * @var boolean - * @access public - */ - var $decode_utf8 = true; - - /** - * HTTP headers of response - * @var array - * @access public - */ - var $outgoing_headers = array(); - /** - * HTTP response - * @var string - * @access private - */ - var $response = ''; - /** - * SOAP headers for response (text or array of soapval or associative array) - * @var mixed - * @access public - */ - var $responseHeaders = ''; - /** - * SOAP payload for response (text) - * @var string - * @access private - */ - var $responseSOAP = ''; - /** - * method return value to place in response - * @var mixed - * @access private - */ - var $methodreturn = false; - /** - * whether $methodreturn is a string of literal XML - * @var boolean - * @access public - */ - var $methodreturnisliteralxml = false; - /** - * SOAP fault for response (or false) - * @var mixed - * @access private - */ - var $fault = false; - /** - * text indication of result (for debugging) - * @var string - * @access private - */ - var $result = 'successful'; - - /** - * assoc array of operations => opData; operations are added by the register() - * method or by parsing an external WSDL definition - * @var array - * @access private - */ - var $operations = array(); - /** - * wsdl instance (if one) - * @var mixed - * @access private - */ - var $wsdl = false; - /** - * URL for WSDL (if one) - * @var mixed - * @access private - */ - var $externalWSDLURL = false; - /** - * whether to append debug to response as XML comment - * @var boolean - * @access public - */ - var $debug_flag = false; - - - /** - * constructor - * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to. - * - * @param mixed $wsdl file path or URL (string), or wsdl instance (object) - * @access public - */ - function nusoap_server($wsdl=false){ - parent::nusoap_base(); - // turn on debugging? - global $debug; - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $this->debug("_SERVER is defined:"); - $this->appendDebug($this->varDump($_SERVER)); - } elseif (isset($HTTP_SERVER_VARS)) { - $this->debug("HTTP_SERVER_VARS is defined:"); - $this->appendDebug($this->varDump($HTTP_SERVER_VARS)); - } else { - $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined."); - } - - if (isset($debug)) { - $this->debug("In nusoap_server, set debug_flag=$debug based on global flag"); - $this->debug_flag = $debug; - } elseif (isset($_SERVER['QUERY_STRING'])) { - $qs = explode('&', $_SERVER['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1"); - $this->debug_flag = substr($v, 6); - } - } - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2"); - $this->debug_flag = substr($v, 6); - } - } - } - - // wsdl - if($wsdl){ - $this->debug("In nusoap_server, WSDL is specified"); - if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) { - $this->wsdl = $wsdl; - $this->externalWSDLURL = $this->wsdl->wsdl; - $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL); - } else { - $this->debug('Create wsdl from ' . $wsdl); - $this->wsdl = new wsdl($wsdl); - $this->externalWSDLURL = $wsdl; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($err = $this->wsdl->getError()){ - die('WSDL ERROR: '.$err); - } - } - } - - /** - * processes request and returns response - * - * @param string $data usually is the value of $HTTP_RAW_POST_DATA - * @access public - */ - function service($data){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER['REQUEST_METHOD'])) { - $rm = $_SERVER['REQUEST_METHOD']; - } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) { - $rm = $HTTP_SERVER_VARS['REQUEST_METHOD']; - } else { - $rm = ''; - } - - if (isset($_SERVER['QUERY_STRING'])) { - $qs = $_SERVER['QUERY_STRING']; - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = $HTTP_SERVER_VARS['QUERY_STRING']; - } else { - $qs = ''; - } - $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data)); - - if ($rm == 'POST') { - $this->debug("In service, invoke the request"); - $this->parse_request($data); - if (! $this->fault) { - $this->invoke_method(); - } - if (! $this->fault) { - $this->serialize_return(); - } - $this->send_response(); - } elseif (preg_match('/wsdl/', $qs) ){ - $this->debug("In service, this is a request for WSDL"); - if ($this->externalWSDLURL){ - if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL - $this->debug("In service, re-direct for WSDL"); - header('Location: '.$this->externalWSDLURL); - } else { // assume file - $this->debug("In service, use file passthru for WSDL"); - header("Content-Type: text/xml\r\n"); - $pos = strpos($this->externalWSDLURL, "file://"); - if ($pos === false) { - $filename = $this->externalWSDLURL; - } else { - $filename = substr($this->externalWSDLURL, $pos + 7); - } - $fp = fopen($this->externalWSDLURL, 'r'); - fpassthru($fp); - } - } elseif ($this->wsdl) { - $this->debug("In service, serialize WSDL"); - header("Content-Type: text/xml; charset=ISO-8859-1\r\n"); - print $this->wsdl->serialize($this->debug_flag); - if ($this->debug_flag) { - $this->debug('wsdl:'); - $this->appendDebug($this->varDump($this->wsdl)); - print $this->getDebugAsXMLComment(); - } - } else { - $this->debug("In service, there is no WSDL"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide WSDL"; - } - } elseif ($this->wsdl) { - $this->debug("In service, return Web description"); - print $this->wsdl->webDescription(); - } else { - $this->debug("In service, no Web description"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide a Web description"; - } - } - - /** - * parses HTTP request headers. - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * - * @access private - */ - function parse_http_headers() { - global $HTTP_SERVER_VARS; - - $this->request = ''; - $this->SOAPAction = ''; - if(function_exists('getallheaders')){ - $this->debug("In parse_http_headers, use getallheaders"); - $headers = getallheaders(); - foreach($headers as $k=>$v){ - $k = strtolower($k); - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - // get SOAPAction header - if(isset($this->headers['soapaction'])){ - $this->SOAPAction = str_replace('"','',$this->headers['soapaction']); - } - // get the character encoding of the incoming request - if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){ - $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1)); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } elseif(isset($_SERVER) && is_array($_SERVER)){ - $this->debug("In parse_http_headers, use _SERVER"); - foreach ($_SERVER as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } elseif (is_array($HTTP_SERVER_VARS)) { - $this->debug("In parse_http_headers, use HTTP_SERVER_VARS"); - foreach ($HTTP_SERVER_VARS as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5)); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } else { - $this->debug("In parse_http_headers, HTTP headers not accessible"); - $this->setError("HTTP headers not accessible"); - } - } - - /** - * parses a request - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * request - * requestSOAP - * methodURI - * methodname - * methodparams - * requestHeaders - * document - * - * This sets the fault field on error - * - * @param string $data XML string - * @access private - */ - function parse_request($data='') { - $this->debug('entering parse_request()'); - $this->parse_http_headers(); - $this->debug('got character encoding: '.$this->xml_encoding); - // uncompress if necessary - if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') { - $this->debug('got content encoding: ' . $this->headers['content-encoding']); - if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') { - // if decoding works, use it. else assume data wasn't gzencoded - if (function_exists('gzuncompress')) { - if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { - $data = $degzdata; - } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) { - $data = $degzdata; - } else { - $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data'); - return; - } - } else { - $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data'); - return; - } - } - } - $this->request .= "\r\n".$data; - $data = $this->parseRequest($this->headers, $data); - $this->requestSOAP = $data; - $this->debug('leaving parse_request'); - } - - /** - * invokes a PHP function for the requested SOAP method - * - * The following fields are set by this function (when successful) - * - * methodreturn - * - * Note that the PHP function that is called may also set the following - * fields to affect the response sent to the client - * - * responseHeaders - * outgoing_headers - * - * This sets the fault field on error - * - * @access private - */ - function invoke_method() { - $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction); - - // - // if you are debugging in this area of the code, your service uses a class to implement methods, - // you use SOAP RPC, and the client is .NET, please be aware of the following... - // when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the - // method name. that is fine for naming the .NET methods. it is not fine for properly constructing - // the XML request and reading the XML response. you need to add the RequestElementName and - // ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe - // generates for the method. these parameters are used to specify the correct XML element names - // for .NET to use, i.e. the names with the '.' in them. - // - $orig_methodname = $this->methodname; - if ($this->wsdl) { - if ($this->opData = $this->wsdl->getOperationData($this->methodname)) { - $this->debug('in invoke_method, found WSDL operation=' . $this->methodname); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) { - // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element - $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - $this->methodname = $this->opData['name']; - } else { - $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname); - $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service"); - return; - } - } else { - $this->debug('in invoke_method, no WSDL to validate method'); - } - - // if a . is present in $this->methodname, we see if there is a class in scope, - // which could be referred to. We will also distinguish between two deliminators, - // to allow methods to be called a the class or an instance - if (strpos($this->methodname, '..') > 0) { - $delim = '..'; - } else if (strpos($this->methodname, '.') > 0) { - $delim = '.'; - } else { - $delim = ''; - } - $this->debug("in invoke_method, delim=$delim"); - - $class = ''; - $method = ''; - if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) { - $try_class = substr($this->methodname, 0, strpos($this->methodname, $delim)); - if (class_exists($try_class)) { - // get the class and method name - $class = $try_class; - $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim)); - $this->debug("in invoke_method, class=$class method=$method delim=$delim"); - } else { - $this->debug("in invoke_method, class=$try_class not found"); - } - } else { - $try_class = ''; - $this->debug("in invoke_method, no class to try"); - } - - // does method exist? - if ($class == '') { - if (!function_exists($this->methodname)) { - $this->debug("in invoke_method, function '$this->methodname' not found!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')"); - return; - } - } else { - $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method; - if (!in_array($method_to_compare, get_class_methods($class))) { - $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')"); - return; - } - } - - // evaluate message, getting back parameters - // verify that request parameters match the method's signature - if(! $this->verify_method($this->methodname,$this->methodparams)){ - // debug - $this->debug('ERROR: request not verified against method signature'); - $this->result = 'fault: request failed validation against method signature'; - // return fault - $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service."); - return; - } - - // if there are parameters to pass - $this->debug('in invoke_method, params:'); - $this->appendDebug($this->varDump($this->methodparams)); - $this->debug("in invoke_method, calling '$this->methodname'"); - if (!function_exists('call_user_func_array')) { - if ($class == '') { - $this->debug('in invoke_method, calling function using eval()'); - $funcCall = "\$this->methodreturn = $this->methodname("; - } else { - if ($delim == '..') { - $this->debug('in invoke_method, calling class method using eval()'); - $funcCall = "\$this->methodreturn = ".$class."::".$method."("; - } else { - $this->debug('in invoke_method, calling instance method using eval()'); - // generate unique instance name - $instname = "\$inst_".time(); - $funcCall = $instname." = new ".$class."(); "; - $funcCall .= "\$this->methodreturn = ".$instname."->".$method."("; - } - } - if ($this->methodparams) { - foreach ($this->methodparams as $param) { - if (is_array($param) || is_object($param)) { - $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available'); - return; - } - $funcCall .= "\"$param\","; - } - $funcCall = substr($funcCall, 0, -1); - } - $funcCall .= ');'; - $this->debug('in invoke_method, function call: '.$funcCall); - @eval($funcCall); - } else { - if ($class == '') { - $this->debug('in invoke_method, calling function using call_user_func_array()'); - $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array() - } elseif ($delim == '..') { - $this->debug('in invoke_method, calling class method using call_user_func_array()'); - $call_arg = array ($class, $method); - } else { - $this->debug('in invoke_method, calling instance method using call_user_func_array()'); - $instance = new $class (); - $call_arg = array(&$instance, $method); - } - if (is_array($this->methodparams)) { - $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams)); - } else { - $this->methodreturn = call_user_func_array($call_arg, array()); - } - } - $this->debug('in invoke_method, methodreturn:'); - $this->appendDebug($this->varDump($this->methodreturn)); - $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn)); - } - - /** - * serializes the return value from a PHP function into a full SOAP Envelope - * - * The following fields are set by this function (when successful) - * - * responseSOAP - * - * This sets the fault field on error - * - * @access private - */ - function serialize_return() { - $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI); - // if fault - if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { - $this->debug('got a fault object from method'); - $this->fault = $this->methodreturn; - return; - } elseif ($this->methodreturnisliteralxml) { - $return_val = $this->methodreturn; - // returned value(s) - } else { - $this->debug('got a(n) '.gettype($this->methodreturn).' from method'); - $this->debug('serializing return value'); - if($this->wsdl){ - if (sizeof($this->opData['output']['parts']) > 1) { - $this->debug('more than one output part, so use the method return unchanged'); - $opParams = $this->methodreturn; - } elseif (sizeof($this->opData['output']['parts']) == 1) { - $this->debug('exactly one output part, so wrap the method return in a simple array'); - // TODO: verify that it is not already wrapped! - //foreach ($this->opData['output']['parts'] as $name => $type) { - // $this->debug('wrap in element named ' . $name); - //} - $opParams = array($this->methodreturn); - } - $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams); - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($errstr = $this->wsdl->getError()){ - $this->debug('got wsdl error: '.$errstr); - $this->fault('SOAP-ENV:Server', 'unable to serialize result'); - return; - } - } else { - if (isset($this->methodreturn)) { - $return_val = $this->serialize_val($this->methodreturn, 'return'); - } else { - $return_val = ''; - $this->debug('in absence of WSDL, assume void return for backward compatibility'); - } - } - } - $this->debug('return value:'); - $this->appendDebug($this->varDump($return_val)); - - $this->debug('serializing response'); - if ($this->wsdl) { - $this->debug('have WSDL for serialization: style is ' . $this->opData['style']); - if ($this->opData['style'] == 'rpc') { - $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']); - if ($this->opData['output']['use'] == 'literal') { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } else { - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } - } else { - $this->debug('style is not rpc for serialization: assume document'); - $payload = $return_val; - } - } else { - $this->debug('do not have WSDL for serialization: assume rpc/encoded'); - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } - $this->result = 'successful'; - if($this->wsdl){ - //if($this->debug_flag){ - $this->appendDebug($this->wsdl->getDebug()); - // } - if (isset($this->opData['output']['encodingStyle'])) { - $encodingStyle = $this->opData['output']['encodingStyle']; - } else { - $encodingStyle = ''; - } - // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces. - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle); - } else { - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders); - } - $this->debug("Leaving serialize_return"); - } - - /** - * sends an HTTP response - * - * The following fields are set by this function (when successful) - * - * outgoing_headers - * response - * - * @access private - */ - function send_response() { - $this->debug('Enter send_response'); - if ($this->fault) { - $payload = $this->fault->serialize(); - $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error"; - $this->outgoing_headers[] = "Status: 500 Internal Server Error"; - } else { - $payload = $this->responseSOAP; - // Some combinations of PHP+Web server allow the Status - // to come through as a header. Since OK is the default - // just do nothing. - // $this->outgoing_headers[] = "HTTP/1.0 200 OK"; - // $this->outgoing_headers[] = "Status: 200 OK"; - } - // add debug data if in debug mode - if(isset($this->debug_flag) && $this->debug_flag){ - $payload .= $this->getDebugAsXMLComment(); - } - $this->outgoing_headers[] = "Server: $this->title Server v$this->version"; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")"; - // Let the Web server decide about this - //$this->outgoing_headers[] = "Connection: Close\r\n"; - $payload = $this->getHTTPBody($payload); - $type = $this->getHTTPContentType(); - $charset = $this->getHTTPContentTypeCharset(); - $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : ''); - //begin code to compress payload - by John - // NOTE: there is no way to know whether the Web server will also compress - // this data. - if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) { - if (strstr($this->headers['accept-encoding'], 'gzip')) { - if (function_exists('gzencode')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: gzip"; - $payload = gzencode($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } elseif (strstr($this->headers['accept-encoding'], 'deflate')) { - // Note: MSIE requires gzdeflate output (no Zlib header and checksum), - // instead of gzcompress output, - // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5) - if (function_exists('gzdeflate')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: deflate"; - $payload = gzdeflate($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } - } - //end code - $this->outgoing_headers[] = "Content-Length: ".strlen($payload); - reset($this->outgoing_headers); - foreach($this->outgoing_headers as $hdr){ - header($hdr, false); - } - print $payload; - $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload; - } - - /** - * takes the value that was created by parsing the request - * and compares to the method's signature, if available. - * - * @param string $operation The operation to be invoked - * @param array $request The array of parameter values - * @return boolean Whether the operation was found - * @access private - */ - function verify_method($operation,$request){ - if(isset($this->wsdl) && is_object($this->wsdl)){ - if($this->wsdl->getOperationData($operation)){ - return true; - } - } elseif(isset($this->operations[$operation])){ - return true; - } - return false; - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Request not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Request not of type text/xml'); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - // parse response, get soap parser obj - $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8); - // parser debug - $this->debug("parser debug: \n".$parser->getDebug()); - // if fault occurred during message parsing - if($err = $parser->getError()){ - $this->result = 'fault: error in msg parsing: '.$err; - $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err); - // else successfully parsed request into soapval object - } else { - // get/set methodname - $this->methodURI = $parser->root_struct_namespace; - $this->methodname = $parser->root_struct_name; - $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI); - $this->debug('calling parser->get_soapbody()'); - $this->methodparams = $parser->get_soapbody(); - // get SOAP headers - $this->requestHeaders = $parser->getHeaders(); - // get SOAP Header - $this->requestHeader = $parser->get_soapheader(); - // add document for doclit support - $this->document = $parser->document; - } - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /** - * add a method to the dispatch map (this has been replaced by the register method) - * - * @param string $methodname - * @param string $in array of input values - * @param string $out array of output values - * @access public - * @deprecated - */ - function add_to_map($methodname,$in,$out){ - $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out); - } - - /** - * register a service function with the server - * - * @param string $name the name of the PHP function, class.method or class..method - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param mixed $namespace the element namespace for the method or false - * @param mixed $soapaction the soapaction for the method or false - * @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param mixed $use optional (encoded|literal) or false - * @param string $documentation optional Description to include in WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){ - global $HTTP_SERVER_VARS; - - if($this->externalWSDLURL){ - die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); - } - if (! $name) { - die('You must specify a name when you register an operation'); - } - if (!is_array($in)) { - die('You must provide an array for operation inputs'); - } - if (!is_array($out)) { - die('You must provide an array for operation outputs'); - } - if(false == $namespace) { - } - if(false == $soapaction) { - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; - } - if(false == $style) { - $style = "rpc"; - } - if(false == $use) { - $use = "encoded"; - } - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - $this->operations[$name] = array( - 'name' => $name, - 'in' => $in, - 'out' => $out, - 'namespace' => $namespace, - 'soapaction' => $soapaction, - 'style' => $style); - if($this->wsdl){ - $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle); - } - return true; - } - - /** - * Specify a fault to be returned to the client. - * This also acts as a flag to the server that a fault has occured. - * - * @param string $faultcode - * @param string $faultstring - * @param string $faultactor - * @param string $faultdetail - * @access public - */ - function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){ - if ($faultdetail == '' && $this->debug_flag) { - $faultdetail = $this->getDebug(); - } - $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail); - $this->fault->soap_defencoding = $this->soap_defencoding; - } - - /** - * Sets up wsdl object. - * Acts as a flag to enable internal WSDL generation - * - * @param string $serviceName, name of the service - * @param mixed $namespace optional 'tns' service namespace or false - * @param mixed $endpoint optional URL of service endpoint or false - * @param string $style optional (rpc|document) WSDL style (also specified by operation) - * @param string $transport optional SOAP transport - * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false - */ - function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) - { - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SERVER_PORT = $_SERVER['SERVER_PORT']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI) - $colon = strpos($SERVER_NAME,":"); - if ($colon) { - $SERVER_NAME = substr($SERVER_NAME, 0, $colon); - } - if ($SERVER_PORT == 80) { - $SERVER_PORT = ''; - } else { - $SERVER_PORT = ':' . $SERVER_PORT; - } - if(false == $namespace) { - $namespace = "http://$SERVER_NAME/soap/$serviceName"; - } - - if(false == $endpoint) { - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME"; - } - - if(false == $schemaTargetNamespace) { - $schemaTargetNamespace = $namespace; - } - - $this->wsdl = new wsdl; - $this->wsdl->serviceName = $serviceName; - $this->wsdl->endpoint = $endpoint; - $this->wsdl->namespaces['tns'] = $namespace; - $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/'; - $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/'; - if ($schemaTargetNamespace != $namespace) { - $this->wsdl->namespaces['types'] = $schemaTargetNamespace; - } - $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces); - if ($style == 'document') { - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified'; - } - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace; - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->bindings[$serviceName.'Binding'] = array( - 'name'=>$serviceName.'Binding', - 'style'=>$style, - 'transport'=>$transport, - 'portType'=>$serviceName.'PortType'); - $this->wsdl->ports[$serviceName.'Port'] = array( - 'binding'=>$serviceName.'Binding', - 'location'=>$endpoint, - 'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/'); - } -} - -/** - * Backward compatibility - */ -class soap_server extends nusoap_server { -} - - -?> \ No newline at end of file diff --git a/lib/nusoap/class.soap_transport_http.php b/lib/nusoap/class.soap_transport_http.php deleted file mode 100644 index 469820934..000000000 --- a/lib/nusoap/class.soap_transport_http.php +++ /dev/null @@ -1,1307 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_transport_http.php,v 1.68 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class soap_transport_http extends nusoap_base { - - var $url = ''; - var $uri = ''; - var $digest_uri = ''; - var $scheme = ''; - var $host = ''; - var $port = ''; - var $path = ''; - var $request_method = 'POST'; - var $protocol_version = '1.0'; - var $encoding = ''; - var $outgoing_headers = array(); - var $incoming_headers = array(); - var $incoming_cookies = array(); - var $outgoing_payload = ''; - var $incoming_payload = ''; - var $response_status_line; // HTTP response status line - var $useSOAPAction = true; - var $persistentConnection = false; - var $ch = false; // cURL handle - var $ch_options = array(); // cURL custom options - var $use_curl = false; // force cURL use - var $proxy = null; // proxy information (associative array) - var $username = ''; - var $password = ''; - var $authtype = ''; - var $digestRequest = array(); - var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) - // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem' - // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem' - // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem' - // passphrase: SSL key password/passphrase - // certpassword: SSL certificate password - // verifypeer: default is 1 - // verifyhost: default is 1 - - /** - * constructor - * - * @param string $url The URL to which to connect - * @param array $curl_options User-specified cURL options - * @param boolean $use_curl Whether to try to force cURL use - * @access public - */ - function soap_transport_http($url, $curl_options = NULL, $use_curl = false){ - parent::nusoap_base(); - $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); - $this->appendDebug($this->varDump($curl_options)); - $this->setURL($url); - if (is_array($curl_options)) { - $this->ch_options = $curl_options; - } - $this->use_curl = $use_curl; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); - } - - /** - * sets a cURL option - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access private - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - curl_setopt($this->ch, $option, $value); - } - - /** - * sets an HTTP header - * - * @param string $name The name of the header - * @param string $value The value of the header - * @access private - */ - function setHeader($name, $value) { - $this->outgoing_headers[$name] = $value; - $this->debug("set header $name: $value"); - } - - /** - * unsets an HTTP header - * - * @param string $name The name of the header - * @access private - */ - function unsetHeader($name) { - if (isset($this->outgoing_headers[$name])) { - $this->debug("unset header $name"); - unset($this->outgoing_headers[$name]); - } - } - - /** - * sets the URL to which to connect - * - * @param string $url The URL to which to connect - * @access private - */ - function setURL($url) { - $this->url = $url; - - $u = parse_url($url); - foreach($u as $k => $v){ - $this->debug("parsed URL $k = $v"); - $this->$k = $v; - } - - // add any GET params to path - if(isset($u['query']) && $u['query'] != ''){ - $this->path .= '?' . $u['query']; - } - - // set default port - if(!isset($u['port'])){ - if($u['scheme'] == 'https'){ - $this->port = 443; - } else { - $this->port = 80; - } - } - - $this->uri = $this->path; - $this->digest_uri = $this->uri; - - // build headers - if (!isset($u['port'])) { - $this->setHeader('Host', $this->host); - } else { - $this->setHeader('Host', $this->host.':'.$this->port); - } - - if (isset($u['user']) && $u['user'] != '') { - $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); - } - } - - /** - * gets the I/O method to use - * - * @return string I/O method to use (socket|curl|unknown) - * @access private - */ - function io_method() { - if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) - return 'curl'; - if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) - return 'socket'; - return 'unknown'; - } - - /** - * establish an HTTP connection - * - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return boolean true if connected, false if not - * @access private - */ - function connect($connection_timeout=0,$response_timeout=30){ - // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like - // "regular" socket. - // TODO: disabled for now because OpenSSL must be *compiled* in (not just - // loaded), and until PHP5 stream_get_wrappers is not available. -// if ($this->scheme == 'https') { -// if (version_compare(phpversion(), '4.3.0') >= 0) { -// if (extension_loaded('openssl')) { -// $this->scheme = 'ssl'; -// $this->debug('Using SSL over OpenSSL'); -// } -// } -// } - $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port"); - if ($this->io_method() == 'socket') { - if (!is_array($this->proxy)) { - $host = $this->host; - $port = $this->port; - } else { - $host = $this->proxy['host']; - $port = $this->proxy['port']; - } - - // use persistent connection - if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ - if (!feof($this->fp)) { - $this->debug('Re-use persistent connection'); - return true; - } - fclose($this->fp); - $this->debug('Closed persistent connection at EOF'); - } - - // munge host if using OpenSSL - if ($this->scheme == 'ssl') { - $host = 'ssl://' . $host; - } - $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); - - // open socket - if($connection_timeout > 0){ - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); - } else { - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); - } - - // test pointer - if(!$this->fp) { - $msg = 'Couldn\'t open socket connection to server ' . $this->url; - if ($this->errno) { - $msg .= ', Error ('.$this->errno.'): '.$this->error_str; - } else { - $msg .= ' prior to connect(). This is often a problem looking up the host name.'; - } - $this->debug($msg); - $this->setError($msg); - return false; - } - - // set response timeout - $this->debug('set response timeout to ' . $response_timeout); - socket_set_timeout( $this->fp, $response_timeout); - - $this->debug('socket connected'); - return true; - } else if ($this->io_method() == 'curl') { - if (!extension_loaded('curl')) { -// $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'); - $this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to include cURL or change php.ini to load the PHP cURL extension.'); - return false; - } - // Avoid warnings when PHP does not have these options - if (defined('CURLOPT_CONNECTIONTIMEOUT')) - $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT; - else - $CURLOPT_CONNECTIONTIMEOUT = 78; - if (defined('CURLOPT_HTTPAUTH')) - $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH; - else - $CURLOPT_HTTPAUTH = 107; - if (defined('CURLOPT_PROXYAUTH')) - $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH; - else - $CURLOPT_PROXYAUTH = 111; - if (defined('CURLAUTH_BASIC')) - $CURLAUTH_BASIC = CURLAUTH_BASIC; - else - $CURLAUTH_BASIC = 1; - if (defined('CURLAUTH_DIGEST')) - $CURLAUTH_DIGEST = CURLAUTH_DIGEST; - else - $CURLAUTH_DIGEST = 2; - if (defined('CURLAUTH_NTLM')) - $CURLAUTH_NTLM = CURLAUTH_NTLM; - else - $CURLAUTH_NTLM = 8; - - $this->debug('connect using cURL'); - // init CURL - $this->ch = curl_init(); - // set url - $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host"; - // add path - $hostURL .= $this->path; - $this->setCurlOption(CURLOPT_URL, $hostURL); - // follow location headers (re-directs) - if (ini_get('safe_mode') || ini_get('open_basedir')) { - $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION'); - $this->debug('safe_mode = '); - $this->appendDebug($this->varDump(ini_get('safe_mode'))); - $this->debug('open_basedir = '); - $this->appendDebug($this->varDump(ini_get('open_basedir'))); - } else { - $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1); - } - // ask for headers in the response output - $this->setCurlOption(CURLOPT_HEADER, 1); - // ask for the response output as the return value - $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1); - // encode - // We manage this ourselves through headers and encoding -// if(function_exists('gzuncompress')){ -// $this->setCurlOption(CURLOPT_ENCODING, 'deflate'); -// } - // persistent connection - if ($this->persistentConnection) { - // I believe the following comment is now bogus, having applied to - // the code when it used CURLOPT_CUSTOMREQUEST to send the request. - // The way we send data, we cannot use persistent connections, since - // there will be some "junk" at the end of our request. - //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true); - $this->persistentConnection = false; - $this->setHeader('Connection', 'close'); - } - // set timeouts - if ($connection_timeout != 0) { - $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout); - } - if ($response_timeout != 0) { - $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); - } - - if ($this->scheme == 'https') { - $this->debug('set cURL SSL verify options'); - // recent versions of cURL turn on peer/host checking by default, - // while PHP binaries are not compiled with a default location for the - // CA cert bundle, so disable peer/host checking. - //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt'); - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0); - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0); - - // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo) - if ($this->authtype == 'certificate') { - $this->debug('set cURL certificate options'); - if (isset($this->certRequest['cainfofile'])) { - $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']); - } - if (isset($this->certRequest['verifypeer'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1); - } - if (isset($this->certRequest['verifyhost'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1); - } - if (isset($this->certRequest['sslcertfile'])) { - $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']); - } - if (isset($this->certRequest['sslkeyfile'])) { - $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']); - } - if (isset($this->certRequest['passphrase'])) { - $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']); - } - if (isset($this->certRequest['certpassword'])) { - $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']); - } - } - } - if ($this->authtype && ($this->authtype != 'certificate')) { - if ($this->username) { - $this->debug('set cURL username/password'); - $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password"); - } - if ($this->authtype == 'basic') { - $this->debug('set cURL for Basic authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC); - } - if ($this->authtype == 'digest') { - $this->debug('set cURL for digest authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST); - } - if ($this->authtype == 'ntlm') { - $this->debug('set cURL for NTLM authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM); - } - } - if (is_array($this->proxy)) { - $this->debug('set cURL proxy options'); - if ($this->proxy['port'] != '') { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']); - } else { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']); - } - if ($this->proxy['username'] || $this->proxy['password']) { - $this->debug('set cURL proxy authentication options'); - $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']); - if ($this->proxy['authtype'] == 'basic') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC); - } - if ($this->proxy['authtype'] == 'ntlm') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM); - } - } - } - $this->debug('cURL connection set up'); - return true; - } else { - $this->setError('Unknown scheme ' . $this->scheme); - $this->debug('Unknown scheme ' . $this->scheme); - return false; - } - } - - /** - * sends the SOAP request and gets the SOAP response via HTTP[S] - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - */ - function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) { - - $this->debug('entered send() with data of length: '.strlen($data)); - - $this->tryagain = true; - $tries = 0; - while ($this->tryagain) { - $this->tryagain = false; - if ($tries++ < 2) { - // make connnection - if (!$this->connect($timeout, $response_timeout)){ - return false; - } - - // send request - if (!$this->sendRequest($data, $cookies)){ - return false; - } - - // get response - $respdata = $this->getResponse(); - } else { - $this->setError("Too many tries to get an OK response ($this->response_status_line)"); - } - } - $this->debug('end of send()'); - return $respdata; - } - - - /** - * sends the SOAP request and gets the SOAP response via HTTPS using CURL - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - * @deprecated - */ - function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) { - return $this->send($data, $timeout, $response_timeout, $cookies); - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $digestRequest (keys must be nonce, nc, realm, qop) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype digestRequest="); - $this->appendDebug($this->varDump($digestRequest)); - $this->debug("certRequest="); - $this->appendDebug($this->varDump($certRequest)); - // cf. RFC 2617 - if ($authtype == 'basic') { - $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); - } elseif ($authtype == 'digest') { - if (isset($digestRequest['nonce'])) { - $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; - - // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) - - // A1 = unq(username-value) ":" unq(realm-value) ":" passwd - $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; - - // H(A1) = MD5(A1) - $HA1 = md5($A1); - - // A2 = Method ":" digest-uri-value - $A2 = $this->request_method . ':' . $this->digest_uri; - - // H(A2) - $HA2 = md5($A2); - - // KD(secret, data) = H(concat(secret, ":", data)) - // if qop == auth: - // request-digest = <"> < KD ( H(A1), unq(nonce-value) - // ":" nc-value - // ":" unq(cnonce-value) - // ":" unq(qop-value) - // ":" H(A2) - // ) <"> - // if qop is missing, - // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> - - $unhashedDigest = ''; - $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; - $cnonce = $nonce; - if ($digestRequest['qop'] != '') { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; - } else { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; - } - - $hashedDigest = md5($unhashedDigest); - - $opaque = ''; - if (isset($digestRequest['opaque'])) { - $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; - } - - $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"'); - } - } elseif ($authtype == 'certificate') { - $this->certRequest = $certRequest; - $this->debug('Authorization header not set for certificate'); - } elseif ($authtype == 'ntlm') { - // do nothing - $this->debug('Authorization header not set for ntlm'); - } - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->digestRequest = $digestRequest; - } - - /** - * set the soapaction value - * - * @param string $soapaction - * @access public - */ - function setSOAPAction($soapaction) { - $this->setHeader('SOAPAction', '"' . $soapaction . '"'); - } - - /** - * use http encoding - * - * @param string $enc encoding style. supported values: gzip, deflate, or both - * @access public - */ - function setEncoding($enc='gzip, deflate') { - if (function_exists('gzdeflate')) { - $this->protocol_version = '1.1'; - $this->setHeader('Accept-Encoding', $enc); - if (!isset($this->outgoing_headers['Connection'])) { - $this->setHeader('Connection', 'close'); - $this->persistentConnection = false; - } - // deprecated as of PHP 5.3.0 - //set_magic_quotes_runtime(0); - $this->encoding = $enc; - } - } - - /** - * set proxy info here - * - * @param string $proxyhost use an empty string to remove proxy - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param string $proxyauthtype (basic|ntlm) - * @access public - */ - function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') { - if ($proxyhost) { - $this->proxy = array( - 'host' => $proxyhost, - 'port' => $proxyport, - 'username' => $proxyusername, - 'password' => $proxypassword, - 'authtype' => $proxyauthtype - ); - if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') { - $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)); - } - } else { - $this->debug('remove proxy'); - $proxy = null; - unsetHeader('Proxy-Authorization'); - } - } - - - /** - * Test if the given string starts with a header that is to be skipped. - * Skippable headers result from chunked transfer and proxy requests. - * - * @param string $data The string to check. - * @returns boolean Whether a skippable header was found. - * @access private - */ - function isSkippableCurlHeader(&$data) { - $skipHeaders = array( 'HTTP/1.1 100', - 'HTTP/1.0 301', - 'HTTP/1.1 301', - 'HTTP/1.0 302', - 'HTTP/1.1 302', - 'HTTP/1.0 401', - 'HTTP/1.1 401', - 'HTTP/1.0 200 Connection established'); - foreach ($skipHeaders as $hd) { - $prefix = substr($data, 0, strlen($hd)); - if ($prefix == $hd) return true; - } - - return false; - } - - /** - * decode a string that is encoded w/ "chunked' transfer encoding - * as defined in RFC2068 19.4.6 - * - * @param string $buffer - * @param string $lb - * @returns string - * @access public - * @deprecated - */ - function decodeChunked($buffer, $lb){ - // length := 0 - $length = 0; - $new = ''; - - // read chunk-size, chunk-extension (if any) and CRLF - // get the position of the linebreak - $chunkend = strpos($buffer, $lb); - if ($chunkend == FALSE) { - $this->debug('no linebreak found in decodeChunked'); - return $new; - } - $temp = substr($buffer,0,$chunkend); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend + strlen($lb); - // while (chunk-size > 0) { - while ($chunk_size > 0) { - $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); - $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); - - // Just in case we got a broken connection - if ($chunkend == FALSE) { - $chunk = substr($buffer,$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - $length += strlen($chunk); - break; - } - - // read chunk-data and CRLF - $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - // length := length + chunk-size - $length += strlen($chunk); - // read chunk-size and CRLF - $chunkstart = $chunkend + strlen($lb); - - $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb); - if ($chunkend == FALSE) { - break; //Just in case we got a broken connection - } - $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend; - } - return $new; - } - - /** - * Writes the payload, including HTTP headers, to $this->outgoing_payload. - * - * @param string $data HTTP body - * @param string $cookie_str data for HTTP Cookie header - * @return void - * @access private - */ - function buildPayload($data, $cookie_str = '') { - // Note: for cURL connections, $this->outgoing_payload is ignored, - // as is the Content-Length header, but these are still created as - // debugging guides. - - // add content-length header - if ($this->request_method != 'GET') { - $this->setHeader('Content-Length', strlen($data)); - } - - // start building outgoing payload: - if ($this->proxy) { - $uri = $this->url; - } else { - $uri = $this->uri; - } - $req = "$this->request_method $uri HTTP/$this->protocol_version"; - $this->debug("HTTP request: $req"); - $this->outgoing_payload = "$req\r\n"; - - // loop thru headers, serializing - foreach($this->outgoing_headers as $k => $v){ - $hdr = $k.': '.$v; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // add any cookies - if ($cookie_str != '') { - $hdr = 'Cookie: '.$cookie_str; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // header/body separator - $this->outgoing_payload .= "\r\n"; - - // add data - $this->outgoing_payload .= $data; - } - - /** - * sends the SOAP request via HTTP[S] - * - * @param string $data message data - * @param array $cookies cookies to send - * @return boolean true if OK, false if problem - * @access private - */ - function sendRequest($data, $cookies = NULL) { - // build cookie string - $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https'))); - - // build payload - $this->buildPayload($data, $cookie_str); - - if ($this->io_method() == 'socket') { - // send payload - if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { - $this->setError('couldn\'t write message data to socket'); - $this->debug('couldn\'t write message data to socket'); - return false; - } - $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); - return true; - } else if ($this->io_method() == 'curl') { - // set payload - // cURL does say this should only be the verb, and in fact it - // turns out that the URI and HTTP version are appended to this, which - // some servers refuse to work with (so we no longer use this method!) - //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); - $curl_headers = array(); - foreach($this->outgoing_headers as $k => $v){ - if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { - $this->debug("Skip cURL header $k: $v"); - } else { - $curl_headers[] = "$k: $v"; - } - } - if ($cookie_str != '') { - $curl_headers[] = 'Cookie: ' . $cookie_str; - } - $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); - $this->debug('set cURL HTTP headers'); - if ($this->request_method == "POST") { - $this->setCurlOption(CURLOPT_POST, 1); - $this->setCurlOption(CURLOPT_POSTFIELDS, $data); - $this->debug('set cURL POST data'); - } else { - } - // insert custom user-set cURL options - foreach ($this->ch_options as $key => $val) { - $this->setCurlOption($key, $val); - } - - $this->debug('set cURL payload'); - return true; - } - } - - /** - * gets the SOAP response via HTTP[S] - * - * @return string the response (also sets member variables like incoming_payload) - * @access private - */ - function getResponse(){ - $this->incoming_payload = ''; - - if ($this->io_method() == 'socket') { - // loop until headers have been retrieved - $data = ''; - while (!isset($lb)){ - - // We might EOF during header read. - if(feof($this->fp)) { - $this->incoming_payload = $data; - $this->debug('found no headers before EOF after length ' . strlen($data)); - $this->debug("received before EOF:\n" . $data); - $this->setError('server failed to send headers'); - return false; - } - - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read line of $tmplen bytes: " . trim($tmp)); - - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of headers timed out after length ' . strlen($data)); - $this->debug("read before timeout: " . $data); - $this->setError('socket read of headers timed out'); - return false; - } - - $data .= $tmp; - $pos = strpos($data,"\r\n\r\n"); - if($pos > 1){ - $lb = "\r\n"; - } else { - $pos = strpos($data,"\n\n"); - if($pos > 1){ - $lb = "\n"; - } - } - // remove 100 headers - if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) { - unset($lb); - $data = ''; - }// - } - // store header data - $this->incoming_payload .= $data; - $this->debug('found end of headers after length ' . strlen($data)); - // process headers - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $this->incoming_headers = array(); - $this->incoming_cookies = array(); - foreach($header_array as $header_line){ - $arr = explode(':',$header_line, 2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - - // loop until msg has been received - if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { - $content_length = 2147483647; // ignore any content-length header - $chunked = true; - $this->debug("want to read chunked content"); - } elseif (isset($this->incoming_headers['content-length'])) { - $content_length = $this->incoming_headers['content-length']; - $chunked = false; - $this->debug("want to read content of length $content_length"); - } else { - $content_length = 2147483647; - $chunked = false; - $this->debug("want to read content to EOF"); - } - $data = ''; - do { - if ($chunked) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk line of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk length timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk length timed out'); - return false; - } - $content_length = hexdec(trim($tmp)); - $this->debug("chunk length $content_length"); - } - $strlen = 0; - while (($strlen < $content_length) && (!feof($this->fp))) { - $readlen = min(8192, $content_length - $strlen); - $tmp = fread($this->fp, $readlen); - $tmplen = strlen($tmp); - $this->debug("read buffer of $tmplen bytes"); - if (($tmplen == 0) && (!feof($this->fp))) { - $this->incoming_payload = $data; - $this->debug('socket read of body timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of body timed out'); - return false; - } - $strlen += $tmplen; - $data .= $tmp; - } - if ($chunked && ($content_length > 0)) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk terminator of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk terminator timed out'); - return false; - } - } - } while ($chunked && ($content_length > 0) && (!feof($this->fp))); - if (feof($this->fp)) { - $this->debug('read to EOF'); - } - $this->debug('read body of length ' . strlen($data)); - $this->incoming_payload .= $data; - $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); - - // close filepointer - if( - (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || - (! $this->persistentConnection) || feof($this->fp)){ - fclose($this->fp); - $this->fp = false; - $this->debug('closed socket'); - } - - // connection was closed unexpectedly - if($this->incoming_payload == ''){ - $this->setError('no response from server'); - return false; - } - - // decode transfer-encoding -// if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){ -// if(!$data = $this->decodeChunked($data, $lb)){ -// $this->setError('Decoding of chunked data failed'); -// return false; -// } - //print "
    \nde-chunked:\n---------------\n$data\n\n---------------\n
    "; - // set decoded payload -// $this->incoming_payload = $header_data.$lb.$lb.$data; -// } - - } else if ($this->io_method() == 'curl') { - // send and receive - $this->debug('send and receive with cURL'); - $this->incoming_payload = curl_exec($this->ch); - $data = $this->incoming_payload; - - $cErr = curl_error($this->ch); - if ($cErr != '') { - $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'
    '; - // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE - foreach(curl_getinfo($this->ch) as $k => $v){ - $err .= "$k: $v
    "; - } - $this->debug($err); - $this->setError($err); - curl_close($this->ch); - return false; - } else { - //echo '
    ';
    -			//var_dump(curl_getinfo($this->ch));
    -			//echo '
    '; - } - // close curl - $this->debug('No cURL error, closing cURL'); - curl_close($this->ch); - - // try removing skippable headers - $savedata = $data; - while ($this->isSkippableCurlHeader($data)) { - $this->debug("Found HTTP header to skip"); - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - - if ($data == '') { - // have nothing left; just remove 100 header(s) - $data = $savedata; - while (preg_match('/^HTTP\/1.1 100/',$data)) { - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - } - - // separate content from HTTP headers - if ($pos = strpos($data,"\r\n\r\n")) { - $lb = "\r\n"; - } elseif( $pos = strpos($data,"\n\n")) { - $lb = "\n"; - } else { - $this->debug('no proper separation of headers and document'); - $this->setError('no proper separation of headers and document'); - return false; - } - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $data = ltrim(substr($data,$pos)); - $this->debug('found proper separation of headers and document'); - $this->debug('cleaned data, stringlen: '.strlen($data)); - // clean headers - foreach ($header_array as $header_line) { - $arr = explode(':',$header_line,2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - } - - $this->response_status_line = $header_array[0]; - $arr = explode(' ', $this->response_status_line, 3); - $http_version = $arr[0]; - $http_status = intval($arr[1]); - $http_reason = count($arr) > 2 ? $arr[2] : ''; - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { - $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); - $this->setURL($this->incoming_headers['location']); - $this->tryagain = true; - return false; - } - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { - $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); - if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { - $this->debug('Server wants digest authentication'); - // remove "Digest " from our elements - $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']); - - // parse elements into array - $digestElements = explode(',', $digestString); - foreach ($digestElements as $val) { - $tempElement = explode('=', trim($val), 2); - $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]); - } - - // should have (at least) qop, realm, nonce - if (isset($digestRequest['nonce'])) { - $this->setCredentials($this->username, $this->password, 'digest', $digestRequest); - $this->tryagain = true; - return false; - } - } - $this->debug('HTTP authentication failed'); - $this->setError('HTTP authentication failed'); - return false; - } - - if ( - ($http_status >= 300 && $http_status <= 307) || - ($http_status >= 400 && $http_status <= 417) || - ($http_status >= 501 && $http_status <= 505) - ) { - $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)"); - return false; - } - - // decode content-encoding - if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ - if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ - // if decoding works, use it. else assume data wasn't gzencoded - if(function_exists('gzinflate')){ - //$timer->setMarker('starting decoding of gzip/deflated content'); - // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) - // this means there are no Zlib headers, although there should be - $this->debug('The gzinflate function exists'); - $datalen = strlen($data); - if ($this->incoming_headers['content-encoding'] == 'deflate') { - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The inflated payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to inflate the payload'); - $this->setError('Error using gzinflate to inflate the payload'); - } - } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { - if ($degzdata = @gzinflate(substr($data, 10))) { // do our best - $data = $degzdata; - $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate(substr($data, 10))) { - $data = $degzdata; - $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to un-gzip the payload'); - $this->setError('Error using gzinflate to un-gzip the payload'); - } - } - //$timer->setMarker('finished decoding of gzip/deflated content'); - //print "\nde-inflated:\n---------------\n$data\n-------------\n"; - // set decoded payload - $this->incoming_payload = $header_data.$lb.$lb.$data; - } else { - $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - } - } else { - $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - } - } else { - $this->debug('No Content-Encoding header'); - } - - if(strlen($data) == 0){ - $this->debug('no data after headers!'); - $this->setError('no data present after HTTP headers'); - return false; - } - - return $data; - } - - /** - * sets the content-type for the SOAP message to be sent - * - * @param string $type the content type, MIME style - * @param mixed $charset character set used for encoding (or false) - * @access public - */ - function setContentType($type, $charset = false) { - $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); - } - - /** - * specifies that an HTTP persistent connection should be used - * - * @return boolean whether the request was honored by this method. - * @access public - */ - function usePersistentConnection(){ - if (isset($this->outgoing_headers['Accept-Encoding'])) { - return false; - } - $this->protocol_version = '1.1'; - $this->persistentConnection = true; - $this->setHeader('Connection', 'Keep-Alive'); - return true; - } - - /** - * parse an incoming Cookie into it's parts - * - * @param string $cookie_str content of cookie - * @return array with data of that cookie - * @access private - */ - /* - * TODO: allow a Set-Cookie string to be parsed into multiple cookies - */ - function parseCookie($cookie_str) { - $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; - $data = preg_split('/;/', $cookie_str); - $value_str = $data[0]; - - $cookie_param = 'domain='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $domain = substr($cookie_str, $start + strlen($cookie_param)); - $domain = substr($domain, 0, strpos($domain, ';')); - } else { - $domain = ''; - } - - $cookie_param = 'expires='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $expires = substr($cookie_str, $start + strlen($cookie_param)); - $expires = substr($expires, 0, strpos($expires, ';')); - } else { - $expires = ''; - } - - $cookie_param = 'path='; - $start = strpos($cookie_str, $cookie_param); - if ( $start > 0 ) { - $path = substr($cookie_str, $start + strlen($cookie_param)); - $path = substr($path, 0, strpos($path, ';')); - } else { - $path = '/'; - } - - $cookie_param = ';secure;'; - if (strpos($cookie_str, $cookie_param) !== FALSE) { - $secure = true; - } else { - $secure = false; - } - - $sep_pos = strpos($value_str, '='); - - if ($sep_pos) { - $name = substr($value_str, 0, $sep_pos); - $value = substr($value_str, $sep_pos + 1); - $cookie= array( 'name' => $name, - 'value' => $value, - 'domain' => $domain, - 'path' => $path, - 'expires' => $expires, - 'secure' => $secure - ); - return $cookie; - } - return false; - } - - /** - * sort out cookies for the current request - * - * @param array $cookies array with all cookies - * @param boolean $secure is the send-content secure or not? - * @return string for Cookie-HTTP-Header - * @access private - */ - function getCookiesForRequest($cookies, $secure=false) { - $cookie_str = ''; - if ((! is_null($cookies)) && (is_array($cookies))) { - foreach ($cookies as $cookie) { - if (! is_array($cookie)) { - continue; - } - $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) <= time()) { - $this->debug('cookie has expired'); - continue; - } - } - if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { - $domain = preg_quote($cookie['domain']); - if (! preg_match("'.*$domain$'i", $this->host)) { - $this->debug('cookie has different domain'); - continue; - } - } - if ((isset($cookie['path'])) && (! empty($cookie['path']))) { - $path = preg_quote($cookie['path']); - if (! preg_match("'^$path.*'i", $this->path)) { - $this->debug('cookie is for a different path'); - continue; - } - } - if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { - $this->debug('cookie is secure, transport is not'); - continue; - } - $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; - $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); - } - } - return $cookie_str; - } -} - - -?> \ No newline at end of file diff --git a/lib/nusoap/class.soap_val.php b/lib/nusoap/class.soap_val.php deleted file mode 100644 index 4438f5cff..000000000 --- a/lib/nusoap/class.soap_val.php +++ /dev/null @@ -1,107 +0,0 @@ - -* @version $Id: class.soap_val.php,v 1.11 2007/04/06 13:56:32 snichol Exp $ -* @access public -*/ -class soapval extends nusoap_base { - /** - * The XML element name - * - * @var string - * @access private - */ - var $name; - /** - * The XML type name (string or false) - * - * @var mixed - * @access private - */ - var $type; - /** - * The PHP value - * - * @var mixed - * @access private - */ - var $value; - /** - * The XML element namespace (string or false) - * - * @var mixed - * @access private - */ - var $element_ns; - /** - * The XML type namespace (string or false) - * - * @var mixed - * @access private - */ - var $type_ns; - /** - * The XML element attributes (array or false) - * - * @var mixed - * @access private - */ - var $attributes; - - /** - * constructor - * - * @param string $name optional name - * @param mixed $type optional type name - * @param mixed $value optional value - * @param mixed $element_ns optional namespace of value - * @param mixed $type_ns optional namespace of type - * @param mixed $attributes associative array of attributes to add to element serialization - * @access public - */ - function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) { - parent::nusoap_base(); - $this->name = $name; - $this->type = $type; - $this->value = $value; - $this->element_ns = $element_ns; - $this->type_ns = $type_ns; - $this->attributes = $attributes; - } - - /** - * return serialized value - * - * @param string $use The WSDL use value (encoded|literal) - * @return string XML data - * @access public - */ - function serialize($use='encoded') { - return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true); - } - - /** - * decodes a soapval object into a PHP native type - * - * @return mixed - * @access public - */ - function decode(){ - return $this->value; - } -} - - - - -?> \ No newline at end of file diff --git a/lib/nusoap/class.soapclient.php b/lib/nusoap/class.soapclient.php deleted file mode 100644 index 6944c2aab..000000000 --- a/lib/nusoap/class.soapclient.php +++ /dev/null @@ -1,991 +0,0 @@ -call( string methodname [ ,array parameters] ); -* -* // bye bye client -* unset($soapclient); -* -* @author Dietrich Ayala -* @author Scott Nichol -* @version $Id: class.soapclient.php,v 1.69 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_client extends nusoap_base { - - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - var $requestHeaders = false; // SOAP headers in request (text) - var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) - var $responseHeader = NULL; // SOAP Header from response (parsed) - var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) - var $endpoint; - var $forceEndpoint = ''; // overrides WSDL endpoint - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $portName = ''; // port name to use in WSDL - var $xml_encoding = ''; // character set encoding of incoming (response) messages - var $http_encoding = false; - var $timeout = 0; // HTTP connection timeout - var $response_timeout = 30; // HTTP response timeout - var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error - var $persistentConnection = false; - var $defaultRpcParams = false; // This is no longer used - var $request = ''; // HTTP request - var $response = ''; // HTTP response - var $responseData = ''; // SOAP payload of response - var $cookies = array(); // Cookies from response or for request - var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() - var $operations = array(); // WSDL operations, empty for WSDL initialization error - var $curl_options = array(); // User-specified cURL options - var $bindingType = ''; // WSDL operation binding type - var $use_curl = false; // whether to always try to use cURL - - /* - * fault related variables - */ - /** - * @var fault - * @access public - */ - var $fault; - /** - * @var faultcode - * @access public - */ - var $faultcode; - /** - * @var faultstring - * @access public - */ - var $faultstring; - /** - * @var faultdetail - * @access public - */ - var $faultdetail; - - /** - * constructor - * - * @param mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object) - * @param mixed $wsdl optional, set to 'wsdl' or true if using WSDL - * @param string $proxyhost optional - * @param string $proxyport optional - * @param string $proxyusername optional - * @param string $proxypassword optional - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param string $portName optional portName in WSDL document - * @access public - */ - function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){ - parent::nusoap_base(); - $this->endpoint = $endpoint; - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - $this->portName = $portName; - - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->appendDebug('endpoint=' . $this->varDump($endpoint)); - - // make values - if($wsdl){ - if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) { - $this->wsdl = $endpoint; - $this->endpoint = $this->wsdl->wsdl; - $this->wsdlFile = $this->endpoint; - $this->debug('existing wsdl instance created from ' . $this->endpoint); - $this->checkWSDL(); - } else { - $this->wsdlFile = $this->endpoint; - $this->wsdl = null; - $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint); - } - $this->endpointType = 'wsdl'; - } else { - $this->debug("instantiate SOAP with endpoint at $endpoint"); - $this->endpointType = 'soap'; - } - } - - /** - * calls method, returns PHP native type - * - * @param string $operation SOAP server URL or path - * @param mixed $params An array, associative or simple, of the parameters - * for the method call, or a string that is the XML - * for the call. For rpc style, this call will - * wrap the XML in a tag named after the method, as - * well as the SOAP Envelope and Body. For document - * style, this will only wrap with the Envelope and Body. - * IMPORTANT: when using an array with document style, - * in which case there - * is really one parameter, the root of the fragment - * used in the call, which encloses what programmers - * normally think of parameters. A parameter array - * *must* include the wrapper. - * @param string $namespace optional method namespace (WSDL can override) - * @param string $soapAction optional SOAPAction value (WSDL can override) - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param boolean $rpcParams optional (no longer used) - * @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override) - * @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override) - * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors - * @access public - */ - function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){ - $this->operation = $operation; - $this->fault = false; - $this->setError(''); - $this->request = ''; - $this->response = ''; - $this->responseData = ''; - $this->faultstring = ''; - $this->faultcode = ''; - $this->opData = array(); - - $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); - $this->appendDebug('params=' . $this->varDump($params)); - $this->appendDebug('headers=' . $this->varDump($headers)); - if ($headers) { - $this->requestHeaders = $headers; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - // serialize parameters - if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){ - // use WSDL for operation - $this->opData = $opData; - $this->debug("found operation"); - $this->appendDebug('opData=' . $this->varDump($opData)); - if (isset($opData['soapAction'])) { - $soapAction = $opData['soapAction']; - } - if (! $this->forceEndpoint) { - $this->endpoint = $opData['endpoint']; - } else { - $this->endpoint = $this->forceEndpoint; - } - $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; - $style = $opData['style']; - $use = $opData['input']['use']; - // add ns to ns array - if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){ - $nsPrefix = 'ns' . rand(1000, 9999); - $this->wsdl->namespaces[$nsPrefix] = $namespace; - } - $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace); - // serialize payload - if (is_string($params)) { - $this->debug("serializing param string for WSDL operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for WSDL operation $operation"); - $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType); - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = $this->wsdl->usedNamespaces; - if (isset($opData['input']['encodingStyle'])) { - $encodingStyle = $opData['input']['encodingStyle']; - } else { - $encodingStyle = ''; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if ($errstr = $this->wsdl->getError()) { - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - return false; - } - } elseif($this->endpointType == 'wsdl') { - // operation not in WSDL - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->setError('operation '.$operation.' not present in WSDL.'); - $this->debug("operation '$operation' not present in WSDL."); - return false; - } else { - // no WSDL - //$this->namespaces['ns1'] = $namespace; - $nsPrefix = 'ns' . rand(1000, 9999); - // serialize - $payload = ''; - if (is_string($params)) { - $this->debug("serializing param string for operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for operation $operation"); - foreach($params as $k => $v){ - $payload .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = array(); - if ($use == 'encoded') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } else { - $encodingStyle = ''; - } - } - // wrap RPC calls with method element - if ($style == 'rpc') { - if ($use == 'literal') { - $this->debug("wrapping RPC request with literal method element"); - if ($namespace) { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . $payload . ""; - } - } else { - $this->debug("wrapping RPC request with encoded method element"); - if ($namespace) { - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . - $payload . - ""; - } - } - } - // serialize envelope - $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle); - $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle"); - $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000)); - // send - $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout); - if($errstr = $this->getError()){ - $this->debug('Error: '.$errstr); - return false; - } else { - $this->return = $return; - $this->debug('sent message successfully and got a(n) '.gettype($return)); - $this->appendDebug('return=' . $this->varDump($return)); - - // fault? - if(is_array($return) && isset($return['faultcode'])){ - $this->debug('got fault'); - $this->setError($return['faultcode'].': '.$return['faultstring']); - $this->fault = true; - foreach($return as $k => $v){ - $this->$k = $v; - $this->debug("$k = $v
    "); - } - return $return; - } elseif ($style == 'document') { - // NOTE: if the response is defined to have multiple parts (i.e. unwrapped), - // we are only going to return the first part here...sorry about that - return $return; - } else { - // array of return values - if(is_array($return)){ - // multiple 'out' parameters, which we return wrapped up - // in the array - if(sizeof($return) > 1){ - return $return; - } - // single 'out' parameter (normally the return value) - $return = array_shift($return); - $this->debug('return shifted value: '); - $this->appendDebug($this->varDump($return)); - return $return; - // nothing returned (ie, echoVoid) - } else { - return ""; - } - } - } - } - - /** - * check WSDL passed as an instance or pulled from an endpoint - * - * @access private - */ - function checkWSDL() { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('checkWSDL'); - // catch errors - if ($errstr = $this->wsdl->getError()) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap12'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************'); - } else { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('getOperations returned false'); - $this->setError('no operations defined in the WSDL document!'); - } - } - - /** - * instantiate wsdl object and parse wsdl file - * - * @access public - */ - function loadWSDL() { - $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile); - $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl); - $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest); - $this->wsdl->fetchWSDL($this->wsdlFile); - $this->checkWSDL(); - } - - /** - * get available data pertaining to an operation - * - * @param string $operation operation name - * @return array array of data pertaining to the operation - * @access public - */ - function getOperationData($operation){ - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - if(isset($this->operations[$operation])){ - return $this->operations[$operation]; - } - $this->debug("No data for operation: $operation"); - } - - /** - * send the SOAP message - * - * Note: if the operation has multiple return values - * the return value of this method will be an array - * of those values. - * - * @param string $msg a SOAPx4 soapmsg object - * @param string $soapaction SOAPAction value - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return mixed native PHP types. - * @access private - */ - function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) { - $this->checkCookies(); - // detect transport - switch(true){ - // http(s) - case preg_match('/^http/',$this->endpoint): - $this->debug('transporting via HTTP'); - if($this->persistentConnection == true && is_object($this->persistentConnection)){ - $http =& $this->persistentConnection; - } else { - $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl); - if ($this->persistentConnection) { - $http->usePersistentConnection(); - } - } - $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset()); - $http->setSOAPAction($soapaction); - if($this->proxyhost && $this->proxyport){ - $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if($this->authtype != '') { - $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - if($this->http_encoding != ''){ - $http->setEncoding($this->http_encoding); - } - $this->debug('sending message, length='.strlen($msg)); - if(preg_match('/^http:/',$this->endpoint)){ - //if(strpos($this->endpoint,'http:')){ - $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies); - } elseif(preg_match('/^https/',$this->endpoint)){ - //} elseif(strpos($this->endpoint,'https:')){ - //if(phpversion() == '4.3.0-dev'){ - //$response = $http->send($msg,$timeout,$response_timeout); - //$this->request = $http->outgoing_payload; - //$this->response = $http->incoming_payload; - //} else - $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies); - } else { - $this->setError('no http/s in endpoint url'); - } - $this->request = $http->outgoing_payload; - $this->response = $http->incoming_payload; - $this->appendDebug($http->getDebug()); - $this->UpdateCookies($http->incoming_cookies); - - // save transport object if using persistent connections - if ($this->persistentConnection) { - $http->clearDebug(); - if (!is_object($this->persistentConnection)) { - $this->persistentConnection = $http; - } - } - - if($err = $http->getError()){ - $this->setError('HTTP Error: '.$err); - return false; - } elseif($this->getError()){ - return false; - } else { - $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']); - return $this->parseResponse($http->incoming_headers, $this->responseData); - } - break; - default: - $this->setError('no transport found, or selected transport is not yet supported!'); - return false; - break; - } - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Response not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Response not of type text/xml: ' . $headers['content-type']); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8); - // add parser debug data to our debug - $this->appendDebug($parser->getDebug()); - // if parse errors - if($errstr = $parser->getError()){ - $this->setError( $errstr); - // destroy the parser object - unset($parser); - return false; - } else { - // get SOAP headers - $this->responseHeaders = $parser->getHeaders(); - // get SOAP headers - $this->responseHeader = $parser->get_soapheader(); - // get decoded message - $return = $parser->get_soapbody(); - // add document for doclit support - $this->document = $parser->document; - // destroy the parser object - unset($parser); - // return decode message - return $return; - } - } - - /** - * sets user-specified cURL options - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access public - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - $this->curl_options[$option] = $value; - } - - /** - * sets the SOAP endpoint, which can override WSDL - * - * @param string $endpoint The endpoint URL to use, or empty string or false to prevent override - * @access public - */ - function setEndpoint($endpoint) { - $this->debug("setEndpoint(\"$endpoint\")"); - $this->forceEndpoint = $endpoint; - } - - /** - * set the SOAP headers - * - * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers - * @access public - */ - function setHeaders($headers){ - $this->debug("setHeaders headers="); - $this->appendDebug($this->varDump($headers)); - $this->requestHeaders = $headers; - } - - /** - * get the SOAP response headers (namespace resolution incomplete) - * - * @return string - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * get the SOAP response Header (parsed) - * - * @return mixed - * @access public - */ - function getHeader(){ - return $this->responseHeader; - } - - /** - * set proxy info here - * - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @access public - */ - function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') { - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - /** - * use HTTP encoding - * - * @param string $enc HTTP encoding - * @access public - */ - function setHTTPEncoding($enc='gzip, deflate'){ - $this->debug("setHTTPEncoding(\"$enc\")"); - $this->http_encoding = $enc; - } - - /** - * Set whether to try to use cURL connections if possible - * - * @param boolean $use Whether to try to use cURL - * @access public - */ - function setUseCURL($use) { - $this->debug("setUseCURL($use)"); - $this->use_curl = $use; - } - - /** - * use HTTP persistent connections if possible - * - * @access public - */ - function useHTTPPersistentConnection(){ - $this->debug("useHTTPPersistentConnection"); - $this->persistentConnection = true; - } - - /** - * gets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style. - * Each call() can override this value. - * - * This is no longer used. - * - * @return boolean - * @access public - * @deprecated - */ - function getDefaultRpcParams() { - return $this->defaultRpcParams; - } - - /** - * sets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style - * Each call() can override this value. - * - * This is no longer used. - * - * @param boolean $rpcParams - * @access public - * @deprecated - */ - function setDefaultRpcParams($rpcParams) { - $this->defaultRpcParams = $rpcParams; - } - - /** - * dynamically creates an instance of a proxy class, - * allowing user to directly call methods from wsdl - * - * @return object soap_proxy object - * @access public - */ - function getProxy() { - $r = rand(); - $evalStr = $this->_getProxyClassCode($r); - //$this->debug("proxy class: $evalStr"); - if ($this->getError()) { - $this->debug("Error from _getProxyClassCode, so return NULL"); - return null; - } - // eval the class - eval($evalStr); - // instantiate proxy object - eval("\$proxy = new nusoap_proxy_$r('');"); - // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice - $proxy->endpointType = 'wsdl'; - $proxy->wsdlFile = $this->wsdlFile; - $proxy->wsdl = $this->wsdl; - $proxy->operations = $this->operations; - $proxy->defaultRpcParams = $this->defaultRpcParams; - // transfer other state - $proxy->soap_defencoding = $this->soap_defencoding; - $proxy->username = $this->username; - $proxy->password = $this->password; - $proxy->authtype = $this->authtype; - $proxy->certRequest = $this->certRequest; - $proxy->requestHeaders = $this->requestHeaders; - $proxy->endpoint = $this->endpoint; - $proxy->forceEndpoint = $this->forceEndpoint; - $proxy->proxyhost = $this->proxyhost; - $proxy->proxyport = $this->proxyport; - $proxy->proxyusername = $this->proxyusername; - $proxy->proxypassword = $this->proxypassword; - $proxy->http_encoding = $this->http_encoding; - $proxy->timeout = $this->timeout; - $proxy->response_timeout = $this->response_timeout; - $proxy->persistentConnection = &$this->persistentConnection; - $proxy->decode_utf8 = $this->decode_utf8; - $proxy->curl_options = $this->curl_options; - $proxy->bindingType = $this->bindingType; - $proxy->use_curl = $this->use_curl; - return $proxy; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access private - */ - function _getProxyClassCode($r) { - $this->debug("in getProxy endpointType=$this->endpointType"); - $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); - if ($this->endpointType != 'wsdl') { - $evalStr = 'A proxy can only be created for a WSDL client'; - $this->setError($evalStr); - $evalStr = "echo \"$evalStr\";"; - return $evalStr; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) { - return "echo \"" . $this->getError() . "\";"; - } - } - $evalStr = ''; - foreach ($this->operations as $operation => $opData) { - if ($operation != '') { - // create param string and param comment string - if (sizeof($opData['input']['parts']) > 0) { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = ''; - foreach ($opData['input']['parts'] as $name => $type) { - $paramStr .= "\$$name, "; - $paramArrayStr .= "'$name' => \$$name, "; - $paramCommentStr .= "$type \$$name, "; - } - $paramStr = substr($paramStr, 0, strlen($paramStr)-2); - $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2); - $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2); - } else { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = 'void'; - } - $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; - $evalStr .= "// $paramCommentStr - function " . str_replace('.', '__', $operation) . "($paramStr) { - \$params = array($paramArrayStr); - return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."'); - } - "; - unset($paramStr); - unset($paramCommentStr); - } - } - $evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client { - '.$evalStr.' -}'; - return $evalStr; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access public - */ - function getProxyClassCode() { - $r = rand(); - return $this->_getProxyClassCode($r); - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /* - * whether or not parser should decode utf8 element content - * - * @return always returns true - * @access public - */ - function decodeUTF8($bool){ - $this->decode_utf8 = $bool; - return true; - } - - /** - * adds a new Cookie into $this->cookies array - * - * @param string $name Cookie Name - * @param string $value Cookie Value - * @return boolean if cookie-set was successful returns true, else false - * @access public - */ - function setCookie($name, $value) { - if (strlen($name) == 0) { - return false; - } - $this->cookies[] = array('name' => $name, 'value' => $value); - return true; - } - - /** - * gets all Cookies - * - * @return array with all internal cookies - * @access public - */ - function getCookies() { - return $this->cookies; - } - - /** - * checks all Cookies and delete those which are expired - * - * @return boolean always return true - * @access private - */ - function checkCookies() { - if (sizeof($this->cookies) == 0) { - return true; - } - $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies'); - $curr_cookies = $this->cookies; - $this->cookies = array(); - foreach ($curr_cookies as $cookie) { - if (! is_array($cookie)) { - $this->debug('Remove cookie that is not an array'); - continue; - } - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) > time()) { - $this->cookies[] = $cookie; - } else { - $this->debug('Remove expired cookie ' . $cookie['name']); - } - } else { - $this->cookies[] = $cookie; - } - } - $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array'); - return true; - } - - /** - * updates the current cookies with a new set - * - * @param array $cookies new cookies with which to update current ones - * @return boolean always return true - * @access private - */ - function UpdateCookies($cookies) { - if (sizeof($this->cookies) == 0) { - // no existing cookies: take whatever is new - if (sizeof($cookies) > 0) { - $this->debug('Setting new cookie(s)'); - $this->cookies = $cookies; - } - return true; - } - if (sizeof($cookies) == 0) { - // no new cookies: keep what we've got - return true; - } - // merge - foreach ($cookies as $newCookie) { - if (!is_array($newCookie)) { - continue; - } - if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) { - continue; - } - $newName = $newCookie['name']; - - $found = false; - for ($i = 0; $i < count($this->cookies); $i++) { - $cookie = $this->cookies[$i]; - if (!is_array($cookie)) { - continue; - } - if (!isset($cookie['name'])) { - continue; - } - if ($newName != $cookie['name']) { - continue; - } - $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN'; - $domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN'; - if ($newDomain != $domain) { - continue; - } - $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH'; - $path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH'; - if ($newPath != $path) { - continue; - } - $this->cookies[$i] = $newCookie; - $found = true; - $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); - break; - } - if (! $found) { - $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); - $this->cookies[] = $newCookie; - } - } - return true; - } -} - -if (!extension_loaded('soap')) { - /** - * For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded. - */ - class soapclient extends nusoap_client { - } -} -?> diff --git a/lib/nusoap/class.wsdl.php b/lib/nusoap/class.wsdl.php deleted file mode 100644 index 62f98243c..000000000 --- a/lib/nusoap/class.wsdl.php +++ /dev/null @@ -1,1938 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.wsdl.php,v 1.76 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class wsdl extends nusoap_base { - // URL or filename of the root of this WSDL - var $wsdl; - // define internal arrays of bindings, ports, operations, messages, etc. - var $schemas = array(); - var $currentSchema; - var $message = array(); - var $complexTypes = array(); - var $messages = array(); - var $currentMessage; - var $currentOperation; - var $portTypes = array(); - var $currentPortType; - var $bindings = array(); - var $currentBinding; - var $ports = array(); - var $currentPort; - var $opData = array(); - var $status = ''; - var $documentation = false; - var $endpoint = ''; - // array of wsdl docs to import - var $import = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - // for getting wsdl - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $timeout = 0; - var $response_timeout = 30; - var $curl_options = array(); // User-specified cURL options - var $use_curl = false; // whether to always try to use cURL - // for HTTP authentication - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - - /** - * constructor - * - * @param string $wsdl WSDL document URL - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param array $curl_options user-specified cURL options - * @param boolean $use_curl try to use cURL - * @access public - */ - function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ - parent::nusoap_base(); - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - if (is_array($curl_options)) - $this->curl_options = $curl_options; - $this->use_curl = $use_curl; - $this->fetchWSDL($wsdl); - } - - /** - * fetches the WSDL document and parses it - * - * @access public - */ - function fetchWSDL($wsdl) { - $this->debug("parse and process WSDL path=$wsdl"); - $this->wsdl = $wsdl; - // parse wsdl file - if ($this->wsdl != "") { - $this->parseWSDL($this->wsdl); - } - // imports - // TODO: handle imports more properly, grabbing them in-line and nesting them - $imported_urls = array(); - $imported = 1; - while ($imported > 0) { - $imported = 0; - // Schema imports - foreach ($this->schemas as $ns => $list) { - foreach ($list as $ilist => $xs) { - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($xs->imports as $ns2 => $list2) { - for ($ii = 0; $ii < count($list2); $ii++) { - if (! $list2[$ii]['loaded']) { - $this->schemas[$ns][$ilist]->imports[$ns2][$ii]['loaded'] = true; - $url = $list2[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - } - // WSDL imports - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($this->import as $ns => $list) { - for ($ii = 0; $ii < count($list); $ii++) { - if (! $list[$ii]['loaded']) { - $this->import[$ns][$ii]['loaded'] = true; - $url = $list[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - // add new data to operation data - foreach($this->bindings as $binding => $bindingData) { - if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { - foreach($bindingData['operations'] as $operation => $data) { - $this->debug('post-parse data gathering for ' . $operation); - $this->bindings[$binding]['operations'][$operation]['input'] = - isset($this->bindings[$binding]['operations'][$operation]['input']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; - $this->bindings[$binding]['operations'][$operation]['output'] = - isset($this->bindings[$binding]['operations'][$operation]['output']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; - } - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; - } - // Set operation style if necessary, but do not override one already provided - if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { - $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; - } - $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; - $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; - } - } - } - } - - /** - * parses the wsdl document - * - * @param string $wsdl path or URL - * @access private - */ - function parseWSDL($wsdl = '') { - $this->debug("parse WSDL at path=$wsdl"); - - if ($wsdl == '') { - $this->debug('no wsdl passed to parseWSDL()!!'); - $this->setError('no wsdl passed to parseWSDL()!!'); - return false; - } - - // parse $wsdl for url format - $wsdl_props = parse_url($wsdl); - - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { - $this->debug('getting WSDL http(s) URL ' . $wsdl); - // get wsdl - $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); - $tr->request_method = 'GET'; - $tr->useSOAPAction = false; - if($this->proxyhost && $this->proxyport){ - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if ($this->authtype != '') { - $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - $tr->setEncoding('gzip, deflate'); - $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); - //$this->debug("WSDL request\n" . $tr->outgoing_payload); - //$this->debug("WSDL response\n" . $tr->incoming_payload); - $this->appendDebug($tr->getDebug()); - // catch errors - if($err = $tr->getError() ){ - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; - $this->debug($errstr); - $this->setError($errstr); - unset($tr); - return false; - } - unset($tr); - $this->debug("got WSDL URL"); - } else { - // $wsdl is not http(s), so treat it as a file URL or plain file path - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; - } else { - $path = $wsdl; - } - $this->debug('getting WSDL file ' . $path); - if ($fp = @fopen($path, 'r')) { - $wsdl_string = ''; - while ($data = fread($fp, 32768)) { - $wsdl_string .= $data; - } - fclose($fp); - } else { - $errstr = "Bad path to WSDL file $path"; - $this->debug($errstr); - $this->setError($errstr); - return false; - } - } - $this->debug('Parse WSDL'); - // end new code added - // Create an XML parser. - $this->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($this->parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element', 'end_element'); - xml_set_character_data_handler($this->parser, 'character_data'); - // Parse the XML file. - if (!xml_parse($this->parser, $wsdl_string, true)) { - // Display an error message. - $errstr = sprintf( - 'XML error parsing WSDL from %s on line %d: %s', - $wsdl, - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $wsdl_string); - $this->setError($errstr); - return false; - } - // free the parser - xml_parser_free($this->parser); - $this->debug('Parsing WSDL done'); - // catch wsdl parse errors - if($this->getError()){ - return false; - } - return true; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) - { - if ($this->status == 'schema') { - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } elseif (preg_match('/schema$/', $name)) { - $this->debug('Parsing WSDL schema'); - // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")"); - $this->status = 'schema'; - $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } else { - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - // process attributes - if (count($attrs) > 0) { - // register namespace declarations - foreach($attrs as $k => $v) { - if (preg_match('/^xmlns/',$k)) { - if ($ns_prefix = substr(strrchr($k, ':'), 1)) { - $this->namespaces[$ns_prefix] = $v; - } else { - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; - } - if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v . '-instance'; - } - } - } - // expand each attribute prefix to its namespace - foreach($attrs as $k => $v) { - $k = strpos($k, ':') ? $this->expandQname($k) : $k; - if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { - $v = strpos($v, ':') ? $this->expandQname($v) : $v; - } - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // get element prefix, namespace and name - if (preg_match('/:/', $name)) { - // get ns prefix - $prefix = substr($name, 0, strpos($name, ':')); - // get ns - $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; - // get unqualified name - $name = substr(strstr($name, ':'), 1); - } - // process attributes, expanding any prefixes to namespaces - // find status, register data - switch ($this->status) { - case 'message': - if ($name == 'part') { - if (isset($attrs['type'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; - } - if (isset($attrs['element'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; - } - } - break; - case 'portType': - switch ($name) { - case 'operation': - $this->currentPortOperation = $attrs['name']; - $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); - if (isset($attrs['parameterOrder'])) { - $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; - } - break; - case 'documentation': - $this->documentation = true; - break; - // merge input/output data - default: - $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; - $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; - break; - } - break; - case 'binding': - switch ($name) { - case 'binding': - // get ns prefix - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['prefix'] = $prefix; - } - $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); - break; - case 'header': - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; - break; - case 'operation': - if (isset($attrs['soapAction'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; - } - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; - } - if (isset($attrs['name'])) { - $this->currentOperation = $attrs['name']; - $this->debug("current binding operation: $this->currentOperation"); - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; - } - break; - case 'input': - $this->opStatus = 'input'; - break; - case 'output': - $this->opStatus = 'output'; - break; - case 'body': - if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); - } else { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; - } - break; - } - break; - case 'service': - switch ($name) { - case 'port': - $this->currentPort = $attrs['name']; - $this->debug('current port: ' . $this->currentPort); - $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); - - break; - case 'address': - $this->ports[$this->currentPort]['location'] = $attrs['location']; - $this->ports[$this->currentPort]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; - break; - } - break; - } - // set status - switch ($name) { - case 'import': - if (isset($attrs['location'])) { - $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); - } else { - $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); - } - break; - //wait for schema - //case 'types': - // $this->status = 'schema'; - // break; - case 'message': - $this->status = 'message'; - $this->messages[$attrs['name']] = array(); - $this->currentMessage = $attrs['name']; - break; - case 'portType': - $this->status = 'portType'; - $this->portTypes[$attrs['name']] = array(); - $this->currentPortType = $attrs['name']; - break; - case "binding": - if (isset($attrs['name'])) { - // get binding name - if (strpos($attrs['name'], ':')) { - $this->currentBinding = $this->getLocalPart($attrs['name']); - } else { - $this->currentBinding = $attrs['name']; - } - $this->status = 'binding'; - $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); - } - break; - case 'service': - $this->serviceName = $attrs['name']; - $this->status = 'service'; - $this->debug('current service: ' . $this->serviceName); - break; - case 'definitions': - foreach ($attrs as $name => $value) { - $this->wsdl_info[$name] = $value; - } - break; - } - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name){ - // unset schema status - if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { - $this->status = ""; - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; - $this->debug('Parsing WSDL schema done'); - } - if ($this->status == 'schema') { - $this->currentSchema->schemaEndElement($parser, $name); - } else { - // bring depth down a notch - $this->depth--; - } - // end documentation - if ($this->documentation) { - //TODO: track the node to which documentation should be assigned; it can be a part, message, etc. - //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation; - $this->documentation = false; - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data) - { - $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0; - if (isset($this->message[$pos]['cdata'])) { - $this->message[$pos]['cdata'] .= $data; - } - if ($this->documentation) { - $this->documentation .= $data; - } - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - function getBindingData($binding) - { - if (is_array($this->bindings[$binding])) { - return $this->bindings[$binding]; - } - } - - /** - * returns an assoc array of operation names => operation data - * - * @param string $portName WSDL port name - * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) - * @return array - * @access public - */ - function getOperations($portName = '', $bindingType = 'soap') { - $ops = array(); - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } else { - $this->debug("getOperations bindingType $bindingType may not be supported"); - } - $this->debug("getOperations for port '$portName' bindingType $bindingType"); - // loop thru ports - foreach($this->ports as $port => $portData) { - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); - if ($portName == '' || $port == $portName) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - $this->debug("getOperations found port $port bindingType $bindingType"); - //$this->debug("port data: " . $this->varDump($portData)); - //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); - // merge bindings - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); - } - } - } - } - if (count($ops) == 0) { - $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); - } - return $ops; - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $operation name of operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationData($operation, $bindingType = 'soap') - { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // get binding - //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { - // note that we could/should also check the namespace here - if ($operation == $bOperation) { - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; - return $opData; - } - } - } - } - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $soapAction soapAction for operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // loop through operations for the binding - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - if ($opData['soapAction'] == $soapAction) { - return $opData; - } - } - } - } - } - - /** - * returns an array of information about a given type - * returns false if no type exists by the given name - * - * typeDef = array( - * 'elements' => array(), // refs to elements array - * 'restrictionBase' => '', - * 'phpType' => '', - * 'order' => '(sequence|all)', - * 'attrs' => array() // refs to attributes array - * ) - * - * @param string $type the type - * @param string $ns namespace (not prefix) of the type - * @return mixed - * @access public - * @see nusoap_xmlschema - */ - function getTypeDef($type, $ns) { - $this->debug("in getTypeDef: type=$type, ns=$ns"); - if ((! $ns) && isset($this->namespaces['tns'])) { - $ns = $this->namespaces['tns']; - $this->debug("in getTypeDef: type namespace forced to $ns"); - } - if (!isset($this->schemas[$ns])) { - foreach ($this->schemas as $ns0 => $schema0) { - if (strcasecmp($ns, $ns0) == 0) { - $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0"); - $ns = $ns0; - break; - } - } - } - if (isset($this->schemas[$ns])) { - $this->debug("in getTypeDef: have schema for namespace $ns"); - for ($i = 0; $i < count($this->schemas[$ns]); $i++) { - $xs = &$this->schemas[$ns][$i]; - $t = $xs->getTypeDef($type); - $this->appendDebug($xs->getDebug()); - $xs->clearDebug(); - if ($t) { - $this->debug("in getTypeDef: found type $type"); - if (!isset($t['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($t['type'], strrpos($t['type'], ':') + 1); - $ns = substr($t['type'], 0, strrpos($t['type'], ':')); - $etype = $this->getTypeDef($uqType, $ns); - if ($etype) { - $this->debug("found type for [element] $type:"); - $this->debug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $t['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $t['elements'] = $etype['elements']; - } - if (isset($etype['attrs'])) { - $t['attrs'] = $etype['attrs']; - } - } else { - $this->debug("did not find type for [element] $type"); - } - } - return $t; - } - } - $this->debug("in getTypeDef: did not find type $type"); - } else { - $this->debug("in getTypeDef: do not have schema for namespace $ns"); - } - return false; - } - - /** - * prints html description of services - * - * @access private - */ - function webDescription(){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $PHP_SELF = $_SERVER['PHP_SELF']; - } elseif (isset($HTTP_SERVER_VARS)) { - $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - - $b = ' - NuSOAP: '.$this->serviceName.' - - - - -
    -

    -
    '.$this->serviceName.'
    - -
    '; - return $b; - } - - /** - * serialize the parsed wsdl - * - * @param mixed $debug whether to put debug=1 in endpoint URL - * @return string serialization of WSDL - * @access public - */ - function serialize($debug = 0) - { - $xml = ''; - $xml .= "\nnamespaces as $k => $v) { - $xml .= " xmlns:$k=\"$v\""; - } - // 10.9.02 - add poulter fix for wsdl and tns declarations - if (isset($this->namespaces['wsdl'])) { - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; - } - if (isset($this->namespaces['tns'])) { - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; - } - $xml .= '>'; - // imports - if (sizeof($this->import) > 0) { - foreach($this->import as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= ''; - } else { - $xml .= ''; - } - } - } - } - // types - if (count($this->schemas)>=1) { - $xml .= "\n\n"; - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $xml .= $xs->serializeSchema(); - } - } - $xml .= ''; - } - // messages - if (count($this->messages) >= 1) { - foreach($this->messages as $msgName => $msgParts) { - $xml .= "\n'; - if(is_array($msgParts)){ - foreach($msgParts as $partName => $partType) { - // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'
    '; - if (strpos($partType, ':')) { - $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); - } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { - // print 'checking typemap: '.$this->XMLSchemaVersion.'
    '; - $typePrefix = 'xsd'; - } else { - foreach($this->typemap as $ns => $types) { - if (isset($types[$partType])) { - $typePrefix = $this->getPrefixFromNamespace($ns); - } - } - if (!isset($typePrefix)) { - die("$partType has no namespace!"); - } - } - $ns = $this->getNamespaceFromPrefix($typePrefix); - $localPart = $this->getLocalPart($partType); - $typeDef = $this->getTypeDef($localPart, $ns); - if ($typeDef['typeClass'] == 'element') { - $elementortype = 'element'; - if (substr($localPart, -1) == '^') { - $localPart = substr($localPart, 0, -1); - } - } else { - $elementortype = 'type'; - } - $xml .= "\n" . ' '; - } - } - $xml .= '
    '; - } - } - // bindings & porttypes - if (count($this->bindings) >= 1) { - $binding_xml = ''; - $portType_xml = ''; - foreach($this->bindings as $bindingName => $attrs) { - $binding_xml .= "\n'; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n'; - foreach($attrs['operations'] as $opName => $opParts) { - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' ' . htmlspecialchars($opParts['documentation']) . ''; - } - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - } - $portType_xml .= "\n" . ''; - $binding_xml .= "\n" . ''; - } - $xml .= $portType_xml . $binding_xml; - } - // services - $xml .= "\nserviceName . '">'; - if (count($this->ports) >= 1) { - foreach($this->ports as $pName => $attrs) { - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - } - } - $xml .= "\n" . ''; - return $xml . "\n"; - } - - /** - * determine whether a set of parameters are unwrapped - * when they are expect to be wrapped, Microsoft-style. - * - * @param string $type the type (element name) of the wrapper - * @param array $parameters the parameter values for the SOAP call - * @return boolean whether they parameters are unwrapped (and should be wrapped) - * @access private - */ - function parametersMatchWrapped($type, &$parameters) { - $this->debug("in parametersMatchWrapped type=$type, parameters="); - $this->appendDebug($this->varDump($parameters)); - - // split type into namespace:unqualified-type - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns"); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in parametersMatchWrapped: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - - // get the type information - if (!$typeDef = $this->getTypeDef($uqType, $ns)) { - $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type."); - return false; - } - $this->debug("in parametersMatchWrapped: found typeDef="); - $this->appendDebug($this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - $phpType = $typeDef['phpType']; - $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''); - $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType"); - - // we expect a complexType or element of complexType - if ($phpType != 'struct') { - $this->debug("in parametersMatchWrapped: not a struct"); - return false; - } - - // see whether the parameter names match the elements - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $elements = 0; - $matches = 0; - foreach ($typeDef['elements'] as $name => $attrs) { - if (isset($parameters[$name])) { - $this->debug("in parametersMatchWrapped: have parameter named $name"); - $matches++; - } else { - $this->debug("in parametersMatchWrapped: do not have parameter named $name"); - } - $elements++; - } - - $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names"); - if ($matches == 0) { - return false; - } - return true; - } - - // since there are no elements for the type, if the user passed no - // parameters, the parameters match wrapped. - $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType"); - return count($parameters) == 0; - } - - /** - * serialize PHP values according to a WSDL message definition - * contrary to the method name, this is not limited to RPC - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @param string $bindingType (soap|soap12) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - */ - function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { - $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation, $bindingType)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - return false; - } - $this->debug('in serializeRPCParameters: opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - $parts = &$opData[$direction]['parts']; - $part_count = sizeof($parts); - $style = $opData['style']; - $use = $opData[$direction]['use']; - $this->debug("have $part_count part(s) to serialize using $style/$use"); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $parameter_count = count($parameters); - $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize"); - // check for Microsoft-style wrapped parameters - if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) { - $this->debug('check whether the caller has wrapped the parameters'); - if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) { - // TODO: consider checking here for double-wrapping, when - // service function wraps, then NuSOAP wraps again - $this->debug("change simple array to associative with 'parameters' element"); - $parameters['parameters'] = $parameters[0]; - unset($parameters[0]); - } - if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) { - $this->debug('check whether caller\'s parameters match the wrapped ones'); - if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) { - $this->debug('wrap the parameters for the caller'); - $parameters = array('parameters' => $parameters); - $parameter_count = 1; - } - } - } - foreach ($parts as $name => $type) { - $this->debug("serializing part $name of type $type"); - // Track encoding style - if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeRPCParameters returning: $xml"); - return $xml; - } - - /** - * serialize a PHP value according to a WSDL message definition - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - * @deprecated - */ - function serializeParameters($operation, $direction, $parameters) - { - $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); - return false; - } - $this->debug('opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - - $use = $opData[$direction]['use']; - $this->debug("use=$use"); - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $this->debug('have ' . $parametersArrayType . ' parameters'); - foreach($opData[$direction]['parts'] as $name => $type) { - $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); - // Track encoding style - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeParameters returning: $xml"); - return $xml; - } - - /** - * serializes a PHP value according a given type definition - * - * @param string $name name of value (part or element) - * @param string $type XML schema type of value (type or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @param boolean $unqualified a kludge for what should be XML namespace form handling - * @return string value serialized as an XML string - * @access private - */ - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) - { - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); - $this->appendDebug("value=" . $this->varDump($value)); - if($use == 'encoded' && $encodingStyle) { - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; - } - - // if a soapval has been supplied, let its type override the WSDL - if (is_object($value) && get_class($value) == 'soapval') { - if ($value->type_ns) { - $type = $value->type_ns . ':' . $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } elseif ($value->type) { - $type = $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } else { - $forceType = false; - $this->debug("in serializeType: soapval does not override type"); - } - $attrs = $value->attributes; - $value = $value->value; - $this->debug("in serializeType: soapval overrides value to $value"); - if ($attrs) { - if (!is_array($value)) { - $value['!'] = $value; - } - foreach ($attrs as $n => $v) { - $value['!' . $n] = $v; - } - $this->debug("in serializeType: soapval provides attributes"); - } - } else { - $forceType = false; - } - - $xml = ''; - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in serializeType: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); - } - - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ - $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); - if ($unqualified && $use == 'literal') { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - // TODO: depends on nillable, which should be checked before calling this method - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if ($uqType == 'Array') { - // JBoss/Axis does this sometimes - return $this->serialize_val($value, $name, false, false, false, false, $use); - } - if ($uqType == 'boolean') { - if ((is_string($value) && $value == 'false') || (! $value)) { - $value = 'false'; - } else { - $value = 'true'; - } - } - if ($uqType == 'string' && gettype($value) == 'string') { - $value = $this->expandEntities($value); - } - if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') { - $value = sprintf("%.0lf", $value); - } - // it's a scalar - // TODO: what about null/nil values? - // check type isn't a custom type extending xmlschema namespace - if (!$this->getTypeDef($uqType, $ns)) { - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)'); - } else if ($ns == 'http://xml.apache.org/xml-soap') { - $this->debug('in serializeType: appears to be Apache SOAP type'); - if ($uqType == 'Map') { - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - if (! $tt_prefix) { - $this->debug('in serializeType: Add namespace for Apache SOAP type'); - $tt_prefix = 'ns' . rand(1000, 9999); - $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; - // force this to be added to usedNamespaces - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - } - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing map element: key $k, value $v"); - $contents .= ''; - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); - $contents .= ''; - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents"; - } else { - $xml = "<$name>$contents"; - } - } else { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('in serializeType: Apache SOAP type, but only support Map'); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in serializeType: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ - $this->setError("$type ($uqType) is not a supported type."); - $this->debug("in serializeType: $type ($uqType) is not a supported type."); - return false; - } else { - $this->debug("in serializeType: found typeDef"); - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - } - if (!isset($typeDef['phpType'])) { - $this->setError("$type ($uqType) has no phpType."); - $this->debug("in serializeType: $type ($uqType) has no phpType."); - return false; - } - $phpType = $typeDef['phpType']; - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); - // if php type == struct, map value to the element names - if ($phpType == 'struct') { - if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { - $elementName = $uqType; - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - $elementNS = " xmlns=\"\""; - } - } else { - $elementName = $name; - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs and nillable - $xml = "<$elementName$elementNS/>"; - } else { - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (is_object($value)) { - $value = get_object_vars($value); - } - if (is_array($value)) { - $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); - if ($use == 'literal') { - if ($forceType) { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; - } else { - $xml = "<$elementName$elementNS$elementAttrs>"; - } - } else { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; - } - - if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { - if (isset($value['!'])) { - $xml .= $value['!']; - $this->debug("in serializeType: serialized simpleContent for type $type"); - } else { - $this->debug("in serializeType: no simpleContent to serialize for type $type"); - } - } else { - // complexContent - $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle); - } - $xml .= ""; - } else { - $this->debug("in serializeType: phpType is struct, but value is not an array"); - $this->setError("phpType is struct, but value is not an array: see debug output for details"); - $xml = ''; - } - } elseif ($phpType == 'array') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ":Array\" " . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ':arrayType="' . - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . - ':' . - $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (isset($typeDef['multidimensional'])) { - $nv = array(); - foreach($value as $v) { - $cols = ',' . sizeof($v); - $nv = array_merge($nv, $v); - } - $value = $nv; - } else { - $cols = ''; - } - if (is_array($value) && sizeof($value) >= 1) { - $rows = sizeof($value); - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); - //if (strpos($typeDef['arrayType'], ':') ) { - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { - $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); - } else { - $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); - } - } - } else { - $rows = 0; - $contents = null; - } - // TODO: for now, an empty value will be serialized as a zero element - // array. Revisit this when coding the handling of null/nil values. - if ($use == 'literal') { - $xml = "<$name$elementNS>" - .$contents - .""; - } else { - $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') - .':arrayType="' - .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) - .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" - .$contents - .""; - } - } elseif ($phpType == 'scalar') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - - /** - * serializes the attributes for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) { - $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize attributes for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) { - $this->debug("serialize attributes for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - foreach ($typeDef['attrs'] as $aName => $attrs) { - if (isset($xvalue['!' . $aName])) { - $xname = '!' . $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($xvalue[$aName])) { - $xname = $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($attrs['default'])) { - $xname = '!' . $aName; - $xvalue[$xname] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); - } else { - $xname = ''; - $this->debug("no value provided for attribute $aName"); - } - if ($xname) { - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; - } - } - } else { - $this->debug("no attributes to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * serializes the elements for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { - $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize elements for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - // toggle whether all elements are present - ideally should validate against schema - if (count($typeDef['elements']) != count($xvalue)){ - $optionals = true; - } - foreach ($typeDef['elements'] as $eName => $attrs) { - if (!isset($xvalue[$eName])) { - if (isset($attrs['default'])) { - $xvalue[$eName] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); - } - } - // if user took advantage of a minOccurs=0, then only serialize named parameters - if (isset($optionals) - && (!isset($xvalue[$eName])) - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') - ){ - if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); - } - // do nothing - $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); - } else { - // get value - if (isset($xvalue[$eName])) { - $v = $xvalue[$eName]; - } else { - $v = null; - } - if (isset($attrs['form'])) { - $unqualified = ($attrs['form'] == 'unqualified'); - } else { - $unqualified = false; - } - if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') { - $vv = $v; - foreach ($vv as $k => $v) { - if (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } else { - if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { - // do nothing - } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { - // TODO: serialize a nil correctly, but for now serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } elseif (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } - } - } else { - $this->debug("no elements to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * adds an XML Schema complex type to the WSDL types - * - * @param string $name - * @param string $typeClass (complexType|simpleType|attribute) - * @param string $phpType currently supported are array and struct (php assoc array) - * @param string $compositor (all|sequence|choice) - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) - * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) - * @param string $arrayType as namespace:name (xsd:string) - * @see nusoap_xmlschema - * @access public - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { - if (count($elements) > 0) { - $eElements = array(); - foreach($elements as $n => $e){ - // expand each element - $ee = array(); - foreach ($e as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $ee[$k] = $v; - } - $eElements[$n] = $ee; - } - $elements = $eElements; - } - - if (count($attrs) > 0) { - foreach($attrs as $n => $a){ - // expand each attribute - foreach ($a as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $aa[$k] = $v; - } - $eAttrs[$n] = $aa; - } - $attrs = $eAttrs; - } - - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); - } - - /** - * adds an XML Schema simple type to the WSDL types - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @see nusoap_xmlschema - * @access public - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); - } - - /** - * adds an element to the WSDL types - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addElement($attrs); - } - - /** - * register an operation with the server - * - * @param string $name operation (method) name - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param string $namespace optional The namespace for the operation - * @param string $soapaction optional The soapaction for the operation - * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) - * @param string $documentation optional The description to include in the WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - if ($style == 'document') { - $elements = array(); - foreach ($in as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); - $in = array('parameters' => 'tns:' . $name . '^'); - - $elements = array(); - foreach ($out as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); - } - - // get binding - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = - array( - 'name' => $name, - 'binding' => $this->serviceName . 'Binding', - 'endpoint' => $this->endpoint, - 'soapAction' => $soapaction, - 'style' => $style, - 'input' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Request', - 'parts' => $in), - 'output' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Response', - 'parts' => $out), - 'namespace' => $namespace, - 'transport' => 'http://schemas.xmlsoap.org/soap/http', - 'documentation' => $documentation); - // add portTypes - // add messages - if($in) - { - foreach($in as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Request'][$pName] = $pType; - } - } else { - $this->messages[$name.'Request']= '0'; - } - if($out) - { - foreach($out as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Response'][$pName] = $pType; - } - } else { - $this->messages[$name.'Response']= '0'; - } - return true; - } -} - -?> diff --git a/lib/nusoap/class.wsdlcache.php b/lib/nusoap/class.wsdlcache.php deleted file mode 100644 index 9824bb31b..000000000 --- a/lib/nusoap/class.wsdlcache.php +++ /dev/null @@ -1,209 +0,0 @@ - -* @author Ingo Fischer -* @version $Id: class.wsdlcache.php,v 1.7 2007/04/17 16:34:03 snichol Exp $ -* @access public -*/ -class nusoap_wsdlcache { - /** - * @var resource - * @access private - */ - var $fplock; - /** - * @var integer - * @access private - */ - var $cache_lifetime; - /** - * @var string - * @access private - */ - var $cache_dir; - /** - * @var string - * @access public - */ - var $debug_str = ''; - - /** - * constructor - * - * @param string $cache_dir directory for cache-files - * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited - * @access public - */ - function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) { - $this->fplock = array(); - $this->cache_dir = $cache_dir != '' ? $cache_dir : '.'; - $this->cache_lifetime = $cache_lifetime; - } - - /** - * creates the filename used to cache a wsdl instance - * - * @param string $wsdl The URL of the wsdl instance - * @return string The filename used to cache the instance - * @access private - */ - function createFilename($wsdl) { - return $this->cache_dir.'/wsdlcache-' . md5($wsdl); - } - - /** - * adds debug data to the class level debug string - * - * @param string $string debug data - * @access private - */ - function debug($string){ - $this->debug_str .= get_class($this).": $string\n"; - } - - /** - * gets a wsdl instance from the cache - * - * @param string $wsdl The URL of the wsdl instance - * @return object wsdl The cached wsdl instance, null if the instance is not in the cache - * @access public - */ - function get($wsdl) { - $filename = $this->createFilename($wsdl); - if ($this->obtainMutex($filename, "r")) { - // check for expired WSDL that must be removed from the cache - if ($this->cache_lifetime > 0) { - if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) { - unlink($filename); - $this->debug("Expired $wsdl ($filename) from cache"); - $this->releaseMutex($filename); - return null; - } - } - // see what there is to return - if (!file_exists($filename)) { - $this->debug("$wsdl ($filename) not in cache (1)"); - $this->releaseMutex($filename); - return null; - } - $fp = @fopen($filename, "r"); - if ($fp) { - $s = implode("", @file($filename)); - fclose($fp); - $this->debug("Got $wsdl ($filename) from cache"); - } else { - $s = null; - $this->debug("$wsdl ($filename) not in cache (2)"); - } - $this->releaseMutex($filename); - return (!is_null($s)) ? unserialize($s) : null; - } else { - $this->debug("Unable to obtain mutex for $filename in get"); - } - return null; - } - - /** - * obtains the local mutex - * - * @param string $filename The Filename of the Cache to lock - * @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode - * @return boolean Lock successfully obtained ?! - * @access private - */ - function obtainMutex($filename, $mode) { - if (isset($this->fplock[md5($filename)])) { - $this->debug("Lock for $filename already exists"); - return false; - } - $this->fplock[md5($filename)] = fopen($filename.".lock", "w"); - if ($mode == "r") { - return flock($this->fplock[md5($filename)], LOCK_SH); - } else { - return flock($this->fplock[md5($filename)], LOCK_EX); - } - } - - /** - * adds a wsdl instance to the cache - * - * @param object wsdl $wsdl_instance The wsdl instance to add - * @return boolean WSDL successfully cached - * @access public - */ - function put($wsdl_instance) { - $filename = $this->createFilename($wsdl_instance->wsdl); - $s = serialize($wsdl_instance); - if ($this->obtainMutex($filename, "w")) { - $fp = fopen($filename, "w"); - if (! $fp) { - $this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache"); - $this->releaseMutex($filename); - return false; - } - fputs($fp, $s); - fclose($fp); - $this->debug("Put $wsdl_instance->wsdl ($filename) in cache"); - $this->releaseMutex($filename); - return true; - } else { - $this->debug("Unable to obtain mutex for $filename in put"); - } - return false; - } - - /** - * releases the local mutex - * - * @param string $filename The Filename of the Cache to lock - * @return boolean Lock successfully released - * @access private - */ - function releaseMutex($filename) { - $ret = flock($this->fplock[md5($filename)], LOCK_UN); - fclose($this->fplock[md5($filename)]); - unset($this->fplock[md5($filename)]); - if (! $ret) { - $this->debug("Not able to release lock for $filename"); - } - return $ret; - } - - /** - * removes a wsdl instance from the cache - * - * @param string $wsdl The URL of the wsdl instance - * @return boolean Whether there was an instance to remove - * @access public - */ - function remove($wsdl) { - $filename = $this->createFilename($wsdl); - if (!file_exists($filename)) { - $this->debug("$wsdl ($filename) not in cache to be removed"); - return false; - } - // ignore errors obtaining mutex - $this->obtainMutex($filename, "w"); - $ret = unlink($filename); - $this->debug("Removed ($ret) $wsdl ($filename) from cache"); - $this->releaseMutex($filename); - return $ret; - } -} - -/** - * For backward compatibility - */ -class wsdlcache extends nusoap_wsdlcache { -} -?> diff --git a/lib/nusoap/class.xmlschema.php b/lib/nusoap/class.xmlschema.php deleted file mode 100644 index 02866bf7e..000000000 --- a/lib/nusoap/class.xmlschema.php +++ /dev/null @@ -1,973 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.xmlschema.php,v 1.53 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_xmlschema extends nusoap_base { - - // files - var $schema = ''; - var $xml = ''; - // namespaces - var $enclosingNamespaces; - // schema info - var $schemaInfo = array(); - var $schemaTargetNamespace = ''; - // types, elements, attributes defined by the schema - var $attributes = array(); - var $complexTypes = array(); - var $complexTypeStack = array(); - var $currentComplexType = null; - var $elements = array(); - var $elementStack = array(); - var $currentElement = null; - var $simpleTypes = array(); - var $simpleTypeStack = array(); - var $currentSimpleType = null; - // imports - var $imports = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - var $message = array(); - var $defaultNamespace = array(); - - /** - * constructor - * - * @param string $schema schema document URI - * @param string $xml xml document URI - * @param string $namespaces namespaces defined in enclosing XML - * @access public - */ - function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){ - parent::nusoap_base(); - $this->debug('nusoap_xmlschema class instantiated, inside constructor'); - // files - $this->schema = $schema; - $this->xml = $xml; - - // namespaces - $this->enclosingNamespaces = $namespaces; - $this->namespaces = array_merge($this->namespaces, $namespaces); - - // parse schema file - if($schema != ''){ - $this->debug('initial schema file: '.$schema); - $this->parseFile($schema, 'schema'); - } - - // parse xml file - if($xml != ''){ - $this->debug('initial xml file: '.$xml); - $this->parseFile($xml, 'xml'); - } - - } - - /** - * parse an XML file - * - * @param string $xml path/URL to XML file - * @param string $type (schema | xml) - * @return boolean - * @access public - */ - function parseFile($xml,$type){ - // parse xml file - if($xml != ""){ - $xmlStr = @join("",@file($xml)); - if($xmlStr == ""){ - $msg = 'Error reading XML from '.$xml; - $this->setError($msg); - $this->debug($msg); - return false; - } else { - $this->debug("parsing $xml"); - $this->parseString($xmlStr,$type); - $this->debug("done parsing $xml"); - return true; - } - } - return false; - } - - /** - * parse an XML string - * - * @param string $xml path or URL - * @param string $type (schema|xml) - * @access private - */ - function parseString($xml,$type){ - // parse xml string - if($xml != ""){ - - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - - // Set the object for the parser. - xml_set_object($this->parser, $this); - - // Set the element handlers for the parser. - if($type == "schema"){ - xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement'); - xml_set_character_data_handler($this->parser,'schemaCharacterData'); - } elseif($type == "xml"){ - xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement'); - xml_set_character_data_handler($this->parser,'xmlCharacterData'); - } - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $errstr = sprintf('XML error parsing XML schema on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $xml); - $this->setError($errstr); - } - - xml_parser_free($this->parser); - } else{ - $this->debug('no xml passed to parseString()!!'); - $this->setError('no xml passed to parseString()!!'); - } - } - - /** - * gets a type name for an unnamed type - * - * @param string Element name - * @return string A type name for an unnamed type - * @access private - */ - function CreateTypeName($ename) { - $scope = ''; - for ($i = 0; $i < count($this->complexTypeStack); $i++) { - $scope .= $this->complexTypeStack[$i] . '_'; - } - return $scope . $ename . '_ContainedType'; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function schemaStartElement($parser, $name, $attrs) { - - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - if ($depth > 0) { - $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]]; - } else { - $this->defaultNamespace[$pos] = false; - } - - // get element prefix - if($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - - // loop thru attributes, expanding, and registering namespace declarations - if(count($attrs) > 0){ - foreach($attrs as $k => $v){ - // if ns declarations, add to class level array of valid namespaces - if(preg_match('/^xmlns/',$k)){ - //$this->xdebug("$k: $v"); - //$this->xdebug('ns_prefix: '.$this->getPrefix($k)); - if($ns_prefix = substr(strrchr($k,':'),1)){ - //$this->xdebug("Add namespace[$ns_prefix] = $v"); - $this->namespaces[$ns_prefix] = $v; - } else { - $this->defaultNamespace[$pos] = $v; - if (! $this->getPrefixFromNamespace($v)) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $v; - } - } - if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){ - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v.'-instance'; - } - } - } - foreach($attrs as $k => $v){ - // expand each attribute - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // find status, register data - switch($name){ - case 'all': // (optional) compositor content for a complexType - case 'choice': - case 'group': - case 'sequence': - //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement"); - $this->complexTypes[$this->currentComplexType]['compositor'] = $name; - //if($name == 'all' || $name == 'sequence'){ - // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - //} - break; - case 'attribute': // complexType attribute - //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']); - $this->xdebug("parsing attribute:"); - $this->appendDebug($this->varDump($attrs)); - if (!isset($attrs['form'])) { - // TODO: handle globals - $attrs['form'] = $this->schemaInfo['attributeFormDefault']; - } - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - if (!strpos($v, ':')) { - // no namespace in arrayType attribute value... - if ($this->defaultNamespace[$pos]) { - // ...so use the default - $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } - } - } - if(isset($attrs['name'])){ - $this->attributes[$attrs['name']] = $attrs; - $aname = $attrs['name']; - } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){ - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $aname = ''; - } - } elseif(isset($attrs['ref'])){ - $aname = $attrs['ref']; - $this->attributes[$attrs['ref']] = $attrs; - } - - if($this->currentComplexType){ // This should *always* be - $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs; - } - // arrayType attribute - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - $prefix = $this->getPrefix($aname); - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){ - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $v = ''; - } - if(strpos($v,'[,]')){ - $this->complexTypes[$this->currentComplexType]['multidimensional'] = true; - } - $v = substr($v,0,strpos($v,'[')); // clip the [] - if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){ - $v = $this->XMLSchemaVersion.':'.$v; - } - $this->complexTypes[$this->currentComplexType]['arrayType'] = $v; - } - break; - case 'complexContent': // (optional) content for a complexType - $this->xdebug("do nothing for element $name"); - break; - case 'complexType': - array_push($this->complexTypeStack, $this->currentComplexType); - if(isset($attrs['name'])){ - // TODO: what is the scope of named complexTypes that appear - // nested within other c complexTypes? - $this->xdebug('processing named complexType '.$attrs['name']); - //$this->currentElement = false; - $this->currentComplexType = $attrs['name']; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } else { - $name = $this->CreateTypeName($this->currentElement); - $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name); - $this->currentComplexType = $name; - //$this->currentElement = false; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false'; - break; - case 'element': - array_push($this->elementStack, $this->currentElement); - if (!isset($attrs['form'])) { - if ($this->currentComplexType) { - $attrs['form'] = $this->schemaInfo['elementFormDefault']; - } else { - // global - $attrs['form'] = 'qualified'; - } - } - if(isset($attrs['type'])){ - $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']); - if (! $this->getPrefix($attrs['type'])) { - if ($this->defaultNamespace[$pos]) { - $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type']; - $this->xdebug('used default namespace to make type ' . $attrs['type']); - } - } - // This is for constructs like - // - // - // - // - // - if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') { - $this->xdebug('arrayType for unusual array is ' . $attrs['type']); - $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type']; - } - $this->currentElement = $attrs['name']; - $ename = $attrs['name']; - } elseif(isset($attrs['ref'])){ - $this->xdebug("processing element as ref to ".$attrs['ref']); - $this->currentElement = "ref to ".$attrs['ref']; - $ename = $this->getLocalPart($attrs['ref']); - } else { - $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']); - $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type); - $this->currentElement = $attrs['name']; - $attrs['type'] = $this->schemaTargetNamespace . ':' . $type; - $ename = $attrs['name']; - } - if (isset($ename) && $this->currentComplexType) { - $this->xdebug("add element $ename to complexType $this->currentComplexType"); - $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs; - } elseif (!isset($attrs['ref'])) { - $this->xdebug("add element $ename to elements array"); - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - } - break; - case 'enumeration': // restriction value list member - $this->xdebug('enumeration ' . $attrs['value']); - if ($this->currentSimpleType) { - $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value']; - } elseif ($this->currentComplexType) { - $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value']; - } - break; - case 'extension': // simpleContent or complexContent type extension - $this->xdebug('extension ' . $attrs['base']); - if ($this->currentComplexType) { - $ns = $this->getPrefix($attrs['base']); - if ($ns == '') { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base']; - } else { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base']; - } - } else { - $this->xdebug('no current complexType to set extensionBase'); - } - break; - case 'import': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']); - $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('import namespace ' . $attrs['namespace']); - $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - } - break; - case 'include': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']); - $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute'); - } - break; - case 'list': // simpleType value list - $this->xdebug("do nothing for element $name"); - break; - case 'restriction': // simpleType, simpleContent or complexContent value restriction - $this->xdebug('restriction ' . $attrs['base']); - if($this->currentSimpleType){ - $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base']; - } elseif($this->currentComplexType){ - $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base']; - if(strstr($attrs['base'],':') == ':Array'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } - } - break; - case 'schema': - $this->schemaInfo = $attrs; - $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix); - if (isset($attrs['targetNamespace'])) { - $this->schemaTargetNamespace = $attrs['targetNamespace']; - } - if (!isset($attrs['elementFormDefault'])) { - $this->schemaInfo['elementFormDefault'] = 'unqualified'; - } - if (!isset($attrs['attributeFormDefault'])) { - $this->schemaInfo['attributeFormDefault'] = 'unqualified'; - } - break; - case 'simpleContent': // (optional) content for a complexType - if ($this->currentComplexType) { // This should *always* be - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true'; - } else { - $this->xdebug("do nothing for element $name because there is no current complexType"); - } - break; - case 'simpleType': - array_push($this->simpleTypeStack, $this->currentSimpleType); - if(isset($attrs['name'])){ - $this->xdebug("processing simpleType for name " . $attrs['name']); - $this->currentSimpleType = $attrs['name']; - $this->simpleTypes[ $attrs['name'] ] = $attrs; - $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType'; - $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar'; - } else { - $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement); - $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name); - $this->currentSimpleType = $name; - //$this->currentElement = false; - $this->simpleTypes[$this->currentSimpleType] = $attrs; - $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar'; - } - break; - case 'union': // simpleType type list - $this->xdebug("do nothing for element $name"); - break; - default: - $this->xdebug("do not have any logic to process element $name"); - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function schemaEndElement($parser, $name) { - // bring depth down a notch - $this->depth--; - // position of current element is equal to the last value left in depth_array for my depth - if(isset($this->depth_array[$this->depth])){ - $pos = $this->depth_array[$this->depth]; - } - // get element prefix - if ($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - // move on... - if($name == 'complexType'){ - $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)')); - $this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType])); - $this->currentComplexType = array_pop($this->complexTypeStack); - //$this->currentElement = false; - } - if($name == 'element'){ - $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)')); - $this->currentElement = array_pop($this->elementStack); - } - if($name == 'simpleType'){ - $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)')); - $this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType])); - $this->currentSimpleType = array_pop($this->simpleTypeStack); - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function schemaCharacterData($parser, $data){ - $pos = $this->depth_array[$this->depth - 1]; - $this->message[$pos]['cdata'] .= $data; - } - - /** - * serialize the schema - * - * @access public - */ - function serializeSchema(){ - - $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion); - $xml = ''; - // imports - if (sizeof($this->imports) > 0) { - foreach($this->imports as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n"; - } else { - $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n"; - } - } - } - } - // complex types - foreach($this->complexTypes as $typeName => $attrs){ - $contentStr = ''; - // serialize child elements - if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){ - foreach($attrs['elements'] as $element => $eParts){ - if(isset($eParts['ref'])){ - $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n"; - } else { - $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\""; - foreach ($eParts as $aName => $aValue) { - // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable - if ($aName != 'name' && $aName != 'type') { - $contentStr .= " $aName=\"$aValue\""; - } - } - $contentStr .= "/>\n"; - } - } - // compositor wraps elements - if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) { - $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." \n"; - } - } - // attributes - if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){ - foreach($attrs['attrs'] as $attr => $aParts){ - $contentStr .= " <$schemaPrefix:attribute"; - foreach ($aParts as $a => $v) { - if ($a == 'ref' || $a == 'type') { - $contentStr .= " $a=\"".$this->contractQName($v).'"'; - } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') { - $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl']; - $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"'; - } else { - $contentStr .= " $a=\"$v\""; - } - } - $contentStr .= "/>\n"; - } - } - // if restriction - if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){ - $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." \n"; - // complex or simple content - if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){ - $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." \n"; - } - } - // finalize complex type - if($contentStr != ''){ - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." \n"; - } else { - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n"; - } - $xml .= $contentStr; - } - // simple types - if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){ - foreach($this->simpleTypes as $typeName => $eParts){ - $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n"; - if (isset($eParts['enumeration'])) { - foreach ($eParts['enumeration'] as $e) { - $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n"; - } - } - $xml .= " \n "; - } - } - // elements - if(isset($this->elements) && count($this->elements) > 0){ - foreach($this->elements as $element => $eParts){ - $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n"; - } - } - // attributes - if(isset($this->attributes) && count($this->attributes) > 0){ - foreach($this->attributes as $attr => $aParts){ - $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>"; - } - } - // finish 'er up - $attr = ''; - foreach ($this->schemaInfo as $k => $v) { - if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') { - $attr .= " $k=\"$v\""; - } - } - $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n"; - foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) { - $el .= " xmlns:$nsp=\"$ns\""; - } - $xml = $el . ">\n".$xml."\n"; - return $xml; - } - - /** - * adds debug data to the clas level debug string - * - * @param string $string debug data - * @access private - */ - function xdebug($string){ - $this->debug('<' . $this->schemaTargetNamespace . '> '.$string); - } - - /** - * get the PHP type of a user defined type in the schema - * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays - * returns false if no type exists, or not w/ the given namespace - * else returns a string that is either a native php type, or 'struct' - * - * @param string $type name of defined type - * @param string $ns namespace of type - * @return mixed - * @access public - * @deprecated - */ - function getPHPType($type,$ns){ - if(isset($this->typemap[$ns][$type])){ - //print "found type '$type' and ns $ns in typemap
    "; - return $this->typemap[$ns][$type]; - } elseif(isset($this->complexTypes[$type])){ - //print "getting type '$type' and ns $ns from complexTypes array
    "; - return $this->complexTypes[$type]['phpType']; - } - return false; - } - - /** - * returns an associative array of information about a given type - * returns false if no type exists by the given name - * - * For a complexType typeDef = array( - * 'restrictionBase' => '', - * 'phpType' => '', - * 'compositor' => '(sequence|all)', - * 'elements' => array(), // refs to elements array - * 'attrs' => array() // refs to attributes array - * ... and so on (see addComplexType) - * ) - * - * For simpleType or element, the array has different keys. - * - * @param string $type - * @return mixed - * @access public - * @see addComplexType - * @see addSimpleType - * @see addElement - */ - function getTypeDef($type){ - //$this->debug("in getTypeDef for type $type"); - if (substr($type, -1) == '^') { - $is_element = 1; - $type = substr($type, 0, -1); - } else { - $is_element = 0; - } - - if((! $is_element) && isset($this->complexTypes[$type])){ - $this->xdebug("in getTypeDef, found complexType $type"); - return $this->complexTypes[$type]; - } elseif((! $is_element) && isset($this->simpleTypes[$type])){ - $this->xdebug("in getTypeDef, found simpleType $type"); - if (!isset($this->simpleTypes[$type]['phpType'])) { - // get info for type to tack onto the simple type - // TODO: can this ever really apply (i.e. what is a simpleType really?) - $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1); - $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for simpleType $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->simpleTypes[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->simpleTypes[$type]['elements'] = $etype['elements']; - } - } - } - return $this->simpleTypes[$type]; - } elseif(isset($this->elements[$type])){ - $this->xdebug("in getTypeDef, found element $type"); - if (!isset($this->elements[$type]['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1); - $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for element $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->elements[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->elements[$type]['elements'] = $etype['elements']; - } - if (isset($etype['extensionBase'])) { - $this->elements[$type]['extensionBase'] = $etype['extensionBase']; - } - } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') { - $this->xdebug("in getTypeDef, element $type is an XSD type"); - $this->elements[$type]['phpType'] = 'scalar'; - } - } - return $this->elements[$type]; - } elseif(isset($this->attributes[$type])){ - $this->xdebug("in getTypeDef, found attribute $type"); - return $this->attributes[$type]; - } elseif (preg_match('/_ContainedType$/', $type)) { - $this->xdebug("in getTypeDef, have an untyped element $type"); - $typeDef['typeClass'] = 'simpleType'; - $typeDef['phpType'] = 'scalar'; - $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string'; - return $typeDef; - } - $this->xdebug("in getTypeDef, did not find $type"); - return false; - } - - /** - * returns a sample serialization of a given type, or false if no type by the given name - * - * @param string $type name of type - * @return mixed - * @access public - * @deprecated - */ - function serializeTypeDef($type){ - //print "in sTD() for type $type
    "; - if($typeDef = $this->getTypeDef($type)){ - $str .= '<'.$type; - if(is_array($typeDef['attrs'])){ - foreach($typeDef['attrs'] as $attName => $data){ - $str .= " $attName=\"{type = ".$data['type']."}\""; - } - } - $str .= " xmlns=\"".$this->schema['targetNamespace']."\""; - if(count($typeDef['elements']) > 0){ - $str .= ">"; - foreach($typeDef['elements'] as $element => $eData){ - $str .= $this->serializeTypeDef($element); - } - $str .= ""; - } elseif($typeDef['typeClass'] == 'element') { - $str .= ">"; - } else { - $str .= "/>"; - } - return $str; - } - return false; - } - - /** - * returns HTML form elements that allow a user - * to enter values for creating an instance of the given type. - * - * @param string $name name for type instance - * @param string $type name of type - * @return string - * @access public - * @deprecated - */ - function typeToForm($name,$type){ - // get typedef - if($typeDef = $this->getTypeDef($type)){ - // if struct - if($typeDef['phpType'] == 'struct'){ - $buffer .= ''; - foreach($typeDef['elements'] as $child => $childDef){ - $buffer .= " - - "; - } - $buffer .= '
    $childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):
    '; - // if array - } elseif($typeDef['phpType'] == 'array'){ - $buffer .= ''; - for($i=0;$i < 3; $i++){ - $buffer .= " - - "; - } - $buffer .= '
    array item (type: $typeDef[arrayType]):
    '; - // if scalar - } else { - $buffer .= ""; - } - } else { - $buffer .= ""; - } - return $buffer; - } - - /** - * adds a complex type to the schema - * - * example: array - * - * addType( - * 'ArrayOfstring', - * 'complexType', - * 'array', - * '', - * 'SOAP-ENC:Array', - * array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), - * 'xsd:string' - * ); - * - * example: PHP associative array ( SOAP Struct ) - * - * addType( - * 'SOAPStruct', - * 'complexType', - * 'struct', - * 'all', - * array('myVar'=> array('name'=>'myVar','type'=>'string') - * ); - * - * @param name - * @param typeClass (complexType|simpleType|attribute) - * @param phpType: currently supported are array and struct (php assoc array) - * @param compositor (all|sequence|choice) - * @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param elements = array ( name = array(name=>'',type=>'') ) - * @param attrs = array( - * array( - * 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", - * "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" - * ) - * ) - * @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string) - * @access public - * @see getTypeDef - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){ - $this->complexTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'compositor'=> $compositor, - 'restrictionBase' => $restrictionBase, - 'elements' => $elements, - 'attrs' => $attrs, - 'arrayType' => $arrayType - ); - - $this->xdebug("addComplexType $name:"); - $this->appendDebug($this->varDump($this->complexTypes[$name])); - } - - /** - * adds a simple type to the schema - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @access public - * @see nusoap_xmlschema - * @see getTypeDef - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $this->simpleTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'type' => $restrictionBase, - 'enumeration' => $enumeration - ); - - $this->xdebug("addSimpleType $name:"); - $this->appendDebug($this->varDump($this->simpleTypes[$name])); - } - - /** - * adds an element to the schema - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - if (! $this->getPrefix($attrs['type'])) { - $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type']; - } - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - - $this->xdebug("addElement " . $attrs['name']); - $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ])); - } -} - -/** - * Backward compatibility - */ -class XMLSchema extends nusoap_xmlschema { -} - - -?> \ No newline at end of file diff --git a/lib/nusoap/docs/docs/CVS/Entries b/lib/nusoap/docs/docs/CVS/Entries deleted file mode 100644 index e98cfd699..000000000 --- a/lib/nusoap/docs/docs/CVS/Entries +++ /dev/null @@ -1,11 +0,0 @@ -D/__filesource//// -D/media//// -D/nusoap//// -/blank.html/1.1/Mon Apr 26 19:16:48 2010// -/packages.html/1.1/Mon Apr 26 19:16:48 2010// -/classtrees_nusoap.html/1.2/Mon Apr 26 19:16:48 2010// -/elementindex.html/1.2/Mon Apr 26 19:16:48 2010// -/elementindex_nusoap.html/1.2/Mon Apr 26 19:16:48 2010// -/errors.html/1.2/Mon Apr 26 19:17:11 2010// -/index.html/1.2/Mon Apr 26 19:16:48 2010// -/li_nusoap.html/1.2/Mon Apr 26 19:16:48 2010// diff --git a/lib/nusoap/docs/docs/CVS/Repository b/lib/nusoap/docs/docs/CVS/Repository deleted file mode 100644 index d8f8d4692..000000000 --- a/lib/nusoap/docs/docs/CVS/Repository +++ /dev/null @@ -1 +0,0 @@ -docs diff --git a/lib/nusoap/docs/docs/CVS/Root b/lib/nusoap/docs/docs/CVS/Root deleted file mode 100644 index 38e068369..000000000 --- a/lib/nusoap/docs/docs/CVS/Root +++ /dev/null @@ -1 +0,0 @@ -:ext:snichol@nusoap.cvs.sourceforge.net:/cvsroot/nusoap diff --git a/lib/nusoap/docs/docs/__filesource/CVS/Entries b/lib/nusoap/docs/docs/__filesource/CVS/Entries deleted file mode 100644 index 26d14b617..000000000 --- a/lib/nusoap/docs/docs/__filesource/CVS/Entries +++ /dev/null @@ -1,4 +0,0 @@ -/fsource_nusoap__class.wsdlcache.php.html/1.2/Mon Apr 26 19:25:21 2010// -/fsource_nusoap__nusoap.php.html/1.2/Mon Apr 26 19:25:21 2010// -/fsource_nusoap__nusoapmime.php.html/1.2/Mon Apr 26 19:25:21 2010// -D diff --git a/lib/nusoap/docs/docs/__filesource/CVS/Repository b/lib/nusoap/docs/docs/__filesource/CVS/Repository deleted file mode 100644 index 4c9a42891..000000000 --- a/lib/nusoap/docs/docs/__filesource/CVS/Repository +++ /dev/null @@ -1 +0,0 @@ -docs/__filesource diff --git a/lib/nusoap/docs/docs/__filesource/CVS/Root b/lib/nusoap/docs/docs/__filesource/CVS/Root deleted file mode 100644 index 38e068369..000000000 --- a/lib/nusoap/docs/docs/__filesource/CVS/Root +++ /dev/null @@ -1 +0,0 @@ -:ext:snichol@nusoap.cvs.sourceforge.net:/cvsroot/nusoap diff --git a/lib/nusoap/docs/docs/__filesource/fsource_nusoap__class.wsdlcache.php.html b/lib/nusoap/docs/docs/__filesource/fsource_nusoap__class.wsdlcache.php.html deleted file mode 100644 index e7a0ce42c..000000000 --- a/lib/nusoap/docs/docs/__filesource/fsource_nusoap__class.wsdlcache.php.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - File Source for class.wsdlcache.php - - - - -

    Source for file class.wsdlcache.php

    -

    Documentation is available at class.wsdlcache.php

    -
    -
    1. <?php
    2. -
    3. /*
    4. -
    5. The NuSOAP project home is:
    6. -
    7. http://sourceforge.net/projects/nusoap/
    8. -
    9.  
    10. -
    11. The primary support for NuSOAP is the mailing list:
    12. -
    13. nusoap-general@lists.sourceforge.net
    14. -
    15. */
    16. -
    17.  
    18. -
    19. /**
    20. -
    21. * caches instances of the wsdl class
    22. -
    23. *
    24. -
    25. * @author Scott Nichol <snichol@users.sourceforge.net>
    26. -
    27. * @author Ingo Fischer <ingo@apollon.de>
    28. -
    29. * @version $Id: fsource_nusoap__class.wsdlcache.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    30. -
    31. * @access public
    32. -
    33. */
    34. -
    35. class nusoap_wsdlcache {
    36. -
    37. /**
    38. -
    39. * @var resource
    40. -
    41. * @access private
    42. -
    43. */
    44. -
    45. var $fplock;
    46. -
    47. /**
    48. -
    49. * @var integer
    50. -
    51. * @access private
    52. -
    53. */
    54. -
    55. var $cache_lifetime;
    56. -
    57. /**
    58. -
    59. * @var string
    60. -
    61. * @access private
    62. -
    63. */
    64. -
    65. var $cache_dir;
    66. -
    67. /**
    68. -
    69. * @var string
    70. -
    71. * @access public
    72. -
    73. */
    74. -
    75. var $debug_str = '';
    76. -
    77.  
    78. -
    79. /**
    80. -
    81. * constructor
    82. -
    83. *
    84. -
    85. * @param string $cache_dir directory for cache-files
    86. -
    87. * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
    88. -
    89. * @access public
    90. -
    91. */
    92. -
    93. function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) {
    94. -
    95. $this->fplock = array();
    96. -
    97. $this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
    98. -
    99. $this->cache_lifetime = $cache_lifetime;
    100. -
    101. }
    102. -
    103.  
    104. -
    105. /**
    106. -
    107. * creates the filename used to cache a wsdl instance
    108. -
    109. *
    110. -
    111. * @param string $wsdl The URL of the wsdl instance
    112. -
    113. * @return string The filename used to cache the instance
    114. -
    115. * @access private
    116. -
    117. */
    118. -
    119. function createFilename($wsdl) {
    120. -
    121. return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
    122. -
    123. }
    124. -
    125.  
    126. -
    127. /**
    128. -
    129. * adds debug data to the class level debug string
    130. -
    131. *
    132. -
    133. * @param string $string debug data
    134. -
    135. * @access private
    136. -
    137. */
    138. -
    139. function debug($string){
    140. -
    141. $this->debug_str .= get_class($this).": $string\n";
    142. -
    143. }
    144. -
    145.  
    146. -
    147. /**
    148. -
    149. * gets a wsdl instance from the cache
    150. -
    151. *
    152. -
    153. * @param string $wsdl The URL of the wsdl instance
    154. -
    155. * @return object wsdl The cached wsdl instance, null if the instance is not in the cache
    156. -
    157. * @access public
    158. -
    159. */
    160. -
    161. function get($wsdl) {
    162. -
    163. $filename = $this->createFilename($wsdl);
    164. -
    165. if ($this->obtainMutex($filename, "r")) {
    166. -
    167. // check for expired WSDL that must be removed from the cache
    168. -
    169. if ($this->cache_lifetime > 0) {
    170. -
    171. if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
    172. -
    173. unlink($filename);
    174. -
    175. $this->debug("Expired $wsdl ($filename) from cache");
    176. -
    177. $this->releaseMutex($filename);
    178. -
    179. return null;
    180. -
    181. }
    182. -
    183. }
    184. -
    185. // see what there is to return
    186. -
    187. if (!file_exists($filename)) {
    188. -
    189. $this->debug("$wsdl ($filename) not in cache (1)");
    190. -
    191. $this->releaseMutex($filename);
    192. -
    193. return null;
    194. -
    195. }
    196. -
    197. $fp = @fopen($filename, "r");
    198. -
    199. if ($fp) {
    200. -
    201. $s = implode("", @file($filename));
    202. -
    203. fclose($fp);
    204. -
    205. $this->debug("Got $wsdl ($filename) from cache");
    206. -
    207. } else {
    208. -
    209. $s = null;
    210. -
    211. $this->debug("$wsdl ($filename) not in cache (2)");
    212. -
    213. }
    214. -
    215. $this->releaseMutex($filename);
    216. -
    217. return (!is_null($s)) ? unserialize($s) : null;
    218. -
    219. } else {
    220. -
    221. $this->debug("Unable to obtain mutex for $filename in get");
    222. -
    223. }
    224. -
    225. return null;
    226. -
    227. }
    228. -
    229.  
    230. -
    231. /**
    232. -
    233. * obtains the local mutex
    234. -
    235. *
    236. -
    237. * @param string $filename The Filename of the Cache to lock
    238. -
    239. * @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode
    240. -
    241. * @return boolean Lock successfully obtained ?!
    242. -
    243. * @access private
    244. -
    245. */
    246. -
    247. function obtainMutex($filename, $mode) {
    248. -
    249. if (isset($this->fplock[md5($filename)])) {
    250. -
    251. $this->debug("Lock for $filename already exists");
    252. -
    253. return false;
    254. -
    255. }
    256. -
    257. $this->fplock[md5($filename)] = fopen($filename.".lock", "w");
    258. -
    259. if ($mode == "r") {
    260. -
    261. return flock($this->fplock[md5($filename)], LOCK_SH);
    262. -
    263. } else {
    264. -
    265. return flock($this->fplock[md5($filename)], LOCK_EX);
    266. -
    267. }
    268. -
    269. }
    270. -
    271.  
    272. -
    273. /**
    274. -
    275. * adds a wsdl instance to the cache
    276. -
    277. *
    278. -
    279. * @param object wsdl $wsdl_instance The wsdl instance to add
    280. -
    281. * @return boolean WSDL successfully cached
    282. -
    283. * @access public
    284. -
    285. */
    286. -
    287. function put($wsdl_instance) {
    288. -
    289. $filename = $this->createFilename($wsdl_instance->wsdl);
    290. -
    291. $s = serialize($wsdl_instance);
    292. -
    293. if ($this->obtainMutex($filename, "w")) {
    294. -
    295. $fp = fopen($filename, "w");
    296. -
    297. if (! $fp) {
    298. -
    299. $this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
    300. -
    301. $this->releaseMutex($filename);
    302. -
    303. return false;
    304. -
    305. }
    306. -
    307. fputs($fp, $s);
    308. -
    309. fclose($fp);
    310. -
    311. $this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
    312. -
    313. $this->releaseMutex($filename);
    314. -
    315. return true;
    316. -
    317. } else {
    318. -
    319. $this->debug("Unable to obtain mutex for $filename in put");
    320. -
    321. }
    322. -
    323. return false;
    324. -
    325. }
    326. -
    327.  
    328. -
    329. /**
    330. -
    331. * releases the local mutex
    332. -
    333. *
    334. -
    335. * @param string $filename The Filename of the Cache to lock
    336. -
    337. * @return boolean Lock successfully released
    338. -
    339. * @access private
    340. -
    341. */
    342. -
    343. function releaseMutex($filename) {
    344. -
    345. $ret = flock($this->fplock[md5($filename)], LOCK_UN);
    346. -
    347. fclose($this->fplock[md5($filename)]);
    348. -
    349. unset($this->fplock[md5($filename)]);
    350. -
    351. if (! $ret) {
    352. -
    353. $this->debug("Not able to release lock for $filename");
    354. -
    355. }
    356. -
    357. return $ret;
    358. -
    359. }
    360. -
    361.  
    362. -
    363. /**
    364. -
    365. * removes a wsdl instance from the cache
    366. -
    367. *
    368. -
    369. * @param string $wsdl The URL of the wsdl instance
    370. -
    371. * @return boolean Whether there was an instance to remove
    372. -
    373. * @access public
    374. -
    375. */
    376. -
    377. function remove($wsdl) {
    378. -
    379. $filename = $this->createFilename($wsdl);
    380. -
    381. if (!file_exists($filename)) {
    382. -
    383. $this->debug("$wsdl ($filename) not in cache to be removed");
    384. -
    385. return false;
    386. -
    387. }
    388. -
    389. // ignore errors obtaining mutex
    390. -
    391. $this->obtainMutex($filename, "w");
    392. -
    393. $ret = unlink($filename);
    394. -
    395. $this->debug("Removed ($ret) $wsdl ($filename) from cache");
    396. -
    397. $this->releaseMutex($filename);
    398. -
    399. return $ret;
    400. -
    401. }
    402. -
    403. }
    404. -
    405.  
    406. -
    407. /**
    408. -
    409. * For backward compatibility
    410. -
    411. */
    412. -
    413. class wsdlcache extends nusoap_wsdlcache {
    414. -
    415. }
    416. -
    417. ?>
    418. -
    -
    -

    - Documentation generated on Mon, 26 Apr 2010 16:16:49 -0400 by phpDocumentor 1.3.0RC3 -

    - - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/__filesource/fsource_nusoap__nusoap.php.html b/lib/nusoap/docs/docs/__filesource/fsource_nusoap__nusoap.php.html deleted file mode 100644 index 977b89f27..000000000 --- a/lib/nusoap/docs/docs/__filesource/fsource_nusoap__nusoap.php.html +++ /dev/null @@ -1,8228 +0,0 @@ - - - - - - File Source for nusoap.php - - - - -

    Source for file nusoap.php

    -

    Documentation is available at nusoap.php

    -
    -
    1. <?php
    2. -
    3.  
    4. -
    5. /*
    6. -
    7. $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    8. -
    9.  
    10. -
    11. NuSOAP - Web Services Toolkit for PHP
    12. -
    13.  
    14. -
    15. Copyright (c) 2002 NuSphere Corporation
    16. -
    17.  
    18. -
    19. This library is free software; you can redistribute it and/or
    20. -
    21. modify it under the terms of the GNU Lesser General Public
    22. -
    23. License as published by the Free Software Foundation; either
    24. -
    25. version 2.1 of the License, or (at your option) any later version.
    26. -
    27.  
    28. -
    29. This library is distributed in the hope that it will be useful,
    30. -
    31. but WITHOUT ANY WARRANTY; without even the implied warranty of
    32. -
    33. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    34. -
    35. Lesser General Public License for more details.
    36. -
    37.  
    38. -
    39. You should have received a copy of the GNU Lesser General Public
    40. -
    41. License along with this library; if not, write to the Free Software
    42. -
    43. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    44. -
    45.  
    46. -
    47. The NuSOAP project home is:
    48. -
    49. http://sourceforge.net/projects/nusoap/
    50. -
    51.  
    52. -
    53. The primary support for NuSOAP is the Help forum on the project home page.
    54. -
    55.  
    56. -
    57. If you have any questions or comments, please email:
    58. -
    59.  
    60. -
    61. Dietrich Ayala
    62. -
    63. dietrich@ganx4.com
    64. -
    65. http://dietrich.ganx4.com/nusoap
    66. -
    67.  
    68. -
    69. NuSphere Corporation
    70. -
    71. http://www.nusphere.com
    72. -
    73.  
    74. -
    75. */
    76. -
    77.  
    78. -
    79. /*
    80. -
    81. * Some of the standards implmented in whole or part by NuSOAP:
    82. -
    83. *
    84. -
    85. * SOAP 1.1 (http://www.w3.org/TR/2000/NOTE-SOAP-20000508/)
    86. -
    87. * WSDL 1.1 (http://www.w3.org/TR/2001/NOTE-wsdl-20010315)
    88. -
    89. * SOAP Messages With Attachments (http://www.w3.org/TR/SOAP-attachments)
    90. -
    91. * XML 1.0 (http://www.w3.org/TR/2006/REC-xml-20060816/)
    92. -
    93. * Namespaces in XML 1.0 (http://www.w3.org/TR/2006/REC-xml-names-20060816/)
    94. -
    95. * XML Schema 1.0 (http://www.w3.org/TR/xmlschema-0/)
    96. -
    97. * RFC 2045 Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies
    98. -
    99. * RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1
    100. -
    101. * RFC 2617 HTTP Authentication: Basic and Digest Access Authentication
    102. -
    103. */
    104. -
    105.  
    106. -
    107. /* load classes
    108. -
    109. // necessary classes
    110. -
    111. require_once('class.soapclient.php');
    112. -
    113. require_once('class.soap_val.php');
    114. -
    115. require_once('class.soap_parser.php');
    116. -
    117. require_once('class.soap_fault.php');
    118. -
    119.  
    120. -
    121. // transport classes
    122. -
    123. require_once('class.soap_transport_http.php');
    124. -
    125.  
    126. -
    127. // optional add-on classes
    128. -
    129. require_once('class.xmlschema.php');
    130. -
    131. require_once('class.wsdl.php');
    132. -
    133.  
    134. -
    135. // server class
    136. -
    137. require_once('class.soap_server.php');*/
    138. -
    139.  
    140. -
    141. // class variable emulation
    142. -
    143. // cf. http://www.webkreator.com/php/techniques/php-static-class-variables.html
    144. -
    145.  
    146. -
    147. $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = 9;
    148. -
    149.  
    150. -
    151. /**
    152. -
    153. *
    154. -
    155. * nusoap_base
    156. -
    157. *
    158. -
    159. * @author Dietrich Ayala <dietrich@ganx4.com>
    160. -
    161. * @author Scott Nichol <snichol@users.sourceforge.net>
    162. -
    163. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    164. -
    165. * @access public
    166. -
    167. */
    168. -
    169. class nusoap_base {
    170. -
    171. /**
    172. -
    173. * Identification for HTTP headers.
    174. -
    175. *
    176. -
    177. * @var string
    178. -
    179. * @access private
    180. -
    181. */
    182. -
    183. var $title = 'NuSOAP';
    184. -
    185. /**
    186. -
    187. * Version for HTTP headers.
    188. -
    189. *
    190. -
    191. * @var string
    192. -
    193. * @access private
    194. -
    195. */
    196. -
    197. var $version = '0.9.5';
    198. -
    199. /**
    200. -
    201. * CVS revision for HTTP headers.
    202. -
    203. *
    204. -
    205. * @var string
    206. -
    207. * @access private
    208. -
    209. */
    210. -
    211. var $revision = '$Revision: 1.2 $';
    212. -
    213. /**
    214. -
    215. * Current error string (manipulated by getError/setError)
    216. -
    217. *
    218. -
    219. * @var string
    220. -
    221. * @access private
    222. -
    223. */
    224. -
    225. var $error_str = '';
    226. -
    227. /**
    228. -
    229. * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
    230. -
    231. *
    232. -
    233. * @var string
    234. -
    235. * @access private
    236. -
    237. */
    238. -
    239. var $debug_str = '';
    240. -
    241. /**
    242. -
    243. * toggles automatic encoding of special characters as entities
    244. -
    245. * (should always be true, I think)
    246. -
    247. *
    248. -
    249. * @var boolean
    250. -
    251. * @access private
    252. -
    253. */
    254. -
    255. var $charencoding = true;
    256. -
    257. /**
    258. -
    259. * the debug level for this instance
    260. -
    261. *
    262. -
    263. * @var integer
    264. -
    265. * @access private
    266. -
    267. */
    268. -
    269. var $debugLevel;
    270. -
    271.  
    272. -
    273. /**
    274. -
    275. * set schema version
    276. -
    277. *
    278. -
    279. * @var string
    280. -
    281. * @access public
    282. -
    283. */
    284. -
    285. var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema';
    286. -
    287. -
    288. /**
    289. -
    290. * charset encoding for outgoing messages
    291. -
    292. *
    293. -
    294. * @var string
    295. -
    296. * @access public
    297. -
    298. */
    299. -
    300. var $soap_defencoding = 'ISO-8859-1';
    301. -
    302. //var $soap_defencoding = 'UTF-8';
    303. -
    304.  
    305. -
    306. -
    307.  
    308. -
    309. /**
    310. -
    311. * namespaces in an array of prefix => uri
    312. -
    313. *
    314. -
    315. * this is "seeded" by a set of constants, but it may be altered by code
    316. -
    317. *
    318. -
    319. * @var array
    320. -
    321. * @access public
    322. -
    323. */
    324. -
    325. var $namespaces = array(
    326. -
    327. 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
    328. -
    329. 'xsd' => 'http://www.w3.org/2001/XMLSchema',
    330. -
    331. 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
    332. -
    333. 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
    334. -
    335. );
    336. -
    337.  
    338. -
    339. /**
    340. -
    341. * namespaces used in the current context, e.g. during serialization
    342. -
    343. *
    344. -
    345. * @var array
    346. -
    347. * @access private
    348. -
    349. */
    350. -
    351. var $usedNamespaces = array();
    352. -
    353.  
    354. -
    355. /**
    356. -
    357. * XML Schema types in an array of uri => (array of xml type => php type)
    358. -
    359. * is this legacy yet?
    360. -
    361. * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings.
    362. -
    363. * @var array
    364. -
    365. * @access public
    366. -
    367. */
    368. -
    369. var $typemap = array(
    370. -
    371. 'http://www.w3.org/2001/XMLSchema' => array(
    372. -
    373. 'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
    374. -
    375. 'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
    376. -
    377. 'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
    378. -
    379. // abstract "any" types
    380. -
    381. -
    382. 'anyType'=>'string','anySimpleType'=>'string',
    383. -
    384. // derived datatypes
    385. -
    386. -
    387. 'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
    388. -
    389. 'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
    390. -
    391. 'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
    392. -
    393. 'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),
    394. -
    395. 'http://www.w3.org/2000/10/XMLSchema' => array(
    396. -
    397. 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
    398. -
    399. 'float'=>'double','dateTime'=>'string',
    400. -
    401. 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
    402. -
    403. 'http://www.w3.org/1999/XMLSchema' => array(
    404. -
    405. 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
    406. -
    407. 'float'=>'double','dateTime'=>'string',
    408. -
    409. 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
    410. -
    411. 'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
    412. -
    413. 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
    414. -
    415. 'http://xml.apache.org/xml-soap' => array('Map')
    416. -
    417. );
    418. -
    419.  
    420. -
    421. /**
    422. -
    423. * XML entities to convert
    424. -
    425. *
    426. -
    427. * @var array
    428. -
    429. * @access public
    430. -
    431. * @deprecated
    432. -
    433. * @see expandEntities
    434. -
    435. */
    436. -
    437. var $xmlEntities = array('quot' => '"','amp' => '&',
    438. -
    439. 'lt' => '<','gt' => '>','apos' => "'");
    440. -
    441.  
    442. -
    443. /**
    444. -
    445. * constructor
    446. -
    447. *
    448. -
    449. * @access public
    450. -
    451. */
    452. -
    453. function nusoap_base() {
    454. -
    455. $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
    456. -
    457. }
    458. -
    459.  
    460. -
    461. /**
    462. -
    463. * gets the global debug level, which applies to future instances
    464. -
    465. *
    466. -
    467. * @return integer Debug level 0-9, where 0 turns off
    468. -
    469. * @access public
    470. -
    471. */
    472. -
    473. function getGlobalDebugLevel() {
    474. -
    475. return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
    476. -
    477. }
    478. -
    479.  
    480. -
    481. /**
    482. -
    483. * sets the global debug level, which applies to future instances
    484. -
    485. *
    486. -
    487. * @param int $level Debug level 0-9, where 0 turns off
    488. -
    489. * @access public
    490. -
    491. */
    492. -
    493. function setGlobalDebugLevel($level) {
    494. -
    495. $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level;
    496. -
    497. }
    498. -
    499.  
    500. -
    501. /**
    502. -
    503. * gets the debug level for this instance
    504. -
    505. *
    506. -
    507. * @return int Debug level 0-9, where 0 turns off
    508. -
    509. * @access public
    510. -
    511. */
    512. -
    513. function getDebugLevel() {
    514. -
    515. return $this->debugLevel;
    516. -
    517. }
    518. -
    519.  
    520. -
    521. /**
    522. -
    523. * sets the debug level for this instance
    524. -
    525. *
    526. -
    527. * @param int $level Debug level 0-9, where 0 turns off
    528. -
    529. * @access public
    530. -
    531. */
    532. -
    533. function setDebugLevel($level) {
    534. -
    535. $this->debugLevel = $level;
    536. -
    537. }
    538. -
    539.  
    540. -
    541. /**
    542. -
    543. * adds debug data to the instance debug string with formatting
    544. -
    545. *
    546. -
    547. * @param string $string debug data
    548. -
    549. * @access private
    550. -
    551. */
    552. -
    553. function debug($string){
    554. -
    555. if ($this->debugLevel > 0) {
    556. -
    557. $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
    558. -
    559. }
    560. -
    561. }
    562. -
    563.  
    564. -
    565. /**
    566. -
    567. * adds debug data to the instance debug string without formatting
    568. -
    569. *
    570. -
    571. * @param string $string debug data
    572. -
    573. * @access public
    574. -
    575. */
    576. -
    577. function appendDebug($string){
    578. -
    579. if ($this->debugLevel > 0) {
    580. -
    581. // it would be nice to use a memory stream here to use
    582. -
    583. // memory more efficiently
    584. -
    585. $this->debug_str .= $string;
    586. -
    587. }
    588. -
    589. }
    590. -
    591.  
    592. -
    593. /**
    594. -
    595. * clears the current debug data for this instance
    596. -
    597. *
    598. -
    599. * @access public
    600. -
    601. */
    602. -
    603. function clearDebug() {
    604. -
    605. // it would be nice to use a memory stream here to use
    606. -
    607. // memory more efficiently
    608. -
    609. $this->debug_str = '';
    610. -
    611. }
    612. -
    613.  
    614. -
    615. /**
    616. -
    617. * gets the current debug data for this instance
    618. -
    619. *
    620. -
    621. * @return debug data
    622. -
    623. * @access public
    624. -
    625. */
    626. -
    627. function &getDebug() {
    628. -
    629. // it would be nice to use a memory stream here to use
    630. -
    631. // memory more efficiently
    632. -
    633. return $this->debug_str;
    634. -
    635. }
    636. -
    637.  
    638. -
    639. /**
    640. -
    641. * gets the current debug data for this instance as an XML comment
    642. -
    643. * this may change the contents of the debug data
    644. -
    645. *
    646. -
    647. * @return debug data as an XML comment
    648. -
    649. * @access public
    650. -
    651. */
    652. -
    653. function &getDebugAsXMLComment() {
    654. -
    655. // it would be nice to use a memory stream here to use
    656. -
    657. // memory more efficiently
    658. -
    659. while (strpos($this->debug_str, '--')) {
    660. -
    661. $this->debug_str = str_replace('--', '- -', $this->debug_str);
    662. -
    663. }
    664. -
    665. $ret = "<!--\n" . $this->debug_str . "\n-->";
    666. -
    667. return $ret;
    668. -
    669. }
    670. -
    671.  
    672. -
    673. /**
    674. -
    675. * expands entities, e.g. changes '<' to '&lt;'.
    676. -
    677. *
    678. -
    679. * @param string $val The string in which to expand entities.
    680. -
    681. * @access private
    682. -
    683. */
    684. -
    685. function expandEntities($val) {
    686. -
    687. if ($this->charencoding) {
    688. -
    689. $val = str_replace('&', '&amp;', $val);
    690. -
    691. $val = str_replace("'", '&apos;', $val);
    692. -
    693. $val = str_replace('"', '&quot;', $val);
    694. -
    695. $val = str_replace('<', '&lt;', $val);
    696. -
    697. $val = str_replace('>', '&gt;', $val);
    698. -
    699. }
    700. -
    701. return $val;
    702. -
    703. }
    704. -
    705.  
    706. -
    707. /**
    708. -
    709. * returns error string if present
    710. -
    711. *
    712. -
    713. * @return mixed error string or false
    714. -
    715. * @access public
    716. -
    717. */
    718. -
    719. function getError(){
    720. -
    721. if($this->error_str != ''){
    722. -
    723. return $this->error_str;
    724. -
    725. }
    726. -
    727. return false;
    728. -
    729. }
    730. -
    731.  
    732. -
    733. /**
    734. -
    735. * sets error string
    736. -
    737. *
    738. -
    739. * @return boolean $string error string
    740. -
    741. * @access private
    742. -
    743. */
    744. -
    745. function setError($str){
    746. -
    747. $this->error_str = $str;
    748. -
    749. }
    750. -
    751.  
    752. -
    753. /**
    754. -
    755. * detect if array is a simple array or a struct (associative array)
    756. -
    757. *
    758. -
    759. * @param mixed $val The PHP array
    760. -
    761. * @return string (arraySimple|arrayStruct)
    762. -
    763. * @access private
    764. -
    765. */
    766. -
    767. function isArraySimpleOrStruct($val) {
    768. -
    769. $keyList = array_keys($val);
    770. -
    771. foreach ($keyList as $keyListValue) {
    772. -
    773. if (!is_int($keyListValue)) {
    774. -
    775. return 'arrayStruct';
    776. -
    777. }
    778. -
    779. }
    780. -
    781. return 'arraySimple';
    782. -
    783. }
    784. -
    785.  
    786. -
    787. /**
    788. -
    789. * serializes PHP values in accordance w/ section 5. Type information is
    790. -
    791. * not serialized if $use == 'literal'.
    792. -
    793. *
    794. -
    795. * @param mixed $val The value to serialize
    796. -
    797. * @param string $name The name (local part) of the XML element
    798. -
    799. * @param string $type The XML schema type (local part) for the element
    800. -
    801. * @param string $name_ns The namespace for the name of the XML element
    802. -
    803. * @param string $type_ns The namespace for the type of the element
    804. -
    805. * @param array $attributes The attributes to serialize as name=>value pairs
    806. -
    807. * @param string $use The WSDL "use" (encoded|literal)
    808. -
    809. * @param boolean $soapval Whether this is called from soapval.
    810. -
    811. * @return string The serialized element, possibly with child elements
    812. -
    813. * @access public
    814. -
    815. */
    816. -
    817. function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) {
    818. -
    819. $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
    820. -
    821. $this->appendDebug('value=' . $this->varDump($val));
    822. -
    823. $this->appendDebug('attributes=' . $this->varDump($attributes));
    824. -
    825. -
    826. if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
    827. -
    828. $this->debug("serialize_val: serialize soapval");
    829. -
    830. $xml = $val->serialize($use);
    831. -
    832. $this->appendDebug($val->getDebug());
    833. -
    834. $val->clearDebug();
    835. -
    836. $this->debug("serialize_val of soapval returning $xml");
    837. -
    838. return $xml;
    839. -
    840. }
    841. -
    842. // force valid name if necessary
    843. -
    844. if (is_numeric($name)) {
    845. -
    846. $name = '__numeric_' . $name;
    847. -
    848. } elseif (! $name) {
    849. -
    850. $name = 'noname';
    851. -
    852. }
    853. -
    854. // if name has ns, add ns prefix to name
    855. -
    856. $xmlns = '';
    857. -
    858. if($name_ns){
    859. -
    860. $prefix = 'nu'.rand(1000,9999);
    861. -
    862. $name = $prefix.':'.$name;
    863. -
    864. $xmlns .= " xmlns:$prefix=\"$name_ns\"";
    865. -
    866. }
    867. -
    868. // if type is prefixed, create type prefix
    869. -
    870. if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
    871. -
    872. // need to fix this. shouldn't default to xsd if no ns specified
    873. -
    874. // w/o checking against typemap
    875. -
    876. $type_prefix = 'xsd';
    877. -
    878. } elseif($type_ns){
    879. -
    880. $type_prefix = 'ns'.rand(1000,9999);
    881. -
    882. $xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
    883. -
    884. }
    885. -
    886. // serialize attributes if present
    887. -
    888. $atts = '';
    889. -
    890. if($attributes){
    891. -
    892. foreach($attributes as $k => $v){
    893. -
    894. $atts .= " $k=\"".$this->expandEntities($v).'"';
    895. -
    896. }
    897. -
    898. }
    899. -
    900. // serialize null value
    901. -
    902. if (is_null($val)) {
    903. -
    904. $this->debug("serialize_val: serialize null");
    905. -
    906. if ($use == 'literal') {
    907. -
    908. // TODO: depends on minOccurs
    909. -
    910. $xml = "<$name$xmlns$atts/>";
    911. -
    912. $this->debug("serialize_val returning $xml");
    913. -
    914. return $xml;
    915. -
    916. } else {
    917. -
    918. if (isset($type) && isset($type_prefix)) {
    919. -
    920. $type_str = " xsi:type=\"$type_prefix:$type\"";
    921. -
    922. } else {
    923. -
    924. $type_str = '';
    925. -
    926. }
    927. -
    928. $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>";
    929. -
    930. $this->debug("serialize_val returning $xml");
    931. -
    932. return $xml;
    933. -
    934. }
    935. -
    936. }
    937. -
    938. // serialize if an xsd built-in primitive type
    939. -
    940. if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
    941. -
    942. $this->debug("serialize_val: serialize xsd built-in primitive type");
    943. -
    944. if (is_bool($val)) {
    945. -
    946. if ($type == 'boolean') {
    947. -
    948. $val = $val ? 'true' : 'false';
    949. -
    950. } elseif (! $val) {
    951. -
    952. $val = 0;
    953. -
    954. }
    955. -
    956. } else if (is_string($val)) {
    957. -
    958. $val = $this->expandEntities($val);
    959. -
    960. }
    961. -
    962. if ($use == 'literal') {
    963. -
    964. $xml = "<$name$xmlns$atts>$val</$name>";
    965. -
    966. $this->debug("serialize_val returning $xml");
    967. -
    968. return $xml;
    969. -
    970. } else {
    971. -
    972. $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val</$name>";
    973. -
    974. $this->debug("serialize_val returning $xml");
    975. -
    976. return $xml;
    977. -
    978. }
    979. -
    980. }
    981. -
    982. // detect type and serialize
    983. -
    984. $xml = '';
    985. -
    986. switch(true) {
    987. -
    988. case (is_bool($val) || $type == 'boolean'):
    989. -
    990. $this->debug("serialize_val: serialize boolean");
    991. -
    992. if ($type == 'boolean') {
    993. -
    994. $val = $val ? 'true' : 'false';
    995. -
    996. } elseif (! $val) {
    997. -
    998. $val = 0;
    999. -
    1000. }
    1001. -
    1002. if ($use == 'literal') {
    1003. -
    1004. $xml .= "<$name$xmlns$atts>$val</$name>";
    1005. -
    1006. } else {
    1007. -
    1008. $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
    1009. -
    1010. }
    1011. -
    1012. break;
    1013. -
    1014. case (is_int($val) || is_long($val) || $type == 'int'):
    1015. -
    1016. $this->debug("serialize_val: serialize int");
    1017. -
    1018. if ($use == 'literal') {
    1019. -
    1020. $xml .= "<$name$xmlns$atts>$val</$name>";
    1021. -
    1022. } else {
    1023. -
    1024. $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
    1025. -
    1026. }
    1027. -
    1028. break;
    1029. -
    1030. case (is_float($val)|| is_double($val) || $type == 'float'):
    1031. -
    1032. $this->debug("serialize_val: serialize float");
    1033. -
    1034. if ($use == 'literal') {
    1035. -
    1036. $xml .= "<$name$xmlns$atts>$val</$name>";
    1037. -
    1038. } else {
    1039. -
    1040. $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
    1041. -
    1042. }
    1043. -
    1044. break;
    1045. -
    1046. case (is_string($val) || $type == 'string'):
    1047. -
    1048. $this->debug("serialize_val: serialize string");
    1049. -
    1050. $val = $this->expandEntities($val);
    1051. -
    1052. if ($use == 'literal') {
    1053. -
    1054. $xml .= "<$name$xmlns$atts>$val</$name>";
    1055. -
    1056. } else {
    1057. -
    1058. $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
    1059. -
    1060. }
    1061. -
    1062. break;
    1063. -
    1064. case is_object($val):
    1065. -
    1066. $this->debug("serialize_val: serialize object");
    1067. -
    1068. if (get_class($val) == 'soapval') {
    1069. -
    1070. $this->debug("serialize_val: serialize soapval object");
    1071. -
    1072. $pXml = $val->serialize($use);
    1073. -
    1074. $this->appendDebug($val->getDebug());
    1075. -
    1076. $val->clearDebug();
    1077. -
    1078. } else {
    1079. -
    1080. if (! $name) {
    1081. -
    1082. $name = get_class($val);
    1083. -
    1084. $this->debug("In serialize_val, used class name $name as element name");
    1085. -
    1086. } else {
    1087. -
    1088. $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
    1089. -
    1090. }
    1091. -
    1092. foreach(get_object_vars($val) as $k => $v){
    1093. -
    1094. $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
    1095. -
    1096. }
    1097. -
    1098. }
    1099. -
    1100. if(isset($type) && isset($type_prefix)){
    1101. -
    1102. $type_str = " xsi:type=\"$type_prefix:$type\"";
    1103. -
    1104. } else {
    1105. -
    1106. $type_str = '';
    1107. -
    1108. }
    1109. -
    1110. if ($use == 'literal') {
    1111. -
    1112. $xml .= "<$name$xmlns$atts>$pXml</$name>";
    1113. -
    1114. } else {
    1115. -
    1116. $xml .= "<$name$xmlns$type_str$atts>$pXml</$name>";
    1117. -
    1118. }
    1119. -
    1120. break;
    1121. -
    1122. break;
    1123. -
    1124. case (is_array($val) || $type):
    1125. -
    1126. // detect if struct or array
    1127. -
    1128. $valueType = $this->isArraySimpleOrStruct($val);
    1129. -
    1130. if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
    1131. -
    1132. $this->debug("serialize_val: serialize array");
    1133. -
    1134. $i = 0;
    1135. -
    1136. if(is_array($val) && count($val)> 0){
    1137. -
    1138. foreach($val as $v){
    1139. -
    1140. if(is_object($v) && get_class($v) == 'soapval'){
    1141. -
    1142. $tt_ns = $v->type_ns;
    1143. -
    1144. $tt = $v->type;
    1145. -
    1146. } elseif (is_array($v)) {
    1147. -
    1148. $tt = $this->isArraySimpleOrStruct($v);
    1149. -
    1150. } else {
    1151. -
    1152. $tt = gettype($v);
    1153. -
    1154. }
    1155. -
    1156. $array_types[$tt] = 1;
    1157. -
    1158. // TODO: for literal, the name should be $name
    1159. -
    1160. $xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
    1161. -
    1162. ++$i;
    1163. -
    1164. }
    1165. -
    1166. if(count($array_types) > 1){
    1167. -
    1168. $array_typename = 'xsd:anyType';
    1169. -
    1170. } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
    1171. -
    1172. if ($tt == 'integer') {
    1173. -
    1174. $tt = 'int';
    1175. -
    1176. }
    1177. -
    1178. $array_typename = 'xsd:'.$tt;
    1179. -
    1180. } elseif(isset($tt) && $tt == 'arraySimple'){
    1181. -
    1182. $array_typename = 'SOAP-ENC:Array';
    1183. -
    1184. } elseif(isset($tt) && $tt == 'arrayStruct'){
    1185. -
    1186. $array_typename = 'unnamed_struct_use_soapval';
    1187. -
    1188. } else {
    1189. -
    1190. // if type is prefixed, create type prefix
    1191. -
    1192. if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
    1193. -
    1194. $array_typename = 'xsd:' . $tt;
    1195. -
    1196. } elseif ($tt_ns) {
    1197. -
    1198. $tt_prefix = 'ns' . rand(1000, 9999);
    1199. -
    1200. $array_typename = "$tt_prefix:$tt";
    1201. -
    1202. $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
    1203. -
    1204. } else {
    1205. -
    1206. $array_typename = $tt;
    1207. -
    1208. }
    1209. -
    1210. }
    1211. -
    1212. $array_type = $i;
    1213. -
    1214. if ($use == 'literal') {
    1215. -
    1216. $type_str = '';
    1217. -
    1218. } else if (isset($type) && isset($type_prefix)) {
    1219. -
    1220. $type_str = " xsi:type=\"$type_prefix:$type\"";
    1221. -
    1222. } else {
    1223. -
    1224. $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
    1225. -
    1226. }
    1227. -
    1228. // empty array
    1229. -
    1230. } else {
    1231. -
    1232. if ($use == 'literal') {
    1233. -
    1234. $type_str = '';
    1235. -
    1236. } else if (isset($type) && isset($type_prefix)) {
    1237. -
    1238. $type_str = " xsi:type=\"$type_prefix:$type\"";
    1239. -
    1240. } else {
    1241. -
    1242. $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
    1243. -
    1244. }
    1245. -
    1246. }
    1247. -
    1248. // TODO: for array in literal, there is no wrapper here
    1249. -
    1250. $xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
    1251. -
    1252. } else {
    1253. -
    1254. // got a struct
    1255. -
    1256. $this->debug("serialize_val: serialize struct");
    1257. -
    1258. if(isset($type) && isset($type_prefix)){
    1259. -
    1260. $type_str = " xsi:type=\"$type_prefix:$type\"";
    1261. -
    1262. } else {
    1263. -
    1264. $type_str = '';
    1265. -
    1266. }
    1267. -
    1268. if ($use == 'literal') {
    1269. -
    1270. $xml .= "<$name$xmlns$atts>";
    1271. -
    1272. } else {
    1273. -
    1274. $xml .= "<$name$xmlns$type_str$atts>";
    1275. -
    1276. }
    1277. -
    1278. foreach($val as $k => $v){
    1279. -
    1280. // Apache Map
    1281. -
    1282. if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
    1283. -
    1284. $xml .= '<item>';
    1285. -
    1286. $xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
    1287. -
    1288. $xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
    1289. -
    1290. $xml .= '</item>';
    1291. -
    1292. } else {
    1293. -
    1294. $xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
    1295. -
    1296. }
    1297. -
    1298. }
    1299. -
    1300. $xml .= "</$name>";
    1301. -
    1302. }
    1303. -
    1304. break;
    1305. -
    1306. default:
    1307. -
    1308. $this->debug("serialize_val: serialize unknown");
    1309. -
    1310. $xml .= 'not detected, got '.gettype($val).' for '.$val;
    1311. -
    1312. break;
    1313. -
    1314. }
    1315. -
    1316. $this->debug("serialize_val returning $xml");
    1317. -
    1318. return $xml;
    1319. -
    1320. }
    1321. -
    1322.  
    1323. -
    1324. /**
    1325. -
    1326. * serializes a message
    1327. -
    1328. *
    1329. -
    1330. * @param string $body the XML of the SOAP body
    1331. -
    1332. * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array
    1333. -
    1334. * @param array $namespaces optional the namespaces used in generating the body and headers
    1335. -
    1336. * @param string $style optional (rpc|document)
    1337. -
    1338. * @param string $use optional (encoded|literal)
    1339. -
    1340. * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
    1341. -
    1342. * @return string the message
    1343. -
    1344. * @access public
    1345. -
    1346. */
    1347. -
    1348. function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
    1349. -
    1350. // TODO: add an option to automatically run utf8_encode on $body and $headers
    1351. -
    1352. // if $this->soap_defencoding is UTF-8. Not doing this automatically allows
    1353. -
    1354. // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
    1355. -
    1356.  
    1357. -
    1358. $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
    1359. -
    1360. $this->debug("headers:");
    1361. -
    1362. $this->appendDebug($this->varDump($headers));
    1363. -
    1364. $this->debug("namespaces:");
    1365. -
    1366. $this->appendDebug($this->varDump($namespaces));
    1367. -
    1368.  
    1369. -
    1370. // serialize namespaces
    1371. -
    1372. $ns_string = '';
    1373. -
    1374. foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
    1375. -
    1376. $ns_string .= " xmlns:$k=\"$v\"";
    1377. -
    1378. }
    1379. -
    1380. if($encodingStyle) {
    1381. -
    1382. $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
    1383. -
    1384. }
    1385. -
    1386.  
    1387. -
    1388. // serialize headers
    1389. -
    1390. if($headers){
    1391. -
    1392. if (is_array($headers)) {
    1393. -
    1394. $xml = '';
    1395. -
    1396. foreach ($headers as $k => $v) {
    1397. -
    1398. if (is_object($v) && get_class($v) == 'soapval') {
    1399. -
    1400. $xml .= $this->serialize_val($v, false, false, false, false, false, $use);
    1401. -
    1402. } else {
    1403. -
    1404. $xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
    1405. -
    1406. }
    1407. -
    1408. }
    1409. -
    1410. $headers = $xml;
    1411. -
    1412. $this->debug("In serializeEnvelope, serialized array of headers to $headers");
    1413. -
    1414. }
    1415. -
    1416. $headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
    1417. -
    1418. }
    1419. -
    1420. // serialize envelope
    1421. -
    1422. return
    1423. -
    1424. '<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
    1425. -
    1426. '<SOAP-ENV:Envelope'.$ns_string.">".
    1427. -
    1428. $headers.
    1429. -
    1430. "<SOAP-ENV:Body>".
    1431. -
    1432. $body.
    1433. -
    1434. "</SOAP-ENV:Body>".
    1435. -
    1436. "</SOAP-ENV:Envelope>";
    1437. -
    1438. }
    1439. -
    1440.  
    1441. -
    1442. /**
    1443. -
    1444. * formats a string to be inserted into an HTML stream
    1445. -
    1446. *
    1447. -
    1448. * @param string $str The string to format
    1449. -
    1450. * @return string The formatted string
    1451. -
    1452. * @access public
    1453. -
    1454. * @deprecated
    1455. -
    1456. */
    1457. -
    1458. function formatDump($str){
    1459. -
    1460. $str = htmlspecialchars($str);
    1461. -
    1462. return nl2br($str);
    1463. -
    1464. }
    1465. -
    1466.  
    1467. -
    1468. /**
    1469. -
    1470. * contracts (changes namespace to prefix) a qualified name
    1471. -
    1472. *
    1473. -
    1474. * @param string $qname qname
    1475. -
    1476. * @return string contracted qname
    1477. -
    1478. * @access private
    1479. -
    1480. */
    1481. -
    1482. function contractQname($qname){
    1483. -
    1484. // get element namespace
    1485. -
    1486. //$this->xdebug("Contract $qname");
    1487. -
    1488. if (strrpos($qname, ':')) {
    1489. -
    1490. // get unqualified name
    1491. -
    1492. $name = substr($qname, strrpos($qname, ':') + 1);
    1493. -
    1494. // get ns
    1495. -
    1496. $ns = substr($qname, 0, strrpos($qname, ':'));
    1497. -
    1498. $p = $this->getPrefixFromNamespace($ns);
    1499. -
    1500. if ($p) {
    1501. -
    1502. return $p . ':' . $name;
    1503. -
    1504. }
    1505. -
    1506. return $qname;
    1507. -
    1508. } else {
    1509. -
    1510. return $qname;
    1511. -
    1512. }
    1513. -
    1514. }
    1515. -
    1516.  
    1517. -
    1518. /**
    1519. -
    1520. * expands (changes prefix to namespace) a qualified name
    1521. -
    1522. *
    1523. -
    1524. * @param string $qname qname
    1525. -
    1526. * @return string expanded qname
    1527. -
    1528. * @access private
    1529. -
    1530. */
    1531. -
    1532. function expandQname($qname){
    1533. -
    1534. // get element prefix
    1535. -
    1536. if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
    1537. -
    1538. // get unqualified name
    1539. -
    1540. $name = substr(strstr($qname,':'),1);
    1541. -
    1542. // get ns prefix
    1543. -
    1544. $prefix = substr($qname,0,strpos($qname,':'));
    1545. -
    1546. if(isset($this->namespaces[$prefix])){
    1547. -
    1548. return $this->namespaces[$prefix].':'.$name;
    1549. -
    1550. } else {
    1551. -
    1552. return $qname;
    1553. -
    1554. }
    1555. -
    1556. } else {
    1557. -
    1558. return $qname;
    1559. -
    1560. }
    1561. -
    1562. }
    1563. -
    1564.  
    1565. -
    1566. /**
    1567. -
    1568. * returns the local part of a prefixed string
    1569. -
    1570. * returns the original string, if not prefixed
    1571. -
    1572. *
    1573. -
    1574. * @param string $str The prefixed string
    1575. -
    1576. * @return string The local part
    1577. -
    1578. * @access public
    1579. -
    1580. */
    1581. -
    1582. function getLocalPart($str){
    1583. -
    1584. if($sstr = strrchr($str,':')){
    1585. -
    1586. // get unqualified name
    1587. -
    1588. return substr( $sstr, 1 );
    1589. -
    1590. } else {
    1591. -
    1592. return $str;
    1593. -
    1594. }
    1595. -
    1596. }
    1597. -
    1598.  
    1599. -
    1600. /**
    1601. -
    1602. * returns the prefix part of a prefixed string
    1603. -
    1604. * returns false, if not prefixed
    1605. -
    1606. *
    1607. -
    1608. * @param string $str The prefixed string
    1609. -
    1610. * @return mixed The prefix or false if there is no prefix
    1611. -
    1612. * @access public
    1613. -
    1614. */
    1615. -
    1616. function getPrefix($str){
    1617. -
    1618. if($pos = strrpos($str,':')){
    1619. -
    1620. // get prefix
    1621. -
    1622. return substr($str,0,$pos);
    1623. -
    1624. }
    1625. -
    1626. return false;
    1627. -
    1628. }
    1629. -
    1630.  
    1631. -
    1632. /**
    1633. -
    1634. * pass it a prefix, it returns a namespace
    1635. -
    1636. *
    1637. -
    1638. * @param string $prefix The prefix
    1639. -
    1640. * @return mixed The namespace, false if no namespace has the specified prefix
    1641. -
    1642. * @access public
    1643. -
    1644. */
    1645. -
    1646. function getNamespaceFromPrefix($prefix){
    1647. -
    1648. if (isset($this->namespaces[$prefix])) {
    1649. -
    1650. return $this->namespaces[$prefix];
    1651. -
    1652. }
    1653. -
    1654. //$this->setError("No namespace registered for prefix '$prefix'");
    1655. -
    1656. return false;
    1657. -
    1658. }
    1659. -
    1660.  
    1661. -
    1662. /**
    1663. -
    1664. * returns the prefix for a given namespace (or prefix)
    1665. -
    1666. * or false if no prefixes registered for the given namespace
    1667. -
    1668. *
    1669. -
    1670. * @param string $ns The namespace
    1671. -
    1672. * @return mixed The prefix, false if the namespace has no prefixes
    1673. -
    1674. * @access public
    1675. -
    1676. */
    1677. -
    1678. function getPrefixFromNamespace($ns) {
    1679. -
    1680. foreach ($this->namespaces as $p => $n) {
    1681. -
    1682. if ($ns == $n || $ns == $p) {
    1683. -
    1684. $this->usedNamespaces[$p] = $n;
    1685. -
    1686. return $p;
    1687. -
    1688. }
    1689. -
    1690. }
    1691. -
    1692. return false;
    1693. -
    1694. }
    1695. -
    1696.  
    1697. -
    1698. /**
    1699. -
    1700. * returns the time in ODBC canonical form with microseconds
    1701. -
    1702. *
    1703. -
    1704. * @return string The time in ODBC canonical form with microseconds
    1705. -
    1706. * @access public
    1707. -
    1708. */
    1709. -
    1710. function getmicrotime() {
    1711. -
    1712. if (function_exists('gettimeofday')) {
    1713. -
    1714. $tod = gettimeofday();
    1715. -
    1716. $sec = $tod['sec'];
    1717. -
    1718. $usec = $tod['usec'];
    1719. -
    1720. } else {
    1721. -
    1722. $sec = time();
    1723. -
    1724. $usec = 0;
    1725. -
    1726. }
    1727. -
    1728. return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
    1729. -
    1730. }
    1731. -
    1732.  
    1733. -
    1734. /**
    1735. -
    1736. * Returns a string with the output of var_dump
    1737. -
    1738. *
    1739. -
    1740. * @param mixed $data The variable to var_dump
    1741. -
    1742. * @return string The output of var_dump
    1743. -
    1744. * @access public
    1745. -
    1746. */
    1747. -
    1748. function varDump($data) {
    1749. -
    1750. ob_start();
    1751. -
    1752. var_dump($data);
    1753. -
    1754. $ret_val = ob_get_contents();
    1755. -
    1756. ob_end_clean();
    1757. -
    1758. return $ret_val;
    1759. -
    1760. }
    1761. -
    1762.  
    1763. -
    1764. /**
    1765. -
    1766. * represents the object as a string
    1767. -
    1768. *
    1769. -
    1770. * @return string
    1771. -
    1772. * @access public
    1773. -
    1774. */
    1775. -
    1776. function __toString() {
    1777. -
    1778. return $this->varDump($this);
    1779. -
    1780. }
    1781. -
    1782. }
    1783. -
    1784.  
    1785. -
    1786. // XML Schema Datatype Helper Functions
    1787. -
    1788. //xsd:dateTime helpers
    1789. -
    1790.  
    1791. -
    1792.  
    1793. -
    1794.  
    1795. -
    1796. /**
    1797. -
    1798. * convert unix timestamp to ISO 8601 compliant date string
    1799. -
    1800. *
    1801. -
    1802. * @param int $timestamp Unix time stamp
    1803. -
    1804. * @param boolean $utc Whether the time stamp is UTC or local
    1805. -
    1806. * @return mixed ISO 8601 date string or false
    1807. -
    1808. * @access public
    1809. -
    1810. */
    1811. -
    1812. function timestamp_to_iso8601($timestamp,$utc=true){
    1813. -
    1814. $datestr = date('Y-m-d\TH:i:sO',$timestamp);
    1815. -
    1816. $pos = strrpos($datestr, "+");
    1817. -
    1818. if ($pos === FALSE) {
    1819. -
    1820. $pos = strrpos($datestr, "-");
    1821. -
    1822. }
    1823. -
    1824. if ($pos !== FALSE) {
    1825. -
    1826. if (strlen($datestr) == $pos + 5) {
    1827. -
    1828. $datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2);
    1829. -
    1830. }
    1831. -
    1832. }
    1833. -
    1834. if($utc){
    1835. -
    1836. $pattern = '/'.
    1837. -
    1838. '([0-9]{4})-'. // centuries & years CCYY-
    1839. -
    1840. '([0-9]{2})-'. // months MM-
    1841. -
    1842. '([0-9]{2})'. // days DD
    1843. -
    1844. 'T'. // separator T
    1845. -
    1846. '([0-9]{2}):'. // hours hh:
    1847. -
    1848. '([0-9]{2}):'. // minutes mm:
    1849. -
    1850. '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
    1851. -
    1852. '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
    1853. -
    1854. '/';
    1855. -
    1856.  
    1857. -
    1858. if(preg_match($pattern,$datestr,$regs)){
    1859. -
    1860. return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
    1861. -
    1862. }
    1863. -
    1864. return false;
    1865. -
    1866. } else {
    1867. -
    1868. return $datestr;
    1869. -
    1870. }
    1871. -
    1872. }
    1873. -
    1874.  
    1875. -
    1876. /**
    1877. -
    1878. * convert ISO 8601 compliant date string to unix timestamp
    1879. -
    1880. *
    1881. -
    1882. * @param string $datestr ISO 8601 compliant date string
    1883. -
    1884. * @return mixed Unix timestamp (int) or false
    1885. -
    1886. * @access public
    1887. -
    1888. */
    1889. -
    1890. function iso8601_to_timestamp($datestr){
    1891. -
    1892. $pattern = '/'.
    1893. -
    1894. '([0-9]{4})-'. // centuries & years CCYY-
    1895. -
    1896. '([0-9]{2})-'. // months MM-
    1897. -
    1898. '([0-9]{2})'. // days DD
    1899. -
    1900. 'T'. // separator T
    1901. -
    1902. '([0-9]{2}):'. // hours hh:
    1903. -
    1904. '([0-9]{2}):'. // minutes mm:
    1905. -
    1906. '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
    1907. -
    1908. '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
    1909. -
    1910. '/';
    1911. -
    1912. if(preg_match($pattern,$datestr,$regs)){
    1913. -
    1914. // not utc
    1915. -
    1916. if($regs[8] != 'Z'){
    1917. -
    1918. $op = substr($regs[8],0,1);
    1919. -
    1920. $h = substr($regs[8],1,2);
    1921. -
    1922. $m = substr($regs[8],strlen($regs[8])-2,2);
    1923. -
    1924. if($op == '-'){
    1925. -
    1926. $regs[4] = $regs[4] + $h;
    1927. -
    1928. $regs[5] = $regs[5] + $m;
    1929. -
    1930. } elseif($op == '+'){
    1931. -
    1932. $regs[4] = $regs[4] - $h;
    1933. -
    1934. $regs[5] = $regs[5] - $m;
    1935. -
    1936. }
    1937. -
    1938. }
    1939. -
    1940. return gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
    1941. -
    1942. // return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z");
    1943. -
    1944. } else {
    1945. -
    1946. return false;
    1947. -
    1948. }
    1949. -
    1950. }
    1951. -
    1952.  
    1953. -
    1954. /**
    1955. -
    1956. * sleeps some number of microseconds
    1957. -
    1958. *
    1959. -
    1960. * @param string $usec the number of microseconds to sleep
    1961. -
    1962. * @access public
    1963. -
    1964. * @deprecated
    1965. -
    1966. */
    1967. -
    1968. function usleepWindows($usec)
    1969. -
    1970. {
    1971. -
    1972. $start = gettimeofday();
    1973. -
    1974. -
    1975. do
    1976. -
    1977. {
    1978. -
    1979. $stop = gettimeofday();
    1980. -
    1981. $timePassed = 1000000 * ($stop['sec'] - $start['sec'])
    1982. -
    1983. + $stop['usec'] - $start['usec'];
    1984. -
    1985. }
    1986. -
    1987. while ($timePassed < $usec);
    1988. -
    1989. }
    1990. -
    1991.  
    1992. -
    1993. ?><?php
    1994. -
    1995.  
    1996. -
    1997.  
    1998. -
    1999.  
    2000. -
    2001. /**
    2002. -
    2003. * Contains information for a SOAP fault.
    2004. -
    2005. * Mainly used for returning faults from deployed functions
    2006. -
    2007. * in a server instance.
    2008. -
    2009. * @author Dietrich Ayala <dietrich@ganx4.com>
    2010. -
    2011. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    2012. -
    2013. * @access public
    2014. -
    2015. */
    2016. -
    2017. class nusoap_fault extends nusoap_base {
    2018. -
    2019. /**
    2020. -
    2021. * The fault code (client|server)
    2022. -
    2023. * @var string
    2024. -
    2025. * @access private
    2026. -
    2027. */
    2028. -
    2029. var $faultcode;
    2030. -
    2031. /**
    2032. -
    2033. * The fault actor
    2034. -
    2035. * @var string
    2036. -
    2037. * @access private
    2038. -
    2039. */
    2040. -
    2041. var $faultactor;
    2042. -
    2043. /**
    2044. -
    2045. * The fault string, a description of the fault
    2046. -
    2047. * @var string
    2048. -
    2049. * @access private
    2050. -
    2051. */
    2052. -
    2053. var $faultstring;
    2054. -
    2055. /**
    2056. -
    2057. * The fault detail, typically a string or array of string
    2058. -
    2059. * @var mixed
    2060. -
    2061. * @access private
    2062. -
    2063. */
    2064. -
    2065. var $faultdetail;
    2066. -
    2067.  
    2068. -
    2069. /**
    2070. -
    2071. * constructor
    2072. -
    2073. *
    2074. -
    2075. * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server)
    2076. -
    2077. * @param string $faultactor only used when msg routed between multiple actors
    2078. -
    2079. * @param string $faultstring human readable error message
    2080. -
    2081. * @param mixed $faultdetail detail, typically a string or array of string
    2082. -
    2083. */
    2084. -
    2085. function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
    2086. -
    2087. parent::nusoap_base();
    2088. -
    2089. $this->faultcode = $faultcode;
    2090. -
    2091. $this->faultactor = $faultactor;
    2092. -
    2093. $this->faultstring = $faultstring;
    2094. -
    2095. $this->faultdetail = $faultdetail;
    2096. -
    2097. }
    2098. -
    2099.  
    2100. -
    2101. /**
    2102. -
    2103. * serialize a fault
    2104. -
    2105. *
    2106. -
    2107. * @return string The serialization of the fault instance.
    2108. -
    2109. * @access public
    2110. -
    2111. */
    2112. -
    2113. function serialize(){
    2114. -
    2115. $ns_string = '';
    2116. -
    2117. foreach($this->namespaces as $k => $v){
    2118. -
    2119. $ns_string .= "\n xmlns:$k=\"$v\"";
    2120. -
    2121. }
    2122. -
    2123. $return_msg =
    2124. -
    2125. '<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'.
    2126. -
    2127. '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n".
    2128. -
    2129. '<SOAP-ENV:Body>'.
    2130. -
    2131. '<SOAP-ENV:Fault>'.
    2132. -
    2133. $this->serialize_val($this->faultcode, 'faultcode').
    2134. -
    2135. $this->serialize_val($this->faultactor, 'faultactor').
    2136. -
    2137. $this->serialize_val($this->faultstring, 'faultstring').
    2138. -
    2139. $this->serialize_val($this->faultdetail, 'detail').
    2140. -
    2141. '</SOAP-ENV:Fault>'.
    2142. -
    2143. '</SOAP-ENV:Body>'.
    2144. -
    2145. '</SOAP-ENV:Envelope>';
    2146. -
    2147. return $return_msg;
    2148. -
    2149. }
    2150. -
    2151. }
    2152. -
    2153.  
    2154. -
    2155. /**
    2156. -
    2157. * Backward compatibility
    2158. -
    2159. */
    2160. -
    2161. class soap_fault extends nusoap_fault {
    2162. -
    2163. }
    2164. -
    2165.  
    2166. -
    2167. ?><?php
    2168. -
    2169.  
    2170. -
    2171.  
    2172. -
    2173.  
    2174. -
    2175. /**
    2176. -
    2177. * parses an XML Schema, allows access to it's data, other utility methods.
    2178. -
    2179. * imperfect, no validation... yet, but quite functional.
    2180. -
    2181. *
    2182. -
    2183. * @author Dietrich Ayala <dietrich@ganx4.com>
    2184. -
    2185. * @author Scott Nichol <snichol@users.sourceforge.net>
    2186. -
    2187. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    2188. -
    2189. * @access public
    2190. -
    2191. */
    2192. -
    2193. class nusoap_xmlschema extends nusoap_base {
    2194. -
    2195. -
    2196. // files
    2197. -
    2198. -
    2199. var $schema = '';
    2200. -
    2201. var $xml = '';
    2202. -
    2203. // namespaces
    2204. -
    2205. -
    2206. var $enclosingNamespaces;
    2207. -
    2208. // schema info
    2209. -
    2210. -
    2211. var $schemaInfo = array();
    2212. -
    2213. var $schemaTargetNamespace = '';
    2214. -
    2215. // types, elements, attributes defined by the schema
    2216. -
    2217. -
    2218. var $attributes = array();
    2219. -
    2220. var $complexTypes = array();
    2221. -
    2222. var $complexTypeStack = array();
    2223. -
    2224. var $currentComplexType = null;
    2225. -
    2226. var $elements = array();
    2227. -
    2228. var $elementStack = array();
    2229. -
    2230. var $currentElement = null;
    2231. -
    2232. var $simpleTypes = array();
    2233. -
    2234. var $simpleTypeStack = array();
    2235. -
    2236. var $currentSimpleType = null;
    2237. -
    2238. // imports
    2239. -
    2240. -
    2241. var $imports = array();
    2242. -
    2243. // parser vars
    2244. -
    2245. -
    2246. var $parser;
    2247. -
    2248. var $position = 0;
    2249. -
    2250. var $depth = 0;
    2251. -
    2252. var $depth_array = array();
    2253. -
    2254. var $message = array();
    2255. -
    2256. var $defaultNamespace = array();
    2257. -
    2258. -
    2259. /**
    2260. -
    2261. * constructor
    2262. -
    2263. *
    2264. -
    2265. * @param string $schema schema document URI
    2266. -
    2267. * @param string $xml xml document URI
    2268. -
    2269. * @param string $namespaces namespaces defined in enclosing XML
    2270. -
    2271. * @access public
    2272. -
    2273. */
    2274. -
    2275. function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
    2276. -
    2277. parent::nusoap_base();
    2278. -
    2279. $this->debug('nusoap_xmlschema class instantiated, inside constructor');
    2280. -
    2281. // files
    2282. -
    2283. $this->schema = $schema;
    2284. -
    2285. $this->xml = $xml;
    2286. -
    2287.  
    2288. -
    2289. // namespaces
    2290. -
    2291. $this->enclosingNamespaces = $namespaces;
    2292. -
    2293. $this->namespaces = array_merge($this->namespaces, $namespaces);
    2294. -
    2295.  
    2296. -
    2297. // parse schema file
    2298. -
    2299. if($schema != ''){
    2300. -
    2301. $this->debug('initial schema file: '.$schema);
    2302. -
    2303. $this->parseFile($schema, 'schema');
    2304. -
    2305. }
    2306. -
    2307.  
    2308. -
    2309. // parse xml file
    2310. -
    2311. if($xml != ''){
    2312. -
    2313. $this->debug('initial xml file: '.$xml);
    2314. -
    2315. $this->parseFile($xml, 'xml');
    2316. -
    2317. }
    2318. -
    2319.  
    2320. -
    2321. }
    2322. -
    2323.  
    2324. -
    2325. /**
    2326. -
    2327. * parse an XML file
    2328. -
    2329. *
    2330. -
    2331. * @param string $xml path/URL to XML file
    2332. -
    2333. * @param string $type (schema | xml)
    2334. -
    2335. * @return boolean
    2336. -
    2337. * @access public
    2338. -
    2339. */
    2340. -
    2341. function parseFile($xml,$type){
    2342. -
    2343. // parse xml file
    2344. -
    2345. if($xml != ""){
    2346. -
    2347. $xmlStr = @join("",@file($xml));
    2348. -
    2349. if($xmlStr == ""){
    2350. -
    2351. $msg = 'Error reading XML from '.$xml;
    2352. -
    2353. $this->setError($msg);
    2354. -
    2355. $this->debug($msg);
    2356. -
    2357. return false;
    2358. -
    2359. } else {
    2360. -
    2361. $this->debug("parsing $xml");
    2362. -
    2363. $this->parseString($xmlStr,$type);
    2364. -
    2365. $this->debug("done parsing $xml");
    2366. -
    2367. return true;
    2368. -
    2369. }
    2370. -
    2371. }
    2372. -
    2373. return false;
    2374. -
    2375. }
    2376. -
    2377.  
    2378. -
    2379. /**
    2380. -
    2381. * parse an XML string
    2382. -
    2383. *
    2384. -
    2385. * @param string $xml path or URL
    2386. -
    2387. * @param string $type (schema|xml)
    2388. -
    2389. * @access private
    2390. -
    2391. */
    2392. -
    2393. function parseString($xml,$type){
    2394. -
    2395. // parse xml string
    2396. -
    2397. if($xml != ""){
    2398. -
    2399.  
    2400. -
    2401. // Create an XML parser.
    2402. -
    2403. $this->parser = xml_parser_create();
    2404. -
    2405. // Set the options for parsing the XML data.
    2406. -
    2407. xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    2408. -
    2409.  
    2410. -
    2411. // Set the object for the parser.
    2412. -
    2413. xml_set_object($this->parser, $this);
    2414. -
    2415.  
    2416. -
    2417. // Set the element handlers for the parser.
    2418. -
    2419. if($type == "schema"){
    2420. -
    2421. xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
    2422. -
    2423. xml_set_character_data_handler($this->parser,'schemaCharacterData');
    2424. -
    2425. } elseif($type == "xml"){
    2426. -
    2427. xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
    2428. -
    2429. xml_set_character_data_handler($this->parser,'xmlCharacterData');
    2430. -
    2431. }
    2432. -
    2433.  
    2434. -
    2435. // Parse the XML file.
    2436. -
    2437. if(!xml_parse($this->parser,$xml,true)){
    2438. -
    2439. // Display an error message.
    2440. -
    2441. $errstr = sprintf('XML error parsing XML schema on line %d: %s',
    2442. -
    2443. xml_get_current_line_number($this->parser),
    2444. -
    2445. xml_error_string(xml_get_error_code($this->parser))
    2446. -
    2447. );
    2448. -
    2449. $this->debug($errstr);
    2450. -
    2451. $this->debug("XML payload:\n" . $xml);
    2452. -
    2453. $this->setError($errstr);
    2454. -
    2455. }
    2456. -
    2457. -
    2458. xml_parser_free($this->parser);
    2459. -
    2460. } else{
    2461. -
    2462. $this->debug('no xml passed to parseString()!!');
    2463. -
    2464. $this->setError('no xml passed to parseString()!!');
    2465. -
    2466. }
    2467. -
    2468. }
    2469. -
    2470.  
    2471. -
    2472. /**
    2473. -
    2474. * gets a type name for an unnamed type
    2475. -
    2476. *
    2477. -
    2478. * @param string Element name
    2479. -
    2480. * @return string A type name for an unnamed type
    2481. -
    2482. * @access private
    2483. -
    2484. */
    2485. -
    2486. function CreateTypeName($ename) {
    2487. -
    2488. $scope = '';
    2489. -
    2490. for ($i = 0; $i < count($this->complexTypeStack); $i++) {
    2491. -
    2492. $scope .= $this->complexTypeStack[$i] . '_';
    2493. -
    2494. }
    2495. -
    2496. return $scope . $ename . '_ContainedType';
    2497. -
    2498. }
    2499. -
    2500. -
    2501. /**
    2502. -
    2503. * start-element handler
    2504. -
    2505. *
    2506. -
    2507. * @param string $parser XML parser object
    2508. -
    2509. * @param string $name element name
    2510. -
    2511. * @param string $attrs associative array of attributes
    2512. -
    2513. * @access private
    2514. -
    2515. */
    2516. -
    2517. function schemaStartElement($parser, $name, $attrs) {
    2518. -
    2519. -
    2520. // position in the total number of elements, starting from 0
    2521. -
    2522. $pos = $this->position++;
    2523. -
    2524. $depth = $this->depth++;
    2525. -
    2526. // set self as current value for this depth
    2527. -
    2528. $this->depth_array[$depth] = $pos;
    2529. -
    2530. $this->message[$pos] = array('cdata' => '');
    2531. -
    2532. if ($depth > 0) {
    2533. -
    2534. $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
    2535. -
    2536. } else {
    2537. -
    2538. $this->defaultNamespace[$pos] = false;
    2539. -
    2540. }
    2541. -
    2542.  
    2543. -
    2544. // get element prefix
    2545. -
    2546. if($prefix = $this->getPrefix($name)){
    2547. -
    2548. // get unqualified name
    2549. -
    2550. $name = $this->getLocalPart($name);
    2551. -
    2552. } else {
    2553. -
    2554. $prefix = '';
    2555. -
    2556. }
    2557. -
    2558. -
    2559. // loop thru attributes, expanding, and registering namespace declarations
    2560. -
    2561. if(count($attrs) > 0){
    2562. -
    2563. foreach($attrs as $k => $v){
    2564. -
    2565. // if ns declarations, add to class level array of valid namespaces
    2566. -
    2567. if(preg_match('/^xmlns/',$k)){
    2568. -
    2569. //$this->xdebug("$k: $v");
    2570. -
    2571. //$this->xdebug('ns_prefix: '.$this->getPrefix($k));
    2572. -
    2573. if($ns_prefix = substr(strrchr($k,':'),1)){
    2574. -
    2575. //$this->xdebug("Add namespace[$ns_prefix] = $v");
    2576. -
    2577. $this->namespaces[$ns_prefix] = $v;
    2578. -
    2579. } else {
    2580. -
    2581. $this->defaultNamespace[$pos] = $v;
    2582. -
    2583. if (! $this->getPrefixFromNamespace($v)) {
    2584. -
    2585. $this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
    2586. -
    2587. }
    2588. -
    2589. }
    2590. -
    2591. if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){
    2592. -
    2593. $this->XMLSchemaVersion = $v;
    2594. -
    2595. $this->namespaces['xsi'] = $v.'-instance';
    2596. -
    2597. }
    2598. -
    2599. }
    2600. -
    2601. }
    2602. -
    2603. foreach($attrs as $k => $v){
    2604. -
    2605. // expand each attribute
    2606. -
    2607. $k = strpos($k,':') ? $this->expandQname($k) : $k;
    2608. -
    2609. $v = strpos($v,':') ? $this->expandQname($v) : $v;
    2610. -
    2611. $eAttrs[$k] = $v;
    2612. -
    2613. }
    2614. -
    2615. $attrs = $eAttrs;
    2616. -
    2617. } else {
    2618. -
    2619. $attrs = array();
    2620. -
    2621. }
    2622. -
    2623. // find status, register data
    2624. -
    2625. switch($name){
    2626. -
    2627. case 'all': // (optional) compositor content for a complexType
    2628. -
    2629. case 'choice':
    2630. -
    2631. case 'group':
    2632. -
    2633. case 'sequence':
    2634. -
    2635. //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement");
    2636. -
    2637. $this->complexTypes[$this->currentComplexType]['compositor'] = $name;
    2638. -
    2639. //if($name == 'all' || $name == 'sequence'){
    2640. -
    2641. // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
    2642. -
    2643. //}
    2644. -
    2645. break;
    2646. -
    2647. case 'attribute': // complexType attribute
    2648. -
    2649. //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']);
    2650. -
    2651. $this->xdebug("parsing attribute:");
    2652. -
    2653. $this->appendDebug($this->varDump($attrs));
    2654. -
    2655. if (!isset($attrs['form'])) {
    2656. -
    2657. // TODO: handle globals
    2658. -
    2659. $attrs['form'] = $this->schemaInfo['attributeFormDefault'];
    2660. -
    2661. }
    2662. -
    2663. if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
    2664. -
    2665. $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
    2666. -
    2667. if (!strpos($v, ':')) {
    2668. -
    2669. // no namespace in arrayType attribute value...
    2670. -
    2671. if ($this->defaultNamespace[$pos]) {
    2672. -
    2673. // ...so use the default
    2674. -
    2675. $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
    2676. -
    2677. }
    2678. -
    2679. }
    2680. -
    2681. }
    2682. -
    2683. if(isset($attrs['name'])){
    2684. -
    2685. $this->attributes[$attrs['name']] = $attrs;
    2686. -
    2687. $aname = $attrs['name'];
    2688. -
    2689. } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){
    2690. -
    2691. if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
    2692. -
    2693. $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
    2694. -
    2695. } else {
    2696. -
    2697. $aname = '';
    2698. -
    2699. }
    2700. -
    2701. } elseif(isset($attrs['ref'])){
    2702. -
    2703. $aname = $attrs['ref'];
    2704. -
    2705. $this->attributes[$attrs['ref']] = $attrs;
    2706. -
    2707. }
    2708. -
    2709. -
    2710. if($this->currentComplexType){ // This should *always* be
    2711. -
    2712. $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
    2713. -
    2714. }
    2715. -
    2716. // arrayType attribute
    2717. -
    2718. if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){
    2719. -
    2720. $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
    2721. -
    2722. $prefix = $this->getPrefix($aname);
    2723. -
    2724. if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){
    2725. -
    2726. $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
    2727. -
    2728. } else {
    2729. -
    2730. $v = '';
    2731. -
    2732. }
    2733. -
    2734. if(strpos($v,'[,]')){
    2735. -
    2736. $this->complexTypes[$this->currentComplexType]['multidimensional'] = true;
    2737. -
    2738. }
    2739. -
    2740. $v = substr($v,0,strpos($v,'[')); // clip the []
    2741. -
    2742. if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){
    2743. -
    2744. $v = $this->XMLSchemaVersion.':'.$v;
    2745. -
    2746. }
    2747. -
    2748. $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
    2749. -
    2750. }
    2751. -
    2752. break;
    2753. -
    2754. case 'complexContent': // (optional) content for a complexType
    2755. -
    2756. $this->xdebug("do nothing for element $name");
    2757. -
    2758. break;
    2759. -
    2760. case 'complexType':
    2761. -
    2762. array_push($this->complexTypeStack, $this->currentComplexType);
    2763. -
    2764. if(isset($attrs['name'])){
    2765. -
    2766. // TODO: what is the scope of named complexTypes that appear
    2767. -
    2768. // nested within other c complexTypes?
    2769. -
    2770. $this->xdebug('processing named complexType '.$attrs['name']);
    2771. -
    2772. //$this->currentElement = false;
    2773. -
    2774. $this->currentComplexType = $attrs['name'];
    2775. -
    2776. $this->complexTypes[$this->currentComplexType] = $attrs;
    2777. -
    2778. $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
    2779. -
    2780. // This is for constructs like
    2781. -
    2782. // <complexType name="ListOfString" base="soap:Array">
    2783. -
    2784. // <sequence>
    2785. -
    2786. // <element name="string" type="xsd:string"
    2787. -
    2788. // minOccurs="0" maxOccurs="unbounded" />
    2789. -
    2790. // </sequence>
    2791. -
    2792. // </complexType>
    2793. -
    2794. if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
    2795. -
    2796. $this->xdebug('complexType is unusual array');
    2797. -
    2798. $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
    2799. -
    2800. } else {
    2801. -
    2802. $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
    2803. -
    2804. }
    2805. -
    2806. } else {
    2807. -
    2808. $name = $this->CreateTypeName($this->currentElement);
    2809. -
    2810. $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name);
    2811. -
    2812. $this->currentComplexType = $name;
    2813. -
    2814. //$this->currentElement = false;
    2815. -
    2816. $this->complexTypes[$this->currentComplexType] = $attrs;
    2817. -
    2818. $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
    2819. -
    2820. // This is for constructs like
    2821. -
    2822. // <complexType name="ListOfString" base="soap:Array">
    2823. -
    2824. // <sequence>
    2825. -
    2826. // <element name="string" type="xsd:string"
    2827. -
    2828. // minOccurs="0" maxOccurs="unbounded" />
    2829. -
    2830. // </sequence>
    2831. -
    2832. // </complexType>
    2833. -
    2834. if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
    2835. -
    2836. $this->xdebug('complexType is unusual array');
    2837. -
    2838. $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
    2839. -
    2840. } else {
    2841. -
    2842. $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
    2843. -
    2844. }
    2845. -
    2846. }
    2847. -
    2848. $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false';
    2849. -
    2850. break;
    2851. -
    2852. case 'element':
    2853. -
    2854. array_push($this->elementStack, $this->currentElement);
    2855. -
    2856. if (!isset($attrs['form'])) {
    2857. -
    2858. if ($this->currentComplexType) {
    2859. -
    2860. $attrs['form'] = $this->schemaInfo['elementFormDefault'];
    2861. -
    2862. } else {
    2863. -
    2864. // global
    2865. -
    2866. $attrs['form'] = 'qualified';
    2867. -
    2868. }
    2869. -
    2870. }
    2871. -
    2872. if(isset($attrs['type'])){
    2873. -
    2874. $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
    2875. -
    2876. if (! $this->getPrefix($attrs['type'])) {
    2877. -
    2878. if ($this->defaultNamespace[$pos]) {
    2879. -
    2880. $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
    2881. -
    2882. $this->xdebug('used default namespace to make type ' . $attrs['type']);
    2883. -
    2884. }
    2885. -
    2886. }
    2887. -
    2888. // This is for constructs like
    2889. -
    2890. // <complexType name="ListOfString" base="soap:Array">
    2891. -
    2892. // <sequence>
    2893. -
    2894. // <element name="string" type="xsd:string"
    2895. -
    2896. // minOccurs="0" maxOccurs="unbounded" />
    2897. -
    2898. // </sequence>
    2899. -
    2900. // </complexType>
    2901. -
    2902. if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
    2903. -
    2904. $this->xdebug('arrayType for unusual array is ' . $attrs['type']);
    2905. -
    2906. $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
    2907. -
    2908. }
    2909. -
    2910. $this->currentElement = $attrs['name'];
    2911. -
    2912. $ename = $attrs['name'];
    2913. -
    2914. } elseif(isset($attrs['ref'])){
    2915. -
    2916. $this->xdebug("processing element as ref to ".$attrs['ref']);
    2917. -
    2918. $this->currentElement = "ref to ".$attrs['ref'];
    2919. -
    2920. $ename = $this->getLocalPart($attrs['ref']);
    2921. -
    2922. } else {
    2923. -
    2924. $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']);
    2925. -
    2926. $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type);
    2927. -
    2928. $this->currentElement = $attrs['name'];
    2929. -
    2930. $attrs['type'] = $this->schemaTargetNamespace . ':' . $type;
    2931. -
    2932. $ename = $attrs['name'];
    2933. -
    2934. }
    2935. -
    2936. if (isset($ename) && $this->currentComplexType) {
    2937. -
    2938. $this->xdebug("add element $ename to complexType $this->currentComplexType");
    2939. -
    2940. $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
    2941. -
    2942. } elseif (!isset($attrs['ref'])) {
    2943. -
    2944. $this->xdebug("add element $ename to elements array");
    2945. -
    2946. $this->elements[ $attrs['name'] ] = $attrs;
    2947. -
    2948. $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
    2949. -
    2950. }
    2951. -
    2952. break;
    2953. -
    2954. case 'enumeration': // restriction value list member
    2955. -
    2956. $this->xdebug('enumeration ' . $attrs['value']);
    2957. -
    2958. if ($this->currentSimpleType) {
    2959. -
    2960. $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
    2961. -
    2962. } elseif ($this->currentComplexType) {
    2963. -
    2964. $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
    2965. -
    2966. }
    2967. -
    2968. break;
    2969. -
    2970. case 'extension': // simpleContent or complexContent type extension
    2971. -
    2972. $this->xdebug('extension ' . $attrs['base']);
    2973. -
    2974. if ($this->currentComplexType) {
    2975. -
    2976. $ns = $this->getPrefix($attrs['base']);
    2977. -
    2978. if ($ns == '') {
    2979. -
    2980. $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base'];
    2981. -
    2982. } else {
    2983. -
    2984. $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
    2985. -
    2986. }
    2987. -
    2988. } else {
    2989. -
    2990. $this->xdebug('no current complexType to set extensionBase');
    2991. -
    2992. }
    2993. -
    2994. break;
    2995. -
    2996. case 'import':
    2997. -
    2998. if (isset($attrs['schemaLocation'])) {
    2999. -
    3000. $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
    3001. -
    3002. $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
    3003. -
    3004. } else {
    3005. -
    3006. $this->xdebug('import namespace ' . $attrs['namespace']);
    3007. -
    3008. $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
    3009. -
    3010. if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
    3011. -
    3012. $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
    3013. -
    3014. }
    3015. -
    3016. }
    3017. -
    3018. break;
    3019. -
    3020. case 'include':
    3021. -
    3022. if (isset($attrs['schemaLocation'])) {
    3023. -
    3024. $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']);
    3025. -
    3026. $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
    3027. -
    3028. } else {
    3029. -
    3030. $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute');
    3031. -
    3032. }
    3033. -
    3034. break;
    3035. -
    3036. case 'list': // simpleType value list
    3037. -
    3038. $this->xdebug("do nothing for element $name");
    3039. -
    3040. break;
    3041. -
    3042. case 'restriction': // simpleType, simpleContent or complexContent value restriction
    3043. -
    3044. $this->xdebug('restriction ' . $attrs['base']);
    3045. -
    3046. if($this->currentSimpleType){
    3047. -
    3048. $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
    3049. -
    3050. } elseif($this->currentComplexType){
    3051. -
    3052. $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
    3053. -
    3054. if(strstr($attrs['base'],':') == ':Array'){
    3055. -
    3056. $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
    3057. -
    3058. }
    3059. -
    3060. }
    3061. -
    3062. break;
    3063. -
    3064. case 'schema':
    3065. -
    3066. $this->schemaInfo = $attrs;
    3067. -
    3068. $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
    3069. -
    3070. if (isset($attrs['targetNamespace'])) {
    3071. -
    3072. $this->schemaTargetNamespace = $attrs['targetNamespace'];
    3073. -
    3074. }
    3075. -
    3076. if (!isset($attrs['elementFormDefault'])) {
    3077. -
    3078. $this->schemaInfo['elementFormDefault'] = 'unqualified';
    3079. -
    3080. }
    3081. -
    3082. if (!isset($attrs['attributeFormDefault'])) {
    3083. -
    3084. $this->schemaInfo['attributeFormDefault'] = 'unqualified';
    3085. -
    3086. }
    3087. -
    3088. break;
    3089. -
    3090. case 'simpleContent': // (optional) content for a complexType
    3091. -
    3092. if ($this->currentComplexType) { // This should *always* be
    3093. -
    3094. $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true';
    3095. -
    3096. } else {
    3097. -
    3098. $this->xdebug("do nothing for element $name because there is no current complexType");
    3099. -
    3100. }
    3101. -
    3102. break;
    3103. -
    3104. case 'simpleType':
    3105. -
    3106. array_push($this->simpleTypeStack, $this->currentSimpleType);
    3107. -
    3108. if(isset($attrs['name'])){
    3109. -
    3110. $this->xdebug("processing simpleType for name " . $attrs['name']);
    3111. -
    3112. $this->currentSimpleType = $attrs['name'];
    3113. -
    3114. $this->simpleTypes[ $attrs['name'] ] = $attrs;
    3115. -
    3116. $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
    3117. -
    3118. $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
    3119. -
    3120. } else {
    3121. -
    3122. $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement);
    3123. -
    3124. $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name);
    3125. -
    3126. $this->currentSimpleType = $name;
    3127. -
    3128. //$this->currentElement = false;
    3129. -
    3130. $this->simpleTypes[$this->currentSimpleType] = $attrs;
    3131. -
    3132. $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
    3133. -
    3134. }
    3135. -
    3136. break;
    3137. -
    3138. case 'union': // simpleType type list
    3139. -
    3140. $this->xdebug("do nothing for element $name");
    3141. -
    3142. break;
    3143. -
    3144. default:
    3145. -
    3146. $this->xdebug("do not have any logic to process element $name");
    3147. -
    3148. }
    3149. -
    3150. }
    3151. -
    3152.  
    3153. -
    3154. /**
    3155. -
    3156. * end-element handler
    3157. -
    3158. *
    3159. -
    3160. * @param string $parser XML parser object
    3161. -
    3162. * @param string $name element name
    3163. -
    3164. * @access private
    3165. -
    3166. */
    3167. -
    3168. function schemaEndElement($parser, $name) {
    3169. -
    3170. // bring depth down a notch
    3171. -
    3172. $this->depth--;
    3173. -
    3174. // position of current element is equal to the last value left in depth_array for my depth
    3175. -
    3176. if(isset($this->depth_array[$this->depth])){
    3177. -
    3178. $pos = $this->depth_array[$this->depth];
    3179. -
    3180. }
    3181. -
    3182. // get element prefix
    3183. -
    3184. if ($prefix = $this->getPrefix($name)){
    3185. -
    3186. // get unqualified name
    3187. -
    3188. $name = $this->getLocalPart($name);
    3189. -
    3190. } else {
    3191. -
    3192. $prefix = '';
    3193. -
    3194. }
    3195. -
    3196. // move on...
    3197. -
    3198. if($name == 'complexType'){
    3199. -
    3200. $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
    3201. -
    3202. $this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType]));
    3203. -
    3204. $this->currentComplexType = array_pop($this->complexTypeStack);
    3205. -
    3206. //$this->currentElement = false;
    3207. -
    3208. }
    3209. -
    3210. if($name == 'element'){
    3211. -
    3212. $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)'));
    3213. -
    3214. $this->currentElement = array_pop($this->elementStack);
    3215. -
    3216. }
    3217. -
    3218. if($name == 'simpleType'){
    3219. -
    3220. $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
    3221. -
    3222. $this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType]));
    3223. -
    3224. $this->currentSimpleType = array_pop($this->simpleTypeStack);
    3225. -
    3226. }
    3227. -
    3228. }
    3229. -
    3230.  
    3231. -
    3232. /**
    3233. -
    3234. * element content handler
    3235. -
    3236. *
    3237. -
    3238. * @param string $parser XML parser object
    3239. -
    3240. * @param string $data element content
    3241. -
    3242. * @access private
    3243. -
    3244. */
    3245. -
    3246. function schemaCharacterData($parser, $data){
    3247. -
    3248. $pos = $this->depth_array[$this->depth - 1];
    3249. -
    3250. $this->message[$pos]['cdata'] .= $data;
    3251. -
    3252. }
    3253. -
    3254.  
    3255. -
    3256. /**
    3257. -
    3258. * serialize the schema
    3259. -
    3260. *
    3261. -
    3262. * @access public
    3263. -
    3264. */
    3265. -
    3266. function serializeSchema(){
    3267. -
    3268.  
    3269. -
    3270. $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
    3271. -
    3272. $xml = '';
    3273. -
    3274. // imports
    3275. -
    3276. if (sizeof($this->imports) > 0) {
    3277. -
    3278. foreach($this->imports as $ns => $list) {
    3279. -
    3280. foreach ($list as $ii) {
    3281. -
    3282. if ($ii['location'] != '') {
    3283. -
    3284. $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n";
    3285. -
    3286. } else {
    3287. -
    3288. $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
    3289. -
    3290. }
    3291. -
    3292. }
    3293. -
    3294. }
    3295. -
    3296. }
    3297. -
    3298. // complex types
    3299. -
    3300. foreach($this->complexTypes as $typeName => $attrs){
    3301. -
    3302. $contentStr = '';
    3303. -
    3304. // serialize child elements
    3305. -
    3306. if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){
    3307. -
    3308. foreach($attrs['elements'] as $element => $eParts){
    3309. -
    3310. if(isset($eParts['ref'])){
    3311. -
    3312. $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n";
    3313. -
    3314. } else {
    3315. -
    3316. $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"";
    3317. -
    3318. foreach ($eParts as $aName => $aValue) {
    3319. -
    3320. // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable
    3321. -
    3322. if ($aName != 'name' && $aName != 'type') {
    3323. -
    3324. $contentStr .= " $aName=\"$aValue\"";
    3325. -
    3326. }
    3327. -
    3328. }
    3329. -
    3330. $contentStr .= "/>\n";
    3331. -
    3332. }
    3333. -
    3334. }
    3335. -
    3336. // compositor wraps elements
    3337. -
    3338. if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) {
    3339. -
    3340. $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." </$schemaPrefix:$attrs[compositor]>\n";
    3341. -
    3342. }
    3343. -
    3344. }
    3345. -
    3346. // attributes
    3347. -
    3348. if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){
    3349. -
    3350. foreach($attrs['attrs'] as $attr => $aParts){
    3351. -
    3352. $contentStr .= " <$schemaPrefix:attribute";
    3353. -
    3354. foreach ($aParts as $a => $v) {
    3355. -
    3356. if ($a == 'ref' || $a == 'type') {
    3357. -
    3358. $contentStr .= " $a=\"".$this->contractQName($v).'"';
    3359. -
    3360. } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') {
    3361. -
    3362. $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl'];
    3363. -
    3364. $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"';
    3365. -
    3366. } else {
    3367. -
    3368. $contentStr .= " $a=\"$v\"";
    3369. -
    3370. }
    3371. -
    3372. }
    3373. -
    3374. $contentStr .= "/>\n";
    3375. -
    3376. }
    3377. -
    3378. }
    3379. -
    3380. // if restriction
    3381. -
    3382. if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){
    3383. -
    3384. $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." </$schemaPrefix:restriction>\n";
    3385. -
    3386. // complex or simple content
    3387. -
    3388. if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){
    3389. -
    3390. $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." </$schemaPrefix:complexContent>\n";
    3391. -
    3392. }
    3393. -
    3394. }
    3395. -
    3396. // finalize complex type
    3397. -
    3398. if($contentStr != ''){
    3399. -
    3400. $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n";
    3401. -
    3402. } else {
    3403. -
    3404. $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n";
    3405. -
    3406. }
    3407. -
    3408. $xml .= $contentStr;
    3409. -
    3410. }
    3411. -
    3412. // simple types
    3413. -
    3414. if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
    3415. -
    3416. foreach($this->simpleTypes as $typeName => $eParts){
    3417. -
    3418. $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n";
    3419. -
    3420. if (isset($eParts['enumeration'])) {
    3421. -
    3422. foreach ($eParts['enumeration'] as $e) {
    3423. -
    3424. $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n";
    3425. -
    3426. }
    3427. -
    3428. }
    3429. -
    3430. $xml .= " </$schemaPrefix:restriction>\n </$schemaPrefix:simpleType>";
    3431. -
    3432. }
    3433. -
    3434. }
    3435. -
    3436. // elements
    3437. -
    3438. if(isset($this->elements) && count($this->elements) > 0){
    3439. -
    3440. foreach($this->elements as $element => $eParts){
    3441. -
    3442. $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n";
    3443. -
    3444. }
    3445. -
    3446. }
    3447. -
    3448. // attributes
    3449. -
    3450. if(isset($this->attributes) && count($this->attributes) > 0){
    3451. -
    3452. foreach($this->attributes as $attr => $aParts){
    3453. -
    3454. $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>";
    3455. -
    3456. }
    3457. -
    3458. }
    3459. -
    3460. // finish 'er up
    3461. -
    3462. $attr = '';
    3463. -
    3464. foreach ($this->schemaInfo as $k => $v) {
    3465. -
    3466. if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') {
    3467. -
    3468. $attr .= " $k=\"$v\"";
    3469. -
    3470. }
    3471. -
    3472. }
    3473. -
    3474. $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n";
    3475. -
    3476. foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
    3477. -
    3478. $el .= " xmlns:$nsp=\"$ns\"";
    3479. -
    3480. }
    3481. -
    3482. $xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n";
    3483. -
    3484. return $xml;
    3485. -
    3486. }
    3487. -
    3488.  
    3489. -
    3490. /**
    3491. -
    3492. * adds debug data to the clas level debug string
    3493. -
    3494. *
    3495. -
    3496. * @param string $string debug data
    3497. -
    3498. * @access private
    3499. -
    3500. */
    3501. -
    3502. function xdebug($string){
    3503. -
    3504. $this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
    3505. -
    3506. }
    3507. -
    3508.  
    3509. -
    3510. /**
    3511. -
    3512. * get the PHP type of a user defined type in the schema
    3513. -
    3514. * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays
    3515. -
    3516. * returns false if no type exists, or not w/ the given namespace
    3517. -
    3518. * else returns a string that is either a native php type, or 'struct'
    3519. -
    3520. *
    3521. -
    3522. * @param string $type name of defined type
    3523. -
    3524. * @param string $ns namespace of type
    3525. -
    3526. * @return mixed
    3527. -
    3528. * @access public
    3529. -
    3530. * @deprecated
    3531. -
    3532. */
    3533. -
    3534. function getPHPType($type,$ns){
    3535. -
    3536. if(isset($this->typemap[$ns][$type])){
    3537. -
    3538. //print "found type '$type' and ns $ns in typemap<br>";
    3539. -
    3540. return $this->typemap[$ns][$type];
    3541. -
    3542. } elseif(isset($this->complexTypes[$type])){
    3543. -
    3544. //print "getting type '$type' and ns $ns from complexTypes array<br>";
    3545. -
    3546. return $this->complexTypes[$type]['phpType'];
    3547. -
    3548. }
    3549. -
    3550. return false;
    3551. -
    3552. }
    3553. -
    3554.  
    3555. -
    3556. /**
    3557. -
    3558. * returns an associative array of information about a given type
    3559. -
    3560. * returns false if no type exists by the given name
    3561. -
    3562. *
    3563. -
    3564. * For a complexType typeDef = array(
    3565. -
    3566. * 'restrictionBase' => '',
    3567. -
    3568. * 'phpType' => '',
    3569. -
    3570. * 'compositor' => '(sequence|all)',
    3571. -
    3572. * 'elements' => array(), // refs to elements array
    3573. -
    3574. * 'attrs' => array() // refs to attributes array
    3575. -
    3576. * ... and so on (see addComplexType)
    3577. -
    3578. * )
    3579. -
    3580. *
    3581. -
    3582. * For simpleType or element, the array has different keys.
    3583. -
    3584. *
    3585. -
    3586. * @param string $type
    3587. -
    3588. * @return mixed
    3589. -
    3590. * @access public
    3591. -
    3592. * @see addComplexType
    3593. -
    3594. * @see addSimpleType
    3595. -
    3596. * @see addElement
    3597. -
    3598. */
    3599. -
    3600. function getTypeDef($type){
    3601. -
    3602. //$this->debug("in getTypeDef for type $type");
    3603. -
    3604. if (substr($type, -1) == '^') {
    3605. -
    3606. $is_element = 1;
    3607. -
    3608. $type = substr($type, 0, -1);
    3609. -
    3610. } else {
    3611. -
    3612. $is_element = 0;
    3613. -
    3614. }
    3615. -
    3616.  
    3617. -
    3618. if((! $is_element) && isset($this->complexTypes[$type])){
    3619. -
    3620. $this->xdebug("in getTypeDef, found complexType $type");
    3621. -
    3622. return $this->complexTypes[$type];
    3623. -
    3624. } elseif((! $is_element) && isset($this->simpleTypes[$type])){
    3625. -
    3626. $this->xdebug("in getTypeDef, found simpleType $type");
    3627. -
    3628. if (!isset($this->simpleTypes[$type]['phpType'])) {
    3629. -
    3630. // get info for type to tack onto the simple type
    3631. -
    3632. // TODO: can this ever really apply (i.e. what is a simpleType really?)
    3633. -
    3634. $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1);
    3635. -
    3636. $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':'));
    3637. -
    3638. $etype = $this->getTypeDef($uqType);
    3639. -
    3640. if ($etype) {
    3641. -
    3642. $this->xdebug("in getTypeDef, found type for simpleType $type:");
    3643. -
    3644. $this->xdebug($this->varDump($etype));
    3645. -
    3646. if (isset($etype['phpType'])) {
    3647. -
    3648. $this->simpleTypes[$type]['phpType'] = $etype['phpType'];
    3649. -
    3650. }
    3651. -
    3652. if (isset($etype['elements'])) {
    3653. -
    3654. $this->simpleTypes[$type]['elements'] = $etype['elements'];
    3655. -
    3656. }
    3657. -
    3658. }
    3659. -
    3660. }
    3661. -
    3662. return $this->simpleTypes[$type];
    3663. -
    3664. } elseif(isset($this->elements[$type])){
    3665. -
    3666. $this->xdebug("in getTypeDef, found element $type");
    3667. -
    3668. if (!isset($this->elements[$type]['phpType'])) {
    3669. -
    3670. // get info for type to tack onto the element
    3671. -
    3672. $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1);
    3673. -
    3674. $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':'));
    3675. -
    3676. $etype = $this->getTypeDef($uqType);
    3677. -
    3678. if ($etype) {
    3679. -
    3680. $this->xdebug("in getTypeDef, found type for element $type:");
    3681. -
    3682. $this->xdebug($this->varDump($etype));
    3683. -
    3684. if (isset($etype['phpType'])) {
    3685. -
    3686. $this->elements[$type]['phpType'] = $etype['phpType'];
    3687. -
    3688. }
    3689. -
    3690. if (isset($etype['elements'])) {
    3691. -
    3692. $this->elements[$type]['elements'] = $etype['elements'];
    3693. -
    3694. }
    3695. -
    3696. if (isset($etype['extensionBase'])) {
    3697. -
    3698. $this->elements[$type]['extensionBase'] = $etype['extensionBase'];
    3699. -
    3700. }
    3701. -
    3702. } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') {
    3703. -
    3704. $this->xdebug("in getTypeDef, element $type is an XSD type");
    3705. -
    3706. $this->elements[$type]['phpType'] = 'scalar';
    3707. -
    3708. }
    3709. -
    3710. }
    3711. -
    3712. return $this->elements[$type];
    3713. -
    3714. } elseif(isset($this->attributes[$type])){
    3715. -
    3716. $this->xdebug("in getTypeDef, found attribute $type");
    3717. -
    3718. return $this->attributes[$type];
    3719. -
    3720. } elseif (preg_match('/_ContainedType$/', $type)) {
    3721. -
    3722. $this->xdebug("in getTypeDef, have an untyped element $type");
    3723. -
    3724. $typeDef['typeClass'] = 'simpleType';
    3725. -
    3726. $typeDef['phpType'] = 'scalar';
    3727. -
    3728. $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string';
    3729. -
    3730. return $typeDef;
    3731. -
    3732. }
    3733. -
    3734. $this->xdebug("in getTypeDef, did not find $type");
    3735. -
    3736. return false;
    3737. -
    3738. }
    3739. -
    3740.  
    3741. -
    3742. /**
    3743. -
    3744. * returns a sample serialization of a given type, or false if no type by the given name
    3745. -
    3746. *
    3747. -
    3748. * @param string $type name of type
    3749. -
    3750. * @return mixed
    3751. -
    3752. * @access public
    3753. -
    3754. * @deprecated
    3755. -
    3756. */
    3757. -
    3758. function serializeTypeDef($type){
    3759. -
    3760. //print "in sTD() for type $type<br>";
    3761. -
    3762. if($typeDef = $this->getTypeDef($type)){
    3763. -
    3764. $str .= '<'.$type;
    3765. -
    3766. if(is_array($typeDef['attrs'])){
    3767. -
    3768. foreach($typeDef['attrs'] as $attName => $data){
    3769. -
    3770. $str .= " $attName=\"{type = ".$data['type']."}\"";
    3771. -
    3772. }
    3773. -
    3774. }
    3775. -
    3776. $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
    3777. -
    3778. if(count($typeDef['elements']) > 0){
    3779. -
    3780. $str .= ">";
    3781. -
    3782. foreach($typeDef['elements'] as $element => $eData){
    3783. -
    3784. $str .= $this->serializeTypeDef($element);
    3785. -
    3786. }
    3787. -
    3788. $str .= "</$type>";
    3789. -
    3790. } elseif($typeDef['typeClass'] == 'element') {
    3791. -
    3792. $str .= "></$type>";
    3793. -
    3794. } else {
    3795. -
    3796. $str .= "/>";
    3797. -
    3798. }
    3799. -
    3800. return $str;
    3801. -
    3802. }
    3803. -
    3804. return false;
    3805. -
    3806. }
    3807. -
    3808.  
    3809. -
    3810. /**
    3811. -
    3812. * returns HTML form elements that allow a user
    3813. -
    3814. * to enter values for creating an instance of the given type.
    3815. -
    3816. *
    3817. -
    3818. * @param string $name name for type instance
    3819. -
    3820. * @param string $type name of type
    3821. -
    3822. * @return string
    3823. -
    3824. * @access public
    3825. -
    3826. * @deprecated
    3827. -
    3828. */
    3829. -
    3830. function typeToForm($name,$type){
    3831. -
    3832. // get typedef
    3833. -
    3834. if($typeDef = $this->getTypeDef($type)){
    3835. -
    3836. // if struct
    3837. -
    3838. if($typeDef['phpType'] == 'struct'){
    3839. -
    3840. $buffer .= '<table>';
    3841. -
    3842. foreach($typeDef['elements'] as $child => $childDef){
    3843. -
    3844. $buffer .= "
    3845. -
    3846. <tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td>
    3847. -
    3848. <td><input type='text' name='parameters[".$name."][$childDef[name]]'></td></tr>";
    3849. -
    3850. }
    3851. -
    3852. $buffer .= '</table>';
    3853. -
    3854. // if array
    3855. -
    3856. } elseif($typeDef['phpType'] == 'array'){
    3857. -
    3858. $buffer .= '<table>';
    3859. -
    3860. for($i=0;$i < 3; $i++){
    3861. -
    3862. $buffer .= "
    3863. -
    3864. <tr><td align='right'>array item (type: $typeDef[arrayType]):</td>
    3865. -
    3866. <td><input type='text' name='parameters[".$name."][]'></td></tr>";
    3867. -
    3868. }
    3869. -
    3870. $buffer .= '</table>';
    3871. -
    3872. // if scalar
    3873. -
    3874. } else {
    3875. -
    3876. $buffer .= "<input type='text' name='parameters[$name]'>";
    3877. -
    3878. }
    3879. -
    3880. } else {
    3881. -
    3882. $buffer .= "<input type='text' name='parameters[$name]'>";
    3883. -
    3884. }
    3885. -
    3886. return $buffer;
    3887. -
    3888. }
    3889. -
    3890. -
    3891. /**
    3892. -
    3893. * adds a complex type to the schema
    3894. -
    3895. *
    3896. -
    3897. * example: array
    3898. -
    3899. *
    3900. -
    3901. * addType(
    3902. -
    3903. * 'ArrayOfstring',
    3904. -
    3905. * 'complexType',
    3906. -
    3907. * 'array',
    3908. -
    3909. * '',
    3910. -
    3911. * 'SOAP-ENC:Array',
    3912. -
    3913. * array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'),
    3914. -
    3915. * 'xsd:string'
    3916. -
    3917. * );
    3918. -
    3919. *
    3920. -
    3921. * example: PHP associative array ( SOAP Struct )
    3922. -
    3923. *
    3924. -
    3925. * addType(
    3926. -
    3927. * 'SOAPStruct',
    3928. -
    3929. * 'complexType',
    3930. -
    3931. * 'struct',
    3932. -
    3933. * 'all',
    3934. -
    3935. * array('myVar'=> array('name'=>'myVar','type'=>'string')
    3936. -
    3937. * );
    3938. -
    3939. *
    3940. -
    3941. * @param name
    3942. -
    3943. * @param typeClass (complexType|simpleType|attribute)
    3944. -
    3945. * @param phpType: currently supported are array and struct (php assoc array)
    3946. -
    3947. * @param compositor (all|sequence|choice)
    3948. -
    3949. * @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
    3950. -
    3951. * @param elements = array ( name = array(name=>'',type=>'') )
    3952. -
    3953. * @param attrs = array(
    3954. -
    3955. * array(
    3956. -
    3957. * 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType",
    3958. -
    3959. * "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]"
    3960. -
    3961. * )
    3962. -
    3963. * )
    3964. -
    3965. * @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
    3966. -
    3967. * @access public
    3968. -
    3969. * @see getTypeDef
    3970. -
    3971. */
    3972. -
    3973. function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){
    3974. -
    3975. $this->complexTypes[$name] = array(
    3976. -
    3977. 'name' => $name,
    3978. -
    3979. 'typeClass' => $typeClass,
    3980. -
    3981. 'phpType' => $phpType,
    3982. -
    3983. 'compositor'=> $compositor,
    3984. -
    3985. 'restrictionBase' => $restrictionBase,
    3986. -
    3987. 'elements' => $elements,
    3988. -
    3989. 'attrs' => $attrs,
    3990. -
    3991. 'arrayType' => $arrayType
    3992. -
    3993. );
    3994. -
    3995. -
    3996. $this->xdebug("addComplexType $name:");
    3997. -
    3998. $this->appendDebug($this->varDump($this->complexTypes[$name]));
    3999. -
    4000. }
    4001. -
    4002. -
    4003. /**
    4004. -
    4005. * adds a simple type to the schema
    4006. -
    4007. *
    4008. -
    4009. * @param string $name
    4010. -
    4011. * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
    4012. -
    4013. * @param string $typeClass (should always be simpleType)
    4014. -
    4015. * @param string $phpType (should always be scalar)
    4016. -
    4017. * @param array $enumeration array of values
    4018. -
    4019. * @access public
    4020. -
    4021. * @see nusoap_xmlschema
    4022. -
    4023. * @see getTypeDef
    4024. -
    4025. */
    4026. -
    4027. function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
    4028. -
    4029. $this->simpleTypes[$name] = array(
    4030. -
    4031. 'name' => $name,
    4032. -
    4033. 'typeClass' => $typeClass,
    4034. -
    4035. 'phpType' => $phpType,
    4036. -
    4037. 'type' => $restrictionBase,
    4038. -
    4039. 'enumeration' => $enumeration
    4040. -
    4041. );
    4042. -
    4043. -
    4044. $this->xdebug("addSimpleType $name:");
    4045. -
    4046. $this->appendDebug($this->varDump($this->simpleTypes[$name]));
    4047. -
    4048. }
    4049. -
    4050.  
    4051. -
    4052. /**
    4053. -
    4054. * adds an element to the schema
    4055. -
    4056. *
    4057. -
    4058. * @param array $attrs attributes that must include name and type
    4059. -
    4060. * @see nusoap_xmlschema
    4061. -
    4062. * @access public
    4063. -
    4064. */
    4065. -
    4066. function addElement($attrs) {
    4067. -
    4068. if (! $this->getPrefix($attrs['type'])) {
    4069. -
    4070. $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
    4071. -
    4072. }
    4073. -
    4074. $this->elements[ $attrs['name'] ] = $attrs;
    4075. -
    4076. $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
    4077. -
    4078. -
    4079. $this->xdebug("addElement " . $attrs['name']);
    4080. -
    4081. $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
    4082. -
    4083. }
    4084. -
    4085. }
    4086. -
    4087.  
    4088. -
    4089. /**
    4090. -
    4091. * Backward compatibility
    4092. -
    4093. */
    4094. -
    4095. class XMLSchema extends nusoap_xmlschema {
    4096. -
    4097. }
    4098. -
    4099.  
    4100. -
    4101. ?><?php
    4102. -
    4103.  
    4104. -
    4105.  
    4106. -
    4107.  
    4108. -
    4109. /**
    4110. -
    4111. * For creating serializable abstractions of native PHP types. This class
    4112. -
    4113. * allows element name/namespace, XSD type, and XML attributes to be
    4114. -
    4115. * associated with a value. This is extremely useful when WSDL is not
    4116. -
    4117. * used, but is also useful when WSDL is used with polymorphic types, including
    4118. -
    4119. * xsd:anyType and user-defined types.
    4120. -
    4121. *
    4122. -
    4123. * @author Dietrich Ayala <dietrich@ganx4.com>
    4124. -
    4125. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    4126. -
    4127. * @access public
    4128. -
    4129. */
    4130. -
    4131. class soapval extends nusoap_base {
    4132. -
    4133. /**
    4134. -
    4135. * The XML element name
    4136. -
    4137. *
    4138. -
    4139. * @var string
    4140. -
    4141. * @access private
    4142. -
    4143. */
    4144. -
    4145. var $name;
    4146. -
    4147. /**
    4148. -
    4149. * The XML type name (string or false)
    4150. -
    4151. *
    4152. -
    4153. * @var mixed
    4154. -
    4155. * @access private
    4156. -
    4157. */
    4158. -
    4159. var $type;
    4160. -
    4161. /**
    4162. -
    4163. * The PHP value
    4164. -
    4165. *
    4166. -
    4167. * @var mixed
    4168. -
    4169. * @access private
    4170. -
    4171. */
    4172. -
    4173. var $value;
    4174. -
    4175. /**
    4176. -
    4177. * The XML element namespace (string or false)
    4178. -
    4179. *
    4180. -
    4181. * @var mixed
    4182. -
    4183. * @access private
    4184. -
    4185. */
    4186. -
    4187. var $element_ns;
    4188. -
    4189. /**
    4190. -
    4191. * The XML type namespace (string or false)
    4192. -
    4193. *
    4194. -
    4195. * @var mixed
    4196. -
    4197. * @access private
    4198. -
    4199. */
    4200. -
    4201. var $type_ns;
    4202. -
    4203. /**
    4204. -
    4205. * The XML element attributes (array or false)
    4206. -
    4207. *
    4208. -
    4209. * @var mixed
    4210. -
    4211. * @access private
    4212. -
    4213. */
    4214. -
    4215. var $attributes;
    4216. -
    4217.  
    4218. -
    4219. /**
    4220. -
    4221. * constructor
    4222. -
    4223. *
    4224. -
    4225. * @param string $name optional name
    4226. -
    4227. * @param mixed $type optional type name
    4228. -
    4229. * @param mixed $value optional value
    4230. -
    4231. * @param mixed $element_ns optional namespace of value
    4232. -
    4233. * @param mixed $type_ns optional namespace of type
    4234. -
    4235. * @param mixed $attributes associative array of attributes to add to element serialization
    4236. -
    4237. * @access public
    4238. -
    4239. */
    4240. -
    4241. function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
    4242. -
    4243. parent::nusoap_base();
    4244. -
    4245. $this->name = $name;
    4246. -
    4247. $this->type = $type;
    4248. -
    4249. $this->value = $value;
    4250. -
    4251. $this->element_ns = $element_ns;
    4252. -
    4253. $this->type_ns = $type_ns;
    4254. -
    4255. $this->attributes = $attributes;
    4256. -
    4257. }
    4258. -
    4259.  
    4260. -
    4261. /**
    4262. -
    4263. * return serialized value
    4264. -
    4265. *
    4266. -
    4267. * @param string $use The WSDL use value (encoded|literal)
    4268. -
    4269. * @return string XML data
    4270. -
    4271. * @access public
    4272. -
    4273. */
    4274. -
    4275. function serialize($use='encoded') {
    4276. -
    4277. return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true);
    4278. -
    4279. }
    4280. -
    4281.  
    4282. -
    4283. /**
    4284. -
    4285. * decodes a soapval object into a PHP native type
    4286. -
    4287. *
    4288. -
    4289. * @return mixed
    4290. -
    4291. * @access public
    4292. -
    4293. */
    4294. -
    4295. function decode(){
    4296. -
    4297. return $this->value;
    4298. -
    4299. }
    4300. -
    4301. }
    4302. -
    4303.  
    4304. -
    4305.  
    4306. -
    4307.  
    4308. -
    4309. ?><?php
    4310. -
    4311.  
    4312. -
    4313.  
    4314. -
    4315.  
    4316. -
    4317. /**
    4318. -
    4319. * transport class for sending/receiving data via HTTP and HTTPS
    4320. -
    4321. * NOTE: PHP must be compiled with the CURL extension for HTTPS support
    4322. -
    4323. *
    4324. -
    4325. * @author Dietrich Ayala <dietrich@ganx4.com>
    4326. -
    4327. * @author Scott Nichol <snichol@users.sourceforge.net>
    4328. -
    4329. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    4330. -
    4331. * @access public
    4332. -
    4333. */
    4334. -
    4335. class soap_transport_http extends nusoap_base {
    4336. -
    4337.  
    4338. -
    4339. var $url = '';
    4340. -
    4341. var $uri = '';
    4342. -
    4343. var $digest_uri = '';
    4344. -
    4345. var $scheme = '';
    4346. -
    4347. var $host = '';
    4348. -
    4349. var $port = '';
    4350. -
    4351. var $path = '';
    4352. -
    4353. var $request_method = 'POST';
    4354. -
    4355. var $protocol_version = '1.0';
    4356. -
    4357. var $encoding = '';
    4358. -
    4359. var $outgoing_headers = array();
    4360. -
    4361. var $incoming_headers = array();
    4362. -
    4363. var $incoming_cookies = array();
    4364. -
    4365. var $outgoing_payload = '';
    4366. -
    4367. var $incoming_payload = '';
    4368. -
    4369. var $response_status_line; // HTTP response status line
    4370. -
    4371. -
    4372. var $useSOAPAction = true;
    4373. -
    4374. var $persistentConnection = false;
    4375. -
    4376. var $ch = false; // cURL handle
    4377. -
    4378. -
    4379. var $ch_options = array(); // cURL custom options
    4380. -
    4381. -
    4382. var $use_curl = false; // force cURL use
    4383. -
    4384. -
    4385. var $proxy = null; // proxy information (associative array)
    4386. -
    4387. -
    4388. var $username = '';
    4389. -
    4390. var $password = '';
    4391. -
    4392. var $authtype = '';
    4393. -
    4394. var $digestRequest = array();
    4395. -
    4396. var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
    4397. -
    4398. // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
    4399. -
    4400. // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
    4401. -
    4402. // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
    4403. -
    4404. // passphrase: SSL key password/passphrase
    4405. -
    4406. // certpassword: SSL certificate password
    4407. -
    4408. // verifypeer: default is 1
    4409. -
    4410. // verifyhost: default is 1
    4411. -
    4412.  
    4413. -
    4414. -
    4415.  
    4416. -
    4417. /**
    4418. -
    4419. * constructor
    4420. -
    4421. *
    4422. -
    4423. * @param string $url The URL to which to connect
    4424. -
    4425. * @param array $curl_options User-specified cURL options
    4426. -
    4427. * @param boolean $use_curl Whether to try to force cURL use
    4428. -
    4429. * @access public
    4430. -
    4431. */
    4432. -
    4433. function soap_transport_http($url, $curl_options = NULL, $use_curl = false){
    4434. -
    4435. parent::nusoap_base();
    4436. -
    4437. $this->debug("ctor url=$url use_curl=$use_curl curl_options:");
    4438. -
    4439. $this->appendDebug($this->varDump($curl_options));
    4440. -
    4441. $this->setURL($url);
    4442. -
    4443. if (is_array($curl_options)) {
    4444. -
    4445. $this->ch_options = $curl_options;
    4446. -
    4447. }
    4448. -
    4449. $this->use_curl = $use_curl;
    4450. -
    4451. preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
    4452. -
    4453. $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
    4454. -
    4455. }
    4456. -
    4457.  
    4458. -
    4459. /**
    4460. -
    4461. * sets a cURL option
    4462. -
    4463. *
    4464. -
    4465. * @param mixed $option The cURL option (always integer?)
    4466. -
    4467. * @param mixed $value The cURL option value
    4468. -
    4469. * @access private
    4470. -
    4471. */
    4472. -
    4473. function setCurlOption($option, $value) {
    4474. -
    4475. $this->debug("setCurlOption option=$option, value=");
    4476. -
    4477. $this->appendDebug($this->varDump($value));
    4478. -
    4479. curl_setopt($this->ch, $option, $value);
    4480. -
    4481. }
    4482. -
    4483.  
    4484. -
    4485. /**
    4486. -
    4487. * sets an HTTP header
    4488. -
    4489. *
    4490. -
    4491. * @param string $name The name of the header
    4492. -
    4493. * @param string $value The value of the header
    4494. -
    4495. * @access private
    4496. -
    4497. */
    4498. -
    4499. function setHeader($name, $value) {
    4500. -
    4501. $this->outgoing_headers[$name] = $value;
    4502. -
    4503. $this->debug("set header $name: $value");
    4504. -
    4505. }
    4506. -
    4507.  
    4508. -
    4509. /**
    4510. -
    4511. * unsets an HTTP header
    4512. -
    4513. *
    4514. -
    4515. * @param string $name The name of the header
    4516. -
    4517. * @access private
    4518. -
    4519. */
    4520. -
    4521. function unsetHeader($name) {
    4522. -
    4523. if (isset($this->outgoing_headers[$name])) {
    4524. -
    4525. $this->debug("unset header $name");
    4526. -
    4527. unset($this->outgoing_headers[$name]);
    4528. -
    4529. }
    4530. -
    4531. }
    4532. -
    4533.  
    4534. -
    4535. /**
    4536. -
    4537. * sets the URL to which to connect
    4538. -
    4539. *
    4540. -
    4541. * @param string $url The URL to which to connect
    4542. -
    4543. * @access private
    4544. -
    4545. */
    4546. -
    4547. function setURL($url) {
    4548. -
    4549. $this->url = $url;
    4550. -
    4551.  
    4552. -
    4553. $u = parse_url($url);
    4554. -
    4555. foreach($u as $k => $v){
    4556. -
    4557. $this->debug("parsed URL $k = $v");
    4558. -
    4559. $this->$k = $v;
    4560. -
    4561. }
    4562. -
    4563. -
    4564. // add any GET params to path
    4565. -
    4566. if(isset($u['query']) && $u['query'] != ''){
    4567. -
    4568. $this->path .= '?' . $u['query'];
    4569. -
    4570. }
    4571. -
    4572. -
    4573. // set default port
    4574. -
    4575. if(!isset($u['port'])){
    4576. -
    4577. if($u['scheme'] == 'https'){
    4578. -
    4579. $this->port = 443;
    4580. -
    4581. } else {
    4582. -
    4583. $this->port = 80;
    4584. -
    4585. }
    4586. -
    4587. }
    4588. -
    4589. -
    4590. $this->uri = $this->path;
    4591. -
    4592. $this->digest_uri = $this->uri;
    4593. -
    4594. -
    4595. // build headers
    4596. -
    4597. if (!isset($u['port'])) {
    4598. -
    4599. $this->setHeader('Host', $this->host);
    4600. -
    4601. } else {
    4602. -
    4603. $this->setHeader('Host', $this->host.':'.$this->port);
    4604. -
    4605. }
    4606. -
    4607.  
    4608. -
    4609. if (isset($u['user']) && $u['user'] != '') {
    4610. -
    4611. $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : '');
    4612. -
    4613. }
    4614. -
    4615. }
    4616. -
    4617.  
    4618. -
    4619. /**
    4620. -
    4621. * gets the I/O method to use
    4622. -
    4623. *
    4624. -
    4625. * @return string I/O method to use (socket|curl|unknown)
    4626. -
    4627. * @access private
    4628. -
    4629. */
    4630. -
    4631. function io_method() {
    4632. -
    4633. if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm'))
    4634. -
    4635. return 'curl';
    4636. -
    4637. if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm'))
    4638. -
    4639. return 'socket';
    4640. -
    4641. return 'unknown';
    4642. -
    4643. }
    4644. -
    4645.  
    4646. -
    4647. /**
    4648. -
    4649. * establish an HTTP connection
    4650. -
    4651. *
    4652. -
    4653. * @param integer $timeout set connection timeout in seconds
    4654. -
    4655. * @param integer $response_timeout set response timeout in seconds
    4656. -
    4657. * @return boolean true if connected, false if not
    4658. -
    4659. * @access private
    4660. -
    4661. */
    4662. -
    4663. function connect($connection_timeout=0,$response_timeout=30){
    4664. -
    4665. // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
    4666. -
    4667. // "regular" socket.
    4668. -
    4669. // TODO: disabled for now because OpenSSL must be *compiled* in (not just
    4670. -
    4671. // loaded), and until PHP5 stream_get_wrappers is not available.
    4672. -
    4673. // if ($this->scheme == 'https') {
    4674. -
    4675. // if (version_compare(phpversion(), '4.3.0') >= 0) {
    4676. -
    4677. // if (extension_loaded('openssl')) {
    4678. -
    4679. // $this->scheme = 'ssl';
    4680. -
    4681. // $this->debug('Using SSL over OpenSSL');
    4682. -
    4683. // }
    4684. -
    4685. // }
    4686. -
    4687. // }
    4688. -
    4689. $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
    4690. -
    4691. if ($this->io_method() == 'socket') {
    4692. -
    4693. if (!is_array($this->proxy)) {
    4694. -
    4695. $host = $this->host;
    4696. -
    4697. $port = $this->port;
    4698. -
    4699. } else {
    4700. -
    4701. $host = $this->proxy['host'];
    4702. -
    4703. $port = $this->proxy['port'];
    4704. -
    4705. }
    4706. -
    4707.  
    4708. -
    4709. // use persistent connection
    4710. -
    4711. if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
    4712. -
    4713. if (!feof($this->fp)) {
    4714. -
    4715. $this->debug('Re-use persistent connection');
    4716. -
    4717. return true;
    4718. -
    4719. }
    4720. -
    4721. fclose($this->fp);
    4722. -
    4723. $this->debug('Closed persistent connection at EOF');
    4724. -
    4725. }
    4726. -
    4727.  
    4728. -
    4729. // munge host if using OpenSSL
    4730. -
    4731. if ($this->scheme == 'ssl') {
    4732. -
    4733. $host = 'ssl://' . $host;
    4734. -
    4735. }
    4736. -
    4737. $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
    4738. -
    4739.  
    4740. -
    4741. // open socket
    4742. -
    4743. if($connection_timeout > 0){
    4744. -
    4745. $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
    4746. -
    4747. } else {
    4748. -
    4749. $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
    4750. -
    4751. }
    4752. -
    4753. -
    4754. // test pointer
    4755. -
    4756. if(!$this->fp) {
    4757. -
    4758. $msg = 'Couldn\'t open socket connection to server ' . $this->url;
    4759. -
    4760. if ($this->errno) {
    4761. -
    4762. $msg .= ', Error ('.$this->errno.'): '.$this->error_str;
    4763. -
    4764. } else {
    4765. -
    4766. $msg .= ' prior to connect(). This is often a problem looking up the host name.';
    4767. -
    4768. }
    4769. -
    4770. $this->debug($msg);
    4771. -
    4772. $this->setError($msg);
    4773. -
    4774. return false;
    4775. -
    4776. }
    4777. -
    4778. -
    4779. // set response timeout
    4780. -
    4781. $this->debug('set response timeout to ' . $response_timeout);
    4782. -
    4783. socket_set_timeout( $this->fp, $response_timeout);
    4784. -
    4785.  
    4786. -
    4787. $this->debug('socket connected');
    4788. -
    4789. return true;
    4790. -
    4791. } else if ($this->io_method() == 'curl') {
    4792. -
    4793. if (!extension_loaded('curl')) {
    4794. -
    4795. // $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
    4796. -
    4797. $this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to include cURL or change php.ini to load the PHP cURL extension.');
    4798. -
    4799. return false;
    4800. -
    4801. }
    4802. -
    4803. // Avoid warnings when PHP does not have these options
    4804. -
    4805. if (defined('CURLOPT_CONNECTIONTIMEOUT'))
    4806. -
    4807. $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT;
    4808. -
    4809. else
    4810. -
    4811. $CURLOPT_CONNECTIONTIMEOUT = 78;
    4812. -
    4813. if (defined('CURLOPT_HTTPAUTH'))
    4814. -
    4815. $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH;
    4816. -
    4817. else
    4818. -
    4819. $CURLOPT_HTTPAUTH = 107;
    4820. -
    4821. if (defined('CURLOPT_PROXYAUTH'))
    4822. -
    4823. $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH;
    4824. -
    4825. else
    4826. -
    4827. $CURLOPT_PROXYAUTH = 111;
    4828. -
    4829. if (defined('CURLAUTH_BASIC'))
    4830. -
    4831. $CURLAUTH_BASIC = CURLAUTH_BASIC;
    4832. -
    4833. else
    4834. -
    4835. $CURLAUTH_BASIC = 1;
    4836. -
    4837. if (defined('CURLAUTH_DIGEST'))
    4838. -
    4839. $CURLAUTH_DIGEST = CURLAUTH_DIGEST;
    4840. -
    4841. else
    4842. -
    4843. $CURLAUTH_DIGEST = 2;
    4844. -
    4845. if (defined('CURLAUTH_NTLM'))
    4846. -
    4847. $CURLAUTH_NTLM = CURLAUTH_NTLM;
    4848. -
    4849. else
    4850. -
    4851. $CURLAUTH_NTLM = 8;
    4852. -
    4853.  
    4854. -
    4855. $this->debug('connect using cURL');
    4856. -
    4857. // init CURL
    4858. -
    4859. $this->ch = curl_init();
    4860. -
    4861. // set url
    4862. -
    4863. $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host";
    4864. -
    4865. // add path
    4866. -
    4867. $hostURL .= $this->path;
    4868. -
    4869. $this->setCurlOption(CURLOPT_URL, $hostURL);
    4870. -
    4871. // follow location headers (re-directs)
    4872. -
    4873. if (ini_get('safe_mode') || ini_get('open_basedir')) {
    4874. -
    4875. $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION');
    4876. -
    4877. $this->debug('safe_mode = ');
    4878. -
    4879. $this->appendDebug($this->varDump(ini_get('safe_mode')));
    4880. -
    4881. $this->debug('open_basedir = ');
    4882. -
    4883. $this->appendDebug($this->varDump(ini_get('open_basedir')));
    4884. -
    4885. } else {
    4886. -
    4887. $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1);
    4888. -
    4889. }
    4890. -
    4891. // ask for headers in the response output
    4892. -
    4893. $this->setCurlOption(CURLOPT_HEADER, 1);
    4894. -
    4895. // ask for the response output as the return value
    4896. -
    4897. $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1);
    4898. -
    4899. // encode
    4900. -
    4901. // We manage this ourselves through headers and encoding
    4902. -
    4903. // if(function_exists('gzuncompress')){
    4904. -
    4905. // $this->setCurlOption(CURLOPT_ENCODING, 'deflate');
    4906. -
    4907. // }
    4908. -
    4909. // persistent connection
    4910. -
    4911. if ($this->persistentConnection) {
    4912. -
    4913. // I believe the following comment is now bogus, having applied to
    4914. -
    4915. // the code when it used CURLOPT_CUSTOMREQUEST to send the request.
    4916. -
    4917. // The way we send data, we cannot use persistent connections, since
    4918. -
    4919. // there will be some "junk" at the end of our request.
    4920. -
    4921. //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true);
    4922. -
    4923. $this->persistentConnection = false;
    4924. -
    4925. $this->setHeader('Connection', 'close');
    4926. -
    4927. }
    4928. -
    4929. // set timeouts
    4930. -
    4931. if ($connection_timeout != 0) {
    4932. -
    4933. $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout);
    4934. -
    4935. }
    4936. -
    4937. if ($response_timeout != 0) {
    4938. -
    4939. $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout);
    4940. -
    4941. }
    4942. -
    4943.  
    4944. -
    4945. if ($this->scheme == 'https') {
    4946. -
    4947. $this->debug('set cURL SSL verify options');
    4948. -
    4949. // recent versions of cURL turn on peer/host checking by default,
    4950. -
    4951. // while PHP binaries are not compiled with a default location for the
    4952. -
    4953. // CA cert bundle, so disable peer/host checking.
    4954. -
    4955. //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');
    4956. -
    4957. $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0);
    4958. -
    4959. $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0);
    4960. -
    4961. -
    4962. // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo)
    4963. -
    4964. if ($this->authtype == 'certificate') {
    4965. -
    4966. $this->debug('set cURL certificate options');
    4967. -
    4968. if (isset($this->certRequest['cainfofile'])) {
    4969. -
    4970. $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']);
    4971. -
    4972. }
    4973. -
    4974. if (isset($this->certRequest['verifypeer'])) {
    4975. -
    4976. $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']);
    4977. -
    4978. } else {
    4979. -
    4980. $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1);
    4981. -
    4982. }
    4983. -
    4984. if (isset($this->certRequest['verifyhost'])) {
    4985. -
    4986. $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
    4987. -
    4988. } else {
    4989. -
    4990. $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1);
    4991. -
    4992. }
    4993. -
    4994. if (isset($this->certRequest['sslcertfile'])) {
    4995. -
    4996. $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
    4997. -
    4998. }
    4999. -
    5000. if (isset($this->certRequest['sslkeyfile'])) {
    5001. -
    5002. $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']);
    5003. -
    5004. }
    5005. -
    5006. if (isset($this->certRequest['passphrase'])) {
    5007. -
    5008. $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']);
    5009. -
    5010. }
    5011. -
    5012. if (isset($this->certRequest['certpassword'])) {
    5013. -
    5014. $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']);
    5015. -
    5016. }
    5017. -
    5018. }
    5019. -
    5020. }
    5021. -
    5022. if ($this->authtype && ($this->authtype != 'certificate')) {
    5023. -
    5024. if ($this->username) {
    5025. -
    5026. $this->debug('set cURL username/password');
    5027. -
    5028. $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password");
    5029. -
    5030. }
    5031. -
    5032. if ($this->authtype == 'basic') {
    5033. -
    5034. $this->debug('set cURL for Basic authentication');
    5035. -
    5036. $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC);
    5037. -
    5038. }
    5039. -
    5040. if ($this->authtype == 'digest') {
    5041. -
    5042. $this->debug('set cURL for digest authentication');
    5043. -
    5044. $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST);
    5045. -
    5046. }
    5047. -
    5048. if ($this->authtype == 'ntlm') {
    5049. -
    5050. $this->debug('set cURL for NTLM authentication');
    5051. -
    5052. $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM);
    5053. -
    5054. }
    5055. -
    5056. }
    5057. -
    5058. if (is_array($this->proxy)) {
    5059. -
    5060. $this->debug('set cURL proxy options');
    5061. -
    5062. if ($this->proxy['port'] != '') {
    5063. -
    5064. $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']);
    5065. -
    5066. } else {
    5067. -
    5068. $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']);
    5069. -
    5070. }
    5071. -
    5072. if ($this->proxy['username'] || $this->proxy['password']) {
    5073. -
    5074. $this->debug('set cURL proxy authentication options');
    5075. -
    5076. $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']);
    5077. -
    5078. if ($this->proxy['authtype'] == 'basic') {
    5079. -
    5080. $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC);
    5081. -
    5082. }
    5083. -
    5084. if ($this->proxy['authtype'] == 'ntlm') {
    5085. -
    5086. $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM);
    5087. -
    5088. }
    5089. -
    5090. }
    5091. -
    5092. }
    5093. -
    5094. $this->debug('cURL connection set up');
    5095. -
    5096. return true;
    5097. -
    5098. } else {
    5099. -
    5100. $this->setError('Unknown scheme ' . $this->scheme);
    5101. -
    5102. $this->debug('Unknown scheme ' . $this->scheme);
    5103. -
    5104. return false;
    5105. -
    5106. }
    5107. -
    5108. }
    5109. -
    5110.  
    5111. -
    5112. /**
    5113. -
    5114. * sends the SOAP request and gets the SOAP response via HTTP[S]
    5115. -
    5116. *
    5117. -
    5118. * @param string $data message data
    5119. -
    5120. * @param integer $timeout set connection timeout in seconds
    5121. -
    5122. * @param integer $response_timeout set response timeout in seconds
    5123. -
    5124. * @param array $cookies cookies to send
    5125. -
    5126. * @return string data
    5127. -
    5128. * @access public
    5129. -
    5130. */
    5131. -
    5132. function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
    5133. -
    5134. -
    5135. $this->debug('entered send() with data of length: '.strlen($data));
    5136. -
    5137.  
    5138. -
    5139. $this->tryagain = true;
    5140. -
    5141. $tries = 0;
    5142. -
    5143. while ($this->tryagain) {
    5144. -
    5145. $this->tryagain = false;
    5146. -
    5147. if ($tries++ < 2) {
    5148. -
    5149. // make connnection
    5150. -
    5151. if (!$this->connect($timeout, $response_timeout)){
    5152. -
    5153. return false;
    5154. -
    5155. }
    5156. -
    5157. -
    5158. // send request
    5159. -
    5160. if (!$this->sendRequest($data, $cookies)){
    5161. -
    5162. return false;
    5163. -
    5164. }
    5165. -
    5166. -
    5167. // get response
    5168. -
    5169. $respdata = $this->getResponse();
    5170. -
    5171. } else {
    5172. -
    5173. $this->setError("Too many tries to get an OK response ($this->response_status_line)");
    5174. -
    5175. }
    5176. -
    5177. }
    5178. -
    5179. $this->debug('end of send()');
    5180. -
    5181. return $respdata;
    5182. -
    5183. }
    5184. -
    5185.  
    5186. -
    5187.  
    5188. -
    5189. /**
    5190. -
    5191. * sends the SOAP request and gets the SOAP response via HTTPS using CURL
    5192. -
    5193. *
    5194. -
    5195. * @param string $data message data
    5196. -
    5197. * @param integer $timeout set connection timeout in seconds
    5198. -
    5199. * @param integer $response_timeout set response timeout in seconds
    5200. -
    5201. * @param array $cookies cookies to send
    5202. -
    5203. * @return string data
    5204. -
    5205. * @access public
    5206. -
    5207. * @deprecated
    5208. -
    5209. */
    5210. -
    5211. function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
    5212. -
    5213. return $this->send($data, $timeout, $response_timeout, $cookies);
    5214. -
    5215. }
    5216. -
    5217. -
    5218. /**
    5219. -
    5220. * if authenticating, set user credentials here
    5221. -
    5222. *
    5223. -
    5224. * @param string $username
    5225. -
    5226. * @param string $password
    5227. -
    5228. * @param string $authtype (basic|digest|certificate|ntlm)
    5229. -
    5230. * @param array $digestRequest (keys must be nonce, nc, realm, qop)
    5231. -
    5232. * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
    5233. -
    5234. * @access public
    5235. -
    5236. */
    5237. -
    5238. function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) {
    5239. -
    5240. $this->debug("setCredentials username=$username authtype=$authtype digestRequest=");
    5241. -
    5242. $this->appendDebug($this->varDump($digestRequest));
    5243. -
    5244. $this->debug("certRequest=");
    5245. -
    5246. $this->appendDebug($this->varDump($certRequest));
    5247. -
    5248. // cf. RFC 2617
    5249. -
    5250. if ($authtype == 'basic') {
    5251. -
    5252. $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password));
    5253. -
    5254. } elseif ($authtype == 'digest') {
    5255. -
    5256. if (isset($digestRequest['nonce'])) {
    5257. -
    5258. $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
    5259. -
    5260. -
    5261. // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
    5262. -
    5263. -
    5264. // A1 = unq(username-value) ":" unq(realm-value) ":" passwd
    5265. -
    5266. $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
    5267. -
    5268. -
    5269. // H(A1) = MD5(A1)
    5270. -
    5271. $HA1 = md5($A1);
    5272. -
    5273. -
    5274. // A2 = Method ":" digest-uri-value
    5275. -
    5276. $A2 = $this->request_method . ':' . $this->digest_uri;
    5277. -
    5278. -
    5279. // H(A2)
    5280. -
    5281. $HA2 = md5($A2);
    5282. -
    5283. -
    5284. // KD(secret, data) = H(concat(secret, ":", data))
    5285. -
    5286. // if qop == auth:
    5287. -
    5288. // request-digest = <"> < KD ( H(A1), unq(nonce-value)
    5289. -
    5290. // ":" nc-value
    5291. -
    5292. // ":" unq(cnonce-value)
    5293. -
    5294. // ":" unq(qop-value)
    5295. -
    5296. // ":" H(A2)
    5297. -
    5298. // ) <">
    5299. -
    5300. // if qop is missing,
    5301. -
    5302. // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
    5303. -
    5304. -
    5305. $unhashedDigest = '';
    5306. -
    5307. $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
    5308. -
    5309. $cnonce = $nonce;
    5310. -
    5311. if ($digestRequest['qop'] != '') {
    5312. -
    5313. $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
    5314. -
    5315. } else {
    5316. -
    5317. $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
    5318. -
    5319. }
    5320. -
    5321. -
    5322. $hashedDigest = md5($unhashedDigest);
    5323. -
    5324. -
    5325. $opaque = '';
    5326. -
    5327. if (isset($digestRequest['opaque'])) {
    5328. -
    5329. $opaque = ', opaque="' . $digestRequest['opaque'] . '"';
    5330. -
    5331. }
    5332. -
    5333.  
    5334. -
    5335. $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"');
    5336. -
    5337. }
    5338. -
    5339. } elseif ($authtype == 'certificate') {
    5340. -
    5341. $this->certRequest = $certRequest;
    5342. -
    5343. $this->debug('Authorization header not set for certificate');
    5344. -
    5345. } elseif ($authtype == 'ntlm') {
    5346. -
    5347. // do nothing
    5348. -
    5349. $this->debug('Authorization header not set for ntlm');
    5350. -
    5351. }
    5352. -
    5353. $this->username = $username;
    5354. -
    5355. $this->password = $password;
    5356. -
    5357. $this->authtype = $authtype;
    5358. -
    5359. $this->digestRequest = $digestRequest;
    5360. -
    5361. }
    5362. -
    5363. -
    5364. /**
    5365. -
    5366. * set the soapaction value
    5367. -
    5368. *
    5369. -
    5370. * @param string $soapaction
    5371. -
    5372. * @access public
    5373. -
    5374. */
    5375. -
    5376. function setSOAPAction($soapaction) {
    5377. -
    5378. $this->setHeader('SOAPAction', '"' . $soapaction . '"');
    5379. -
    5380. }
    5381. -
    5382. -
    5383. /**
    5384. -
    5385. * use http encoding
    5386. -
    5387. *
    5388. -
    5389. * @param string $enc encoding style. supported values: gzip, deflate, or both
    5390. -
    5391. * @access public
    5392. -
    5393. */
    5394. -
    5395. function setEncoding($enc='gzip, deflate') {
    5396. -
    5397. if (function_exists('gzdeflate')) {
    5398. -
    5399. $this->protocol_version = '1.1';
    5400. -
    5401. $this->setHeader('Accept-Encoding', $enc);
    5402. -
    5403. if (!isset($this->outgoing_headers['Connection'])) {
    5404. -
    5405. $this->setHeader('Connection', 'close');
    5406. -
    5407. $this->persistentConnection = false;
    5408. -
    5409. }
    5410. -
    5411. // deprecated as of PHP 5.3.0
    5412. -
    5413. //set_magic_quotes_runtime(0);
    5414. -
    5415. $this->encoding = $enc;
    5416. -
    5417. }
    5418. -
    5419. }
    5420. -
    5421. -
    5422. /**
    5423. -
    5424. * set proxy info here
    5425. -
    5426. *
    5427. -
    5428. * @param string $proxyhost use an empty string to remove proxy
    5429. -
    5430. * @param string $proxyport
    5431. -
    5432. * @param string $proxyusername
    5433. -
    5434. * @param string $proxypassword
    5435. -
    5436. * @param string $proxyauthtype (basic|ntlm)
    5437. -
    5438. * @access public
    5439. -
    5440. */
    5441. -
    5442. function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') {
    5443. -
    5444. if ($proxyhost) {
    5445. -
    5446. $this->proxy = array(
    5447. -
    5448. 'host' => $proxyhost,
    5449. -
    5450. 'port' => $proxyport,
    5451. -
    5452. 'username' => $proxyusername,
    5453. -
    5454. 'password' => $proxypassword,
    5455. -
    5456. 'authtype' => $proxyauthtype
    5457. -
    5458. );
    5459. -
    5460. if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') {
    5461. -
    5462. $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword));
    5463. -
    5464. }
    5465. -
    5466. } else {
    5467. -
    5468. $this->debug('remove proxy');
    5469. -
    5470. $proxy = null;
    5471. -
    5472. unsetHeader('Proxy-Authorization');
    5473. -
    5474. }
    5475. -
    5476. }
    5477. -
    5478. -
    5479.  
    5480. -
    5481. /**
    5482. -
    5483. * Test if the given string starts with a header that is to be skipped.
    5484. -
    5485. * Skippable headers result from chunked transfer and proxy requests.
    5486. -
    5487. *
    5488. -
    5489. * @param string $data The string to check.
    5490. -
    5491. * @returns boolean Whether a skippable header was found.
    5492. -
    5493. * @access private
    5494. -
    5495. */
    5496. -
    5497. function isSkippableCurlHeader(&$data) {
    5498. -
    5499. $skipHeaders = array( 'HTTP/1.1 100',
    5500. -
    5501. 'HTTP/1.0 301',
    5502. -
    5503. 'HTTP/1.1 301',
    5504. -
    5505. 'HTTP/1.0 302',
    5506. -
    5507. 'HTTP/1.1 302',
    5508. -
    5509. 'HTTP/1.0 401',
    5510. -
    5511. 'HTTP/1.1 401',
    5512. -
    5513. 'HTTP/1.0 200 Connection established');
    5514. -
    5515. foreach ($skipHeaders as $hd) {
    5516. -
    5517. $prefix = substr($data, 0, strlen($hd));
    5518. -
    5519. if ($prefix == $hd) return true;
    5520. -
    5521. }
    5522. -
    5523.  
    5524. -
    5525. return false;
    5526. -
    5527. }
    5528. -
    5529.  
    5530. -
    5531. /**
    5532. -
    5533. * decode a string that is encoded w/ "chunked' transfer encoding
    5534. -
    5535. * as defined in RFC2068 19.4.6
    5536. -
    5537. *
    5538. -
    5539. * @param string $buffer
    5540. -
    5541. * @param string $lb
    5542. -
    5543. * @returns string
    5544. -
    5545. * @access public
    5546. -
    5547. * @deprecated
    5548. -
    5549. */
    5550. -
    5551. function decodeChunked($buffer, $lb){
    5552. -
    5553. // length := 0
    5554. -
    5555. $length = 0;
    5556. -
    5557. $new = '';
    5558. -
    5559. -
    5560. // read chunk-size, chunk-extension (if any) and CRLF
    5561. -
    5562. // get the position of the linebreak
    5563. -
    5564. $chunkend = strpos($buffer, $lb);
    5565. -
    5566. if ($chunkend == FALSE) {
    5567. -
    5568. $this->debug('no linebreak found in decodeChunked');
    5569. -
    5570. return $new;
    5571. -
    5572. }
    5573. -
    5574. $temp = substr($buffer,0,$chunkend);
    5575. -
    5576. $chunk_size = hexdec( trim($temp) );
    5577. -
    5578. $chunkstart = $chunkend + strlen($lb);
    5579. -
    5580. // while (chunk-size > 0) {
    5581. -
    5582. while ($chunk_size > 0) {
    5583. -
    5584. $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
    5585. -
    5586. $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
    5587. -
    5588. -
    5589. // Just in case we got a broken connection
    5590. -
    5591. if ($chunkend == FALSE) {
    5592. -
    5593. $chunk = substr($buffer,$chunkstart);
    5594. -
    5595. // append chunk-data to entity-body
    5596. -
    5597. $new .= $chunk;
    5598. -
    5599. $length += strlen($chunk);
    5600. -
    5601. break;
    5602. -
    5603. }
    5604. -
    5605. -
    5606. // read chunk-data and CRLF
    5607. -
    5608. $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
    5609. -
    5610. // append chunk-data to entity-body
    5611. -
    5612. $new .= $chunk;
    5613. -
    5614. // length := length + chunk-size
    5615. -
    5616. $length += strlen($chunk);
    5617. -
    5618. // read chunk-size and CRLF
    5619. -
    5620. $chunkstart = $chunkend + strlen($lb);
    5621. -
    5622. -
    5623. $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
    5624. -
    5625. if ($chunkend == FALSE) {
    5626. -
    5627. break; //Just in case we got a broken connection
    5628. -
    5629. }
    5630. -
    5631. $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
    5632. -
    5633. $chunk_size = hexdec( trim($temp) );
    5634. -
    5635. $chunkstart = $chunkend;
    5636. -
    5637. }
    5638. -
    5639. return $new;
    5640. -
    5641. }
    5642. -
    5643. -
    5644. /**
    5645. -
    5646. * Writes the payload, including HTTP headers, to $this->outgoing_payload.
    5647. -
    5648. *
    5649. -
    5650. * @param string $data HTTP body
    5651. -
    5652. * @param string $cookie_str data for HTTP Cookie header
    5653. -
    5654. * @return void
    5655. -
    5656. * @access private
    5657. -
    5658. */
    5659. -
    5660. function buildPayload($data, $cookie_str = '') {
    5661. -
    5662. // Note: for cURL connections, $this->outgoing_payload is ignored,
    5663. -
    5664. // as is the Content-Length header, but these are still created as
    5665. -
    5666. // debugging guides.
    5667. -
    5668.  
    5669. -
    5670. // add content-length header
    5671. -
    5672. if ($this->request_method != 'GET') {
    5673. -
    5674. $this->setHeader('Content-Length', strlen($data));
    5675. -
    5676. }
    5677. -
    5678.  
    5679. -
    5680. // start building outgoing payload:
    5681. -
    5682. if ($this->proxy) {
    5683. -
    5684. $uri = $this->url;
    5685. -
    5686. } else {
    5687. -
    5688. $uri = $this->uri;
    5689. -
    5690. }
    5691. -
    5692. $req = "$this->request_method $uri HTTP/$this->protocol_version";
    5693. -
    5694. $this->debug("HTTP request: $req");
    5695. -
    5696. $this->outgoing_payload = "$req\r\n";
    5697. -
    5698.  
    5699. -
    5700. // loop thru headers, serializing
    5701. -
    5702. foreach($this->outgoing_headers as $k => $v){
    5703. -
    5704. $hdr = $k.': '.$v;
    5705. -
    5706. $this->debug("HTTP header: $hdr");
    5707. -
    5708. $this->outgoing_payload .= "$hdr\r\n";
    5709. -
    5710. }
    5711. -
    5712.  
    5713. -
    5714. // add any cookies
    5715. -
    5716. if ($cookie_str != '') {
    5717. -
    5718. $hdr = 'Cookie: '.$cookie_str;
    5719. -
    5720. $this->debug("HTTP header: $hdr");
    5721. -
    5722. $this->outgoing_payload .= "$hdr\r\n";
    5723. -
    5724. }
    5725. -
    5726.  
    5727. -
    5728. // header/body separator
    5729. -
    5730. $this->outgoing_payload .= "\r\n";
    5731. -
    5732. -
    5733. // add data
    5734. -
    5735. $this->outgoing_payload .= $data;
    5736. -
    5737. }
    5738. -
    5739.  
    5740. -
    5741. /**
    5742. -
    5743. * sends the SOAP request via HTTP[S]
    5744. -
    5745. *
    5746. -
    5747. * @param string $data message data
    5748. -
    5749. * @param array $cookies cookies to send
    5750. -
    5751. * @return boolean true if OK, false if problem
    5752. -
    5753. * @access private
    5754. -
    5755. */
    5756. -
    5757. function sendRequest($data, $cookies = NULL) {
    5758. -
    5759. // build cookie string
    5760. -
    5761. $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https')));
    5762. -
    5763.  
    5764. -
    5765. // build payload
    5766. -
    5767. $this->buildPayload($data, $cookie_str);
    5768. -
    5769.  
    5770. -
    5771. if ($this->io_method() == 'socket') {
    5772. -
    5773. // send payload
    5774. -
    5775. if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
    5776. -
    5777. $this->setError('couldn\'t write message data to socket');
    5778. -
    5779. $this->debug('couldn\'t write message data to socket');
    5780. -
    5781. return false;
    5782. -
    5783. }
    5784. -
    5785. $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
    5786. -
    5787. return true;
    5788. -
    5789. } else if ($this->io_method() == 'curl') {
    5790. -
    5791. // set payload
    5792. -
    5793. // cURL does say this should only be the verb, and in fact it
    5794. -
    5795. // turns out that the URI and HTTP version are appended to this, which
    5796. -
    5797. // some servers refuse to work with (so we no longer use this method!)
    5798. -
    5799. //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
    5800. -
    5801. $curl_headers = array();
    5802. -
    5803. foreach($this->outgoing_headers as $k => $v){
    5804. -
    5805. if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') {
    5806. -
    5807. $this->debug("Skip cURL header $k: $v");
    5808. -
    5809. } else {
    5810. -
    5811. $curl_headers[] = "$k: $v";
    5812. -
    5813. }
    5814. -
    5815. }
    5816. -
    5817. if ($cookie_str != '') {
    5818. -
    5819. $curl_headers[] = 'Cookie: ' . $cookie_str;
    5820. -
    5821. }
    5822. -
    5823. $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers);
    5824. -
    5825. $this->debug('set cURL HTTP headers');
    5826. -
    5827. if ($this->request_method == "POST") {
    5828. -
    5829. $this->setCurlOption(CURLOPT_POST, 1);
    5830. -
    5831. $this->setCurlOption(CURLOPT_POSTFIELDS, $data);
    5832. -
    5833. $this->debug('set cURL POST data');
    5834. -
    5835. } else {
    5836. -
    5837. }
    5838. -
    5839. // insert custom user-set cURL options
    5840. -
    5841. foreach ($this->ch_options as $key => $val) {
    5842. -
    5843. $this->setCurlOption($key, $val);
    5844. -
    5845. }
    5846. -
    5847.  
    5848. -
    5849. $this->debug('set cURL payload');
    5850. -
    5851. return true;
    5852. -
    5853. }
    5854. -
    5855. }
    5856. -
    5857.  
    5858. -
    5859. /**
    5860. -
    5861. * gets the SOAP response via HTTP[S]
    5862. -
    5863. *
    5864. -
    5865. * @return string the response (also sets member variables like incoming_payload)
    5866. -
    5867. * @access private
    5868. -
    5869. */
    5870. -
    5871. function getResponse(){
    5872. -
    5873. $this->incoming_payload = '';
    5874. -
    5875. -
    5876. if ($this->io_method() == 'socket') {
    5877. -
    5878. // loop until headers have been retrieved
    5879. -
    5880. $data = '';
    5881. -
    5882. while (!isset($lb)){
    5883. -
    5884.  
    5885. -
    5886. // We might EOF during header read.
    5887. -
    5888. if(feof($this->fp)) {
    5889. -
    5890. $this->incoming_payload = $data;
    5891. -
    5892. $this->debug('found no headers before EOF after length ' . strlen($data));
    5893. -
    5894. $this->debug("received before EOF:\n" . $data);
    5895. -
    5896. $this->setError('server failed to send headers');
    5897. -
    5898. return false;
    5899. -
    5900. }
    5901. -
    5902.  
    5903. -
    5904. $tmp = fgets($this->fp, 256);
    5905. -
    5906. $tmplen = strlen($tmp);
    5907. -
    5908. $this->debug("read line of $tmplen bytes: " . trim($tmp));
    5909. -
    5910.  
    5911. -
    5912. if ($tmplen == 0) {
    5913. -
    5914. $this->incoming_payload = $data;
    5915. -
    5916. $this->debug('socket read of headers timed out after length ' . strlen($data));
    5917. -
    5918. $this->debug("read before timeout: " . $data);
    5919. -
    5920. $this->setError('socket read of headers timed out');
    5921. -
    5922. return false;
    5923. -
    5924. }
    5925. -
    5926.  
    5927. -
    5928. $data .= $tmp;
    5929. -
    5930. $pos = strpos($data,"\r\n\r\n");
    5931. -
    5932. if($pos > 1){
    5933. -
    5934. $lb = "\r\n";
    5935. -
    5936. } else {
    5937. -
    5938. $pos = strpos($data,"\n\n");
    5939. -
    5940. if($pos > 1){
    5941. -
    5942. $lb = "\n";
    5943. -
    5944. }
    5945. -
    5946. }
    5947. -
    5948. // remove 100 headers
    5949. -
    5950. if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) {
    5951. -
    5952. unset($lb);
    5953. -
    5954. $data = '';
    5955. -
    5956. }//
    5957. -
    5958. }
    5959. -
    5960. // store header data
    5961. -
    5962. $this->incoming_payload .= $data;
    5963. -
    5964. $this->debug('found end of headers after length ' . strlen($data));
    5965. -
    5966. // process headers
    5967. -
    5968. $header_data = trim(substr($data,0,$pos));
    5969. -
    5970. $header_array = explode($lb,$header_data);
    5971. -
    5972. $this->incoming_headers = array();
    5973. -
    5974. $this->incoming_cookies = array();
    5975. -
    5976. foreach($header_array as $header_line){
    5977. -
    5978. $arr = explode(':',$header_line, 2);
    5979. -
    5980. if(count($arr) > 1){
    5981. -
    5982. $header_name = strtolower(trim($arr[0]));
    5983. -
    5984. $this->incoming_headers[$header_name] = trim($arr[1]);
    5985. -
    5986. if ($header_name == 'set-cookie') {
    5987. -
    5988. // TODO: allow multiple cookies from parseCookie
    5989. -
    5990. $cookie = $this->parseCookie(trim($arr[1]));
    5991. -
    5992. if ($cookie) {
    5993. -
    5994. $this->incoming_cookies[] = $cookie;
    5995. -
    5996. $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
    5997. -
    5998. } else {
    5999. -
    6000. $this->debug('did not find cookie in ' . trim($arr[1]));
    6001. -
    6002. }
    6003. -
    6004. }
    6005. -
    6006. } else if (isset($header_name)) {
    6007. -
    6008. // append continuation line to previous header
    6009. -
    6010. $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
    6011. -
    6012. }
    6013. -
    6014. }
    6015. -
    6016. -
    6017. // loop until msg has been received
    6018. -
    6019. if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
    6020. -
    6021. $content_length = 2147483647; // ignore any content-length header
    6022. -
    6023. $chunked = true;
    6024. -
    6025. $this->debug("want to read chunked content");
    6026. -
    6027. } elseif (isset($this->incoming_headers['content-length'])) {
    6028. -
    6029. $content_length = $this->incoming_headers['content-length'];
    6030. -
    6031. $chunked = false;
    6032. -
    6033. $this->debug("want to read content of length $content_length");
    6034. -
    6035. } else {
    6036. -
    6037. $content_length = 2147483647;
    6038. -
    6039. $chunked = false;
    6040. -
    6041. $this->debug("want to read content to EOF");
    6042. -
    6043. }
    6044. -
    6045. $data = '';
    6046. -
    6047. do {
    6048. -
    6049. if ($chunked) {
    6050. -
    6051. $tmp = fgets($this->fp, 256);
    6052. -
    6053. $tmplen = strlen($tmp);
    6054. -
    6055. $this->debug("read chunk line of $tmplen bytes");
    6056. -
    6057. if ($tmplen == 0) {
    6058. -
    6059. $this->incoming_payload = $data;
    6060. -
    6061. $this->debug('socket read of chunk length timed out after length ' . strlen($data));
    6062. -
    6063. $this->debug("read before timeout:\n" . $data);
    6064. -
    6065. $this->setError('socket read of chunk length timed out');
    6066. -
    6067. return false;
    6068. -
    6069. }
    6070. -
    6071. $content_length = hexdec(trim($tmp));
    6072. -
    6073. $this->debug("chunk length $content_length");
    6074. -
    6075. }
    6076. -
    6077. $strlen = 0;
    6078. -
    6079. while (($strlen < $content_length) && (!feof($this->fp))) {
    6080. -
    6081. $readlen = min(8192, $content_length - $strlen);
    6082. -
    6083. $tmp = fread($this->fp, $readlen);
    6084. -
    6085. $tmplen = strlen($tmp);
    6086. -
    6087. $this->debug("read buffer of $tmplen bytes");
    6088. -
    6089. if (($tmplen == 0) && (!feof($this->fp))) {
    6090. -
    6091. $this->incoming_payload = $data;
    6092. -
    6093. $this->debug('socket read of body timed out after length ' . strlen($data));
    6094. -
    6095. $this->debug("read before timeout:\n" . $data);
    6096. -
    6097. $this->setError('socket read of body timed out');
    6098. -
    6099. return false;
    6100. -
    6101. }
    6102. -
    6103. $strlen += $tmplen;
    6104. -
    6105. $data .= $tmp;
    6106. -
    6107. }
    6108. -
    6109. if ($chunked && ($content_length > 0)) {
    6110. -
    6111. $tmp = fgets($this->fp, 256);
    6112. -
    6113. $tmplen = strlen($tmp);
    6114. -
    6115. $this->debug("read chunk terminator of $tmplen bytes");
    6116. -
    6117. if ($tmplen == 0) {
    6118. -
    6119. $this->incoming_payload = $data;
    6120. -
    6121. $this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
    6122. -
    6123. $this->debug("read before timeout:\n" . $data);
    6124. -
    6125. $this->setError('socket read of chunk terminator timed out');
    6126. -
    6127. return false;
    6128. -
    6129. }
    6130. -
    6131. }
    6132. -
    6133. } while ($chunked && ($content_length > 0) && (!feof($this->fp)));
    6134. -
    6135. if (feof($this->fp)) {
    6136. -
    6137. $this->debug('read to EOF');
    6138. -
    6139. }
    6140. -
    6141. $this->debug('read body of length ' . strlen($data));
    6142. -
    6143. $this->incoming_payload .= $data;
    6144. -
    6145. $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
    6146. -
    6147. -
    6148. // close filepointer
    6149. -
    6150. if(
    6151. -
    6152. (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') ||
    6153. -
    6154. (! $this->persistentConnection) || feof($this->fp)){
    6155. -
    6156. fclose($this->fp);
    6157. -
    6158. $this->fp = false;
    6159. -
    6160. $this->debug('closed socket');
    6161. -
    6162. }
    6163. -
    6164. -
    6165. // connection was closed unexpectedly
    6166. -
    6167. if($this->incoming_payload == ''){
    6168. -
    6169. $this->setError('no response from server');
    6170. -
    6171. return false;
    6172. -
    6173. }
    6174. -
    6175. -
    6176. // decode transfer-encoding
    6177. -
    6178. // if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){
    6179. -
    6180. // if(!$data = $this->decodeChunked($data, $lb)){
    6181. -
    6182. // $this->setError('Decoding of chunked data failed');
    6183. -
    6184. // return false;
    6185. -
    6186. // }
    6187. -
    6188. //print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>";
    6189. -
    6190. // set decoded payload
    6191. -
    6192. // $this->incoming_payload = $header_data.$lb.$lb.$data;
    6193. -
    6194. // }
    6195. -
    6196. -
    6197. } else if ($this->io_method() == 'curl') {
    6198. -
    6199. // send and receive
    6200. -
    6201. $this->debug('send and receive with cURL');
    6202. -
    6203. $this->incoming_payload = curl_exec($this->ch);
    6204. -
    6205. $data = $this->incoming_payload;
    6206. -
    6207.  
    6208. -
    6209. $cErr = curl_error($this->ch);
    6210. -
    6211. if ($cErr != '') {
    6212. -
    6213. $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
    6214. -
    6215. // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE
    6216. -
    6217. foreach(curl_getinfo($this->ch) as $k => $v){
    6218. -
    6219. $err .= "$k: $v<br>";
    6220. -
    6221. }
    6222. -
    6223. $this->debug($err);
    6224. -
    6225. $this->setError($err);
    6226. -
    6227. curl_close($this->ch);
    6228. -
    6229. return false;
    6230. -
    6231. } else {
    6232. -
    6233. //echo '<pre>';
    6234. -
    6235. //var_dump(curl_getinfo($this->ch));
    6236. -
    6237. //echo '</pre>';
    6238. -
    6239. }
    6240. -
    6241. // close curl
    6242. -
    6243. $this->debug('No cURL error, closing cURL');
    6244. -
    6245. curl_close($this->ch);
    6246. -
    6247. -
    6248. // try removing skippable headers
    6249. -
    6250. $savedata = $data;
    6251. -
    6252. while ($this->isSkippableCurlHeader($data)) {
    6253. -
    6254. $this->debug("Found HTTP header to skip");
    6255. -
    6256. if ($pos = strpos($data,"\r\n\r\n")) {
    6257. -
    6258. $data = ltrim(substr($data,$pos));
    6259. -
    6260. } elseif($pos = strpos($data,"\n\n") ) {
    6261. -
    6262. $data = ltrim(substr($data,$pos));
    6263. -
    6264. }
    6265. -
    6266. }
    6267. -
    6268.  
    6269. -
    6270. if ($data == '') {
    6271. -
    6272. // have nothing left; just remove 100 header(s)
    6273. -
    6274. $data = $savedata;
    6275. -
    6276. while (preg_match('/^HTTP\/1.1 100/',$data)) {
    6277. -
    6278. if ($pos = strpos($data,"\r\n\r\n")) {
    6279. -
    6280. $data = ltrim(substr($data,$pos));
    6281. -
    6282. } elseif($pos = strpos($data,"\n\n") ) {
    6283. -
    6284. $data = ltrim(substr($data,$pos));
    6285. -
    6286. }
    6287. -
    6288. }
    6289. -
    6290. }
    6291. -
    6292. -
    6293. // separate content from HTTP headers
    6294. -
    6295. if ($pos = strpos($data,"\r\n\r\n")) {
    6296. -
    6297. $lb = "\r\n";
    6298. -
    6299. } elseif( $pos = strpos($data,"\n\n")) {
    6300. -
    6301. $lb = "\n";
    6302. -
    6303. } else {
    6304. -
    6305. $this->debug('no proper separation of headers and document');
    6306. -
    6307. $this->setError('no proper separation of headers and document');
    6308. -
    6309. return false;
    6310. -
    6311. }
    6312. -
    6313. $header_data = trim(substr($data,0,$pos));
    6314. -
    6315. $header_array = explode($lb,$header_data);
    6316. -
    6317. $data = ltrim(substr($data,$pos));
    6318. -
    6319. $this->debug('found proper separation of headers and document');
    6320. -
    6321. $this->debug('cleaned data, stringlen: '.strlen($data));
    6322. -
    6323. // clean headers
    6324. -
    6325. foreach ($header_array as $header_line) {
    6326. -
    6327. $arr = explode(':',$header_line,2);
    6328. -
    6329. if(count($arr) > 1){
    6330. -
    6331. $header_name = strtolower(trim($arr[0]));
    6332. -
    6333. $this->incoming_headers[$header_name] = trim($arr[1]);
    6334. -
    6335. if ($header_name == 'set-cookie') {
    6336. -
    6337. // TODO: allow multiple cookies from parseCookie
    6338. -
    6339. $cookie = $this->parseCookie(trim($arr[1]));
    6340. -
    6341. if ($cookie) {
    6342. -
    6343. $this->incoming_cookies[] = $cookie;
    6344. -
    6345. $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
    6346. -
    6347. } else {
    6348. -
    6349. $this->debug('did not find cookie in ' . trim($arr[1]));
    6350. -
    6351. }
    6352. -
    6353. }
    6354. -
    6355. } else if (isset($header_name)) {
    6356. -
    6357. // append continuation line to previous header
    6358. -
    6359. $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
    6360. -
    6361. }
    6362. -
    6363. }
    6364. -
    6365. }
    6366. -
    6367.  
    6368. -
    6369. $this->response_status_line = $header_array[0];
    6370. -
    6371. $arr = explode(' ', $this->response_status_line, 3);
    6372. -
    6373. $http_version = $arr[0];
    6374. -
    6375. $http_status = intval($arr[1]);
    6376. -
    6377. $http_reason = count($arr) > 2 ? $arr[2] : '';
    6378. -
    6379.  
    6380. -
    6381. // see if we need to resend the request with http digest authentication
    6382. -
    6383. if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) {
    6384. -
    6385. $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']);
    6386. -
    6387. $this->setURL($this->incoming_headers['location']);
    6388. -
    6389. $this->tryagain = true;
    6390. -
    6391. return false;
    6392. -
    6393. }
    6394. -
    6395.  
    6396. -
    6397. // see if we need to resend the request with http digest authentication
    6398. -
    6399. if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
    6400. -
    6401. $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']);
    6402. -
    6403. if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
    6404. -
    6405. $this->debug('Server wants digest authentication');
    6406. -
    6407. // remove "Digest " from our elements
    6408. -
    6409. $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
    6410. -
    6411. -
    6412. // parse elements into array
    6413. -
    6414. $digestElements = explode(',', $digestString);
    6415. -
    6416. foreach ($digestElements as $val) {
    6417. -
    6418. $tempElement = explode('=', trim($val), 2);
    6419. -
    6420. $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]);
    6421. -
    6422. }
    6423. -
    6424.  
    6425. -
    6426. // should have (at least) qop, realm, nonce
    6427. -
    6428. if (isset($digestRequest['nonce'])) {
    6429. -
    6430. $this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
    6431. -
    6432. $this->tryagain = true;
    6433. -
    6434. return false;
    6435. -
    6436. }
    6437. -
    6438. }
    6439. -
    6440. $this->debug('HTTP authentication failed');
    6441. -
    6442. $this->setError('HTTP authentication failed');
    6443. -
    6444. return false;
    6445. -
    6446. }
    6447. -
    6448. -
    6449. if (
    6450. -
    6451. ($http_status >= 300 && $http_status <= 307) ||
    6452. -
    6453. ($http_status >= 400 && $http_status <= 417) ||
    6454. -
    6455. ($http_status >= 501 && $http_status <= 505)
    6456. -
    6457. ) {
    6458. -
    6459. $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)");
    6460. -
    6461. return false;
    6462. -
    6463. }
    6464. -
    6465.  
    6466. -
    6467. // decode content-encoding
    6468. -
    6469. if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
    6470. -
    6471. if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
    6472. -
    6473. // if decoding works, use it. else assume data wasn't gzencoded
    6474. -
    6475. if(function_exists('gzinflate')){
    6476. -
    6477. //$timer->setMarker('starting decoding of gzip/deflated content');
    6478. -
    6479. // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
    6480. -
    6481. // this means there are no Zlib headers, although there should be
    6482. -
    6483. $this->debug('The gzinflate function exists');
    6484. -
    6485. $datalen = strlen($data);
    6486. -
    6487. if ($this->incoming_headers['content-encoding'] == 'deflate') {
    6488. -
    6489. if ($degzdata = @gzinflate($data)) {
    6490. -
    6491. $data = $degzdata;
    6492. -
    6493. $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
    6494. -
    6495. if (strlen($data) < $datalen) {
    6496. -
    6497. // test for the case that the payload has been compressed twice
    6498. -
    6499. $this->debug('The inflated payload is smaller than the gzipped one; try again');
    6500. -
    6501. if ($degzdata = @gzinflate($data)) {
    6502. -
    6503. $data = $degzdata;
    6504. -
    6505. $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
    6506. -
    6507. }
    6508. -
    6509. }
    6510. -
    6511. } else {
    6512. -
    6513. $this->debug('Error using gzinflate to inflate the payload');
    6514. -
    6515. $this->setError('Error using gzinflate to inflate the payload');
    6516. -
    6517. }
    6518. -
    6519. } elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
    6520. -
    6521. if ($degzdata = @gzinflate(substr($data, 10))) { // do our best
    6522. -
    6523. $data = $degzdata;
    6524. -
    6525. $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
    6526. -
    6527. if (strlen($data) < $datalen) {
    6528. -
    6529. // test for the case that the payload has been compressed twice
    6530. -
    6531. $this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
    6532. -
    6533. if ($degzdata = @gzinflate(substr($data, 10))) {
    6534. -
    6535. $data = $degzdata;
    6536. -
    6537. $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
    6538. -
    6539. }
    6540. -
    6541. }
    6542. -
    6543. } else {
    6544. -
    6545. $this->debug('Error using gzinflate to un-gzip the payload');
    6546. -
    6547. $this->setError('Error using gzinflate to un-gzip the payload');
    6548. -
    6549. }
    6550. -
    6551. }
    6552. -
    6553. //$timer->setMarker('finished decoding of gzip/deflated content');
    6554. -
    6555. //print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
    6556. -
    6557. // set decoded payload
    6558. -
    6559. $this->incoming_payload = $header_data.$lb.$lb.$data;
    6560. -
    6561. } else {
    6562. -
    6563. $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
    6564. -
    6565. $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
    6566. -
    6567. }
    6568. -
    6569. } else {
    6570. -
    6571. $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
    6572. -
    6573. $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
    6574. -
    6575. }
    6576. -
    6577. } else {
    6578. -
    6579. $this->debug('No Content-Encoding header');
    6580. -
    6581. }
    6582. -
    6583. -
    6584. if(strlen($data) == 0){
    6585. -
    6586. $this->debug('no data after headers!');
    6587. -
    6588. $this->setError('no data present after HTTP headers');
    6589. -
    6590. return false;
    6591. -
    6592. }
    6593. -
    6594. -
    6595. return $data;
    6596. -
    6597. }
    6598. -
    6599.  
    6600. -
    6601. /**
    6602. -
    6603. * sets the content-type for the SOAP message to be sent
    6604. -
    6605. *
    6606. -
    6607. * @param string $type the content type, MIME style
    6608. -
    6609. * @param mixed $charset character set used for encoding (or false)
    6610. -
    6611. * @access public
    6612. -
    6613. */
    6614. -
    6615. function setContentType($type, $charset = false) {
    6616. -
    6617. $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : ''));
    6618. -
    6619. }
    6620. -
    6621.  
    6622. -
    6623. /**
    6624. -
    6625. * specifies that an HTTP persistent connection should be used
    6626. -
    6627. *
    6628. -
    6629. * @return boolean whether the request was honored by this method.
    6630. -
    6631. * @access public
    6632. -
    6633. */
    6634. -
    6635. function usePersistentConnection(){
    6636. -
    6637. if (isset($this->outgoing_headers['Accept-Encoding'])) {
    6638. -
    6639. return false;
    6640. -
    6641. }
    6642. -
    6643. $this->protocol_version = '1.1';
    6644. -
    6645. $this->persistentConnection = true;
    6646. -
    6647. $this->setHeader('Connection', 'Keep-Alive');
    6648. -
    6649. return true;
    6650. -
    6651. }
    6652. -
    6653.  
    6654. -
    6655. /**
    6656. -
    6657. * parse an incoming Cookie into it's parts
    6658. -
    6659. *
    6660. -
    6661. * @param string $cookie_str content of cookie
    6662. -
    6663. * @return array with data of that cookie
    6664. -
    6665. * @access private
    6666. -
    6667. */
    6668. -
    6669. /*
    6670. -
    6671. * TODO: allow a Set-Cookie string to be parsed into multiple cookies
    6672. -
    6673. */
    6674. -
    6675. function parseCookie($cookie_str) {
    6676. -
    6677. $cookie_str = str_replace('; ', ';', $cookie_str) . ';';
    6678. -
    6679. $data = preg_split('/;/', $cookie_str);
    6680. -
    6681. $value_str = $data[0];
    6682. -
    6683.  
    6684. -
    6685. $cookie_param = 'domain=';
    6686. -
    6687. $start = strpos($cookie_str, $cookie_param);
    6688. -
    6689. if ($start > 0) {
    6690. -
    6691. $domain = substr($cookie_str, $start + strlen($cookie_param));
    6692. -
    6693. $domain = substr($domain, 0, strpos($domain, ';'));
    6694. -
    6695. } else {
    6696. -
    6697. $domain = '';
    6698. -
    6699. }
    6700. -
    6701.  
    6702. -
    6703. $cookie_param = 'expires=';
    6704. -
    6705. $start = strpos($cookie_str, $cookie_param);
    6706. -
    6707. if ($start > 0) {
    6708. -
    6709. $expires = substr($cookie_str, $start + strlen($cookie_param));
    6710. -
    6711. $expires = substr($expires, 0, strpos($expires, ';'));
    6712. -
    6713. } else {
    6714. -
    6715. $expires = '';
    6716. -
    6717. }
    6718. -
    6719.  
    6720. -
    6721. $cookie_param = 'path=';
    6722. -
    6723. $start = strpos($cookie_str, $cookie_param);
    6724. -
    6725. if ( $start > 0 ) {
    6726. -
    6727. $path = substr($cookie_str, $start + strlen($cookie_param));
    6728. -
    6729. $path = substr($path, 0, strpos($path, ';'));
    6730. -
    6731. } else {
    6732. -
    6733. $path = '/';
    6734. -
    6735. }
    6736. -
    6737. -
    6738. $cookie_param = ';secure;';
    6739. -
    6740. if (strpos($cookie_str, $cookie_param) !== FALSE) {
    6741. -
    6742. $secure = true;
    6743. -
    6744. } else {
    6745. -
    6746. $secure = false;
    6747. -
    6748. }
    6749. -
    6750.  
    6751. -
    6752. $sep_pos = strpos($value_str, '=');
    6753. -
    6754.  
    6755. -
    6756. if ($sep_pos) {
    6757. -
    6758. $name = substr($value_str, 0, $sep_pos);
    6759. -
    6760. $value = substr($value_str, $sep_pos + 1);
    6761. -
    6762. $cookie= array( 'name' => $name,
    6763. -
    6764. 'value' => $value,
    6765. -
    6766. 'domain' => $domain,
    6767. -
    6768. 'path' => $path,
    6769. -
    6770. 'expires' => $expires,
    6771. -
    6772. 'secure' => $secure
    6773. -
    6774. );
    6775. -
    6776. return $cookie;
    6777. -
    6778. }
    6779. -
    6780. return false;
    6781. -
    6782. }
    6783. -
    6784. -
    6785. /**
    6786. -
    6787. * sort out cookies for the current request
    6788. -
    6789. *
    6790. -
    6791. * @param array $cookies array with all cookies
    6792. -
    6793. * @param boolean $secure is the send-content secure or not?
    6794. -
    6795. * @return string for Cookie-HTTP-Header
    6796. -
    6797. * @access private
    6798. -
    6799. */
    6800. -
    6801. function getCookiesForRequest($cookies, $secure=false) {
    6802. -
    6803. $cookie_str = '';
    6804. -
    6805. if ((! is_null($cookies)) && (is_array($cookies))) {
    6806. -
    6807. foreach ($cookies as $cookie) {
    6808. -
    6809. if (! is_array($cookie)) {
    6810. -
    6811. continue;
    6812. -
    6813. }
    6814. -
    6815. $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
    6816. -
    6817. if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
    6818. -
    6819. if (strtotime($cookie['expires']) <= time()) {
    6820. -
    6821. $this->debug('cookie has expired');
    6822. -
    6823. continue;
    6824. -
    6825. }
    6826. -
    6827. }
    6828. -
    6829. if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
    6830. -
    6831. $domain = preg_quote($cookie['domain']);
    6832. -
    6833. if (! preg_match("'.*$domain$'i", $this->host)) {
    6834. -
    6835. $this->debug('cookie has different domain');
    6836. -
    6837. continue;
    6838. -
    6839. }
    6840. -
    6841. }
    6842. -
    6843. if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
    6844. -
    6845. $path = preg_quote($cookie['path']);
    6846. -
    6847. if (! preg_match("'^$path.*'i", $this->path)) {
    6848. -
    6849. $this->debug('cookie is for a different path');
    6850. -
    6851. continue;
    6852. -
    6853. }
    6854. -
    6855. }
    6856. -
    6857. if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
    6858. -
    6859. $this->debug('cookie is secure, transport is not');
    6860. -
    6861. continue;
    6862. -
    6863. }
    6864. -
    6865. $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
    6866. -
    6867. $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
    6868. -
    6869. }
    6870. -
    6871. }
    6872. -
    6873. return $cookie_str;
    6874. -
    6875. }
    6876. -
    6877. }
    6878. -
    6879.  
    6880. -
    6881. ?><?php
    6882. -
    6883.  
    6884. -
    6885.  
    6886. -
    6887.  
    6888. -
    6889. /**
    6890. -
    6891. *
    6892. -
    6893. * nusoap_server allows the user to create a SOAP server
    6894. -
    6895. * that is capable of receiving messages and returning responses
    6896. -
    6897. *
    6898. -
    6899. * @author Dietrich Ayala <dietrich@ganx4.com>
    6900. -
    6901. * @author Scott Nichol <snichol@users.sourceforge.net>
    6902. -
    6903. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    6904. -
    6905. * @access public
    6906. -
    6907. */
    6908. -
    6909. class nusoap_server extends nusoap_base {
    6910. -
    6911. /**
    6912. -
    6913. * HTTP headers of request
    6914. -
    6915. * @var array
    6916. -
    6917. * @access private
    6918. -
    6919. */
    6920. -
    6921. var $headers = array();
    6922. -
    6923. /**
    6924. -
    6925. * HTTP request
    6926. -
    6927. * @var string
    6928. -
    6929. * @access private
    6930. -
    6931. */
    6932. -
    6933. var $request = '';
    6934. -
    6935. /**
    6936. -
    6937. * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text)
    6938. -
    6939. * @var string
    6940. -
    6941. * @access public
    6942. -
    6943. */
    6944. -
    6945. var $requestHeaders = '';
    6946. -
    6947. /**
    6948. -
    6949. * SOAP Headers from request (parsed)
    6950. -
    6951. * @var mixed
    6952. -
    6953. * @access public
    6954. -
    6955. */
    6956. -
    6957. var $requestHeader = NULL;
    6958. -
    6959. /**
    6960. -
    6961. * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text)
    6962. -
    6963. * @var string
    6964. -
    6965. * @access public
    6966. -
    6967. */
    6968. -
    6969. var $document = '';
    6970. -
    6971. /**
    6972. -
    6973. * SOAP payload for request (text)
    6974. -
    6975. * @var string
    6976. -
    6977. * @access public
    6978. -
    6979. */
    6980. -
    6981. var $requestSOAP = '';
    6982. -
    6983. /**
    6984. -
    6985. * requested method namespace URI
    6986. -
    6987. * @var string
    6988. -
    6989. * @access private
    6990. -
    6991. */
    6992. -
    6993. var $methodURI = '';
    6994. -
    6995. /**
    6996. -
    6997. * name of method requested
    6998. -
    6999. * @var string
    7000. -
    7001. * @access private
    7002. -
    7003. */
    7004. -
    7005. var $methodname = '';
    7006. -
    7007. /**
    7008. -
    7009. * method parameters from request
    7010. -
    7011. * @var array
    7012. -
    7013. * @access private
    7014. -
    7015. */
    7016. -
    7017. var $methodparams = array();
    7018. -
    7019. /**
    7020. -
    7021. * SOAP Action from request
    7022. -
    7023. * @var string
    7024. -
    7025. * @access private
    7026. -
    7027. */
    7028. -
    7029. var $SOAPAction = '';
    7030. -
    7031. /**
    7032. -
    7033. * character set encoding of incoming (request) messages
    7034. -
    7035. * @var string
    7036. -
    7037. * @access public
    7038. -
    7039. */
    7040. -
    7041. var $xml_encoding = '';
    7042. -
    7043. /**
    7044. -
    7045. * toggles whether the parser decodes element content w/ utf8_decode()
    7046. -
    7047. * @var boolean
    7048. -
    7049. * @access public
    7050. -
    7051. */
    7052. -
    7053. var $decode_utf8 = true;
    7054. -
    7055.  
    7056. -
    7057. /**
    7058. -
    7059. * HTTP headers of response
    7060. -
    7061. * @var array
    7062. -
    7063. * @access public
    7064. -
    7065. */
    7066. -
    7067. var $outgoing_headers = array();
    7068. -
    7069. /**
    7070. -
    7071. * HTTP response
    7072. -
    7073. * @var string
    7074. -
    7075. * @access private
    7076. -
    7077. */
    7078. -
    7079. var $response = '';
    7080. -
    7081. /**
    7082. -
    7083. * SOAP headers for response (text or array of soapval or associative array)
    7084. -
    7085. * @var mixed
    7086. -
    7087. * @access public
    7088. -
    7089. */
    7090. -
    7091. var $responseHeaders = '';
    7092. -
    7093. /**
    7094. -
    7095. * SOAP payload for response (text)
    7096. -
    7097. * @var string
    7098. -
    7099. * @access private
    7100. -
    7101. */
    7102. -
    7103. var $responseSOAP = '';
    7104. -
    7105. /**
    7106. -
    7107. * method return value to place in response
    7108. -
    7109. * @var mixed
    7110. -
    7111. * @access private
    7112. -
    7113. */
    7114. -
    7115. var $methodreturn = false;
    7116. -
    7117. /**
    7118. -
    7119. * whether $methodreturn is a string of literal XML
    7120. -
    7121. * @var boolean
    7122. -
    7123. * @access public
    7124. -
    7125. */
    7126. -
    7127. var $methodreturnisliteralxml = false;
    7128. -
    7129. /**
    7130. -
    7131. * SOAP fault for response (or false)
    7132. -
    7133. * @var mixed
    7134. -
    7135. * @access private
    7136. -
    7137. */
    7138. -
    7139. var $fault = false;
    7140. -
    7141. /**
    7142. -
    7143. * text indication of result (for debugging)
    7144. -
    7145. * @var string
    7146. -
    7147. * @access private
    7148. -
    7149. */
    7150. -
    7151. var $result = 'successful';
    7152. -
    7153.  
    7154. -
    7155. /**
    7156. -
    7157. * assoc array of operations => opData; operations are added by the register()
    7158. -
    7159. * method or by parsing an external WSDL definition
    7160. -
    7161. * @var array
    7162. -
    7163. * @access private
    7164. -
    7165. */
    7166. -
    7167. var $operations = array();
    7168. -
    7169. /**
    7170. -
    7171. * wsdl instance (if one)
    7172. -
    7173. * @var mixed
    7174. -
    7175. * @access private
    7176. -
    7177. */
    7178. -
    7179. var $wsdl = false;
    7180. -
    7181. /**
    7182. -
    7183. * URL for WSDL (if one)
    7184. -
    7185. * @var mixed
    7186. -
    7187. * @access private
    7188. -
    7189. */
    7190. -
    7191. var $externalWSDLURL = false;
    7192. -
    7193. /**
    7194. -
    7195. * whether to append debug to response as XML comment
    7196. -
    7197. * @var boolean
    7198. -
    7199. * @access public
    7200. -
    7201. */
    7202. -
    7203. var $debug_flag = false;
    7204. -
    7205.  
    7206. -
    7207.  
    7208. -
    7209. /**
    7210. -
    7211. * constructor
    7212. -
    7213. * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
    7214. -
    7215. *
    7216. -
    7217. * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
    7218. -
    7219. * @access public
    7220. -
    7221. */
    7222. -
    7223. function nusoap_server($wsdl=false){
    7224. -
    7225. parent::nusoap_base();
    7226. -
    7227. // turn on debugging?
    7228. -
    7229. global $debug;
    7230. -
    7231. global $HTTP_SERVER_VARS;
    7232. -
    7233.  
    7234. -
    7235. if (isset($_SERVER)) {
    7236. -
    7237. $this->debug("_SERVER is defined:");
    7238. -
    7239. $this->appendDebug($this->varDump($_SERVER));
    7240. -
    7241. } elseif (isset($HTTP_SERVER_VARS)) {
    7242. -
    7243. $this->debug("HTTP_SERVER_VARS is defined:");
    7244. -
    7245. $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
    7246. -
    7247. } else {
    7248. -
    7249. $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
    7250. -
    7251. }
    7252. -
    7253.  
    7254. -
    7255. if (isset($debug)) {
    7256. -
    7257. $this->debug("In nusoap_server, set debug_flag=$debug based on global flag");
    7258. -
    7259. $this->debug_flag = $debug;
    7260. -
    7261. } elseif (isset($_SERVER['QUERY_STRING'])) {
    7262. -
    7263. $qs = explode('&', $_SERVER['QUERY_STRING']);
    7264. -
    7265. foreach ($qs as $v) {
    7266. -
    7267. if (substr($v, 0, 6) == 'debug=') {
    7268. -
    7269. $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
    7270. -
    7271. $this->debug_flag = substr($v, 6);
    7272. -
    7273. }
    7274. -
    7275. }
    7276. -
    7277. } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    7278. -
    7279. $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
    7280. -
    7281. foreach ($qs as $v) {
    7282. -
    7283. if (substr($v, 0, 6) == 'debug=') {
    7284. -
    7285. $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
    7286. -
    7287. $this->debug_flag = substr($v, 6);
    7288. -
    7289. }
    7290. -
    7291. }
    7292. -
    7293. }
    7294. -
    7295.  
    7296. -
    7297. // wsdl
    7298. -
    7299. if($wsdl){
    7300. -
    7301. $this->debug("In nusoap_server, WSDL is specified");
    7302. -
    7303. if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
    7304. -
    7305. $this->wsdl = $wsdl;
    7306. -
    7307. $this->externalWSDLURL = $this->wsdl->wsdl;
    7308. -
    7309. $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
    7310. -
    7311. } else {
    7312. -
    7313. $this->debug('Create wsdl from ' . $wsdl);
    7314. -
    7315. $this->wsdl = new wsdl($wsdl);
    7316. -
    7317. $this->externalWSDLURL = $wsdl;
    7318. -
    7319. }
    7320. -
    7321. $this->appendDebug($this->wsdl->getDebug());
    7322. -
    7323. $this->wsdl->clearDebug();
    7324. -
    7325. if($err = $this->wsdl->getError()){
    7326. -
    7327. die('WSDL ERROR: '.$err);
    7328. -
    7329. }
    7330. -
    7331. }
    7332. -
    7333. }
    7334. -
    7335.  
    7336. -
    7337. /**
    7338. -
    7339. * processes request and returns response
    7340. -
    7341. *
    7342. -
    7343. * @param string $data usually is the value of $HTTP_RAW_POST_DATA
    7344. -
    7345. * @access public
    7346. -
    7347. */
    7348. -
    7349. function service($data){
    7350. -
    7351. global $HTTP_SERVER_VARS;
    7352. -
    7353.  
    7354. -
    7355. if (isset($_SERVER['REQUEST_METHOD'])) {
    7356. -
    7357. $rm = $_SERVER['REQUEST_METHOD'];
    7358. -
    7359. } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) {
    7360. -
    7361. $rm = $HTTP_SERVER_VARS['REQUEST_METHOD'];
    7362. -
    7363. } else {
    7364. -
    7365. $rm = '';
    7366. -
    7367. }
    7368. -
    7369.  
    7370. -
    7371. if (isset($_SERVER['QUERY_STRING'])) {
    7372. -
    7373. $qs = $_SERVER['QUERY_STRING'];
    7374. -
    7375. } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    7376. -
    7377. $qs = $HTTP_SERVER_VARS['QUERY_STRING'];
    7378. -
    7379. } else {
    7380. -
    7381. $qs = '';
    7382. -
    7383. }
    7384. -
    7385. $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data));
    7386. -
    7387.  
    7388. -
    7389. if ($rm == 'POST') {
    7390. -
    7391. $this->debug("In service, invoke the request");
    7392. -
    7393. $this->parse_request($data);
    7394. -
    7395. if (! $this->fault) {
    7396. -
    7397. $this->invoke_method();
    7398. -
    7399. }
    7400. -
    7401. if (! $this->fault) {
    7402. -
    7403. $this->serialize_return();
    7404. -
    7405. }
    7406. -
    7407. $this->send_response();
    7408. -
    7409. } elseif (preg_match('/wsdl/', $qs) ){
    7410. -
    7411. $this->debug("In service, this is a request for WSDL");
    7412. -
    7413. if ($this->externalWSDLURL){
    7414. -
    7415. if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL
    7416. -
    7417. $this->debug("In service, re-direct for WSDL");
    7418. -
    7419. header('Location: '.$this->externalWSDLURL);
    7420. -
    7421. } else { // assume file
    7422. -
    7423. $this->debug("In service, use file passthru for WSDL");
    7424. -
    7425. header("Content-Type: text/xml\r\n");
    7426. -
    7427. $pos = strpos($this->externalWSDLURL, "file://");
    7428. -
    7429. if ($pos === false) {
    7430. -
    7431. $filename = $this->externalWSDLURL;
    7432. -
    7433. } else {
    7434. -
    7435. $filename = substr($this->externalWSDLURL, $pos + 7);
    7436. -
    7437. }
    7438. -
    7439. $fp = fopen($this->externalWSDLURL, 'r');
    7440. -
    7441. fpassthru($fp);
    7442. -
    7443. }
    7444. -
    7445. } elseif ($this->wsdl) {
    7446. -
    7447. $this->debug("In service, serialize WSDL");
    7448. -
    7449. header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
    7450. -
    7451. print $this->wsdl->serialize($this->debug_flag);
    7452. -
    7453. if ($this->debug_flag) {
    7454. -
    7455. $this->debug('wsdl:');
    7456. -
    7457. $this->appendDebug($this->varDump($this->wsdl));
    7458. -
    7459. print $this->getDebugAsXMLComment();
    7460. -
    7461. }
    7462. -
    7463. } else {
    7464. -
    7465. $this->debug("In service, there is no WSDL");
    7466. -
    7467. header("Content-Type: text/html; charset=ISO-8859-1\r\n");
    7468. -
    7469. print "This service does not provide WSDL";
    7470. -
    7471. }
    7472. -
    7473. } elseif ($this->wsdl) {
    7474. -
    7475. $this->debug("In service, return Web description");
    7476. -
    7477. print $this->wsdl->webDescription();
    7478. -
    7479. } else {
    7480. -
    7481. $this->debug("In service, no Web description");
    7482. -
    7483. header("Content-Type: text/html; charset=ISO-8859-1\r\n");
    7484. -
    7485. print "This service does not provide a Web description";
    7486. -
    7487. }
    7488. -
    7489. }
    7490. -
    7491.  
    7492. -
    7493. /**
    7494. -
    7495. * parses HTTP request headers.
    7496. -
    7497. *
    7498. -
    7499. * The following fields are set by this function (when successful)
    7500. -
    7501. *
    7502. -
    7503. * headers
    7504. -
    7505. * request
    7506. -
    7507. * xml_encoding
    7508. -
    7509. * SOAPAction
    7510. -
    7511. *
    7512. -
    7513. * @access private
    7514. -
    7515. */
    7516. -
    7517. function parse_http_headers() {
    7518. -
    7519. global $HTTP_SERVER_VARS;
    7520. -
    7521.  
    7522. -
    7523. $this->request = '';
    7524. -
    7525. $this->SOAPAction = '';
    7526. -
    7527. if(function_exists('getallheaders')){
    7528. -
    7529. $this->debug("In parse_http_headers, use getallheaders");
    7530. -
    7531. $headers = getallheaders();
    7532. -
    7533. foreach($headers as $k=>$v){
    7534. -
    7535. $k = strtolower($k);
    7536. -
    7537. $this->headers[$k] = $v;
    7538. -
    7539. $this->request .= "$k: $v\r\n";
    7540. -
    7541. $this->debug("$k: $v");
    7542. -
    7543. }
    7544. -
    7545. // get SOAPAction header
    7546. -
    7547. if(isset($this->headers['soapaction'])){
    7548. -
    7549. $this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
    7550. -
    7551. }
    7552. -
    7553. // get the character encoding of the incoming request
    7554. -
    7555. if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
    7556. -
    7557. $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
    7558. -
    7559. if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
    7560. -
    7561. $this->xml_encoding = strtoupper($enc);
    7562. -
    7563. } else {
    7564. -
    7565. $this->xml_encoding = 'US-ASCII';
    7566. -
    7567. }
    7568. -
    7569. } else {
    7570. -
    7571. // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
    7572. -
    7573. $this->xml_encoding = 'ISO-8859-1';
    7574. -
    7575. }
    7576. -
    7577. } elseif(isset($_SERVER) && is_array($_SERVER)){
    7578. -
    7579. $this->debug("In parse_http_headers, use _SERVER");
    7580. -
    7581. foreach ($_SERVER as $k => $v) {
    7582. -
    7583. if (substr($k, 0, 5) == 'HTTP_') {
    7584. -
    7585. $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
    7586. -
    7587. } else {
    7588. -
    7589. $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
    7590. -
    7591. }
    7592. -
    7593. if ($k == 'soapaction') {
    7594. -
    7595. // get SOAPAction header
    7596. -
    7597. $k = 'SOAPAction';
    7598. -
    7599. $v = str_replace('"', '', $v);
    7600. -
    7601. $v = str_replace('\\', '', $v);
    7602. -
    7603. $this->SOAPAction = $v;
    7604. -
    7605. } else if ($k == 'content-type') {
    7606. -
    7607. // get the character encoding of the incoming request
    7608. -
    7609. if (strpos($v, '=')) {
    7610. -
    7611. $enc = substr(strstr($v, '='), 1);
    7612. -
    7613. $enc = str_replace('"', '', $enc);
    7614. -
    7615. $enc = str_replace('\\', '', $enc);
    7616. -
    7617. if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
    7618. -
    7619. $this->xml_encoding = strtoupper($enc);
    7620. -
    7621. } else {
    7622. -
    7623. $this->xml_encoding = 'US-ASCII';
    7624. -
    7625. }
    7626. -
    7627. } else {
    7628. -
    7629. // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
    7630. -
    7631. $this->xml_encoding = 'ISO-8859-1';
    7632. -
    7633. }
    7634. -
    7635. }
    7636. -
    7637. $this->headers[$k] = $v;
    7638. -
    7639. $this->request .= "$k: $v\r\n";
    7640. -
    7641. $this->debug("$k: $v");
    7642. -
    7643. }
    7644. -
    7645. } elseif (is_array($HTTP_SERVER_VARS)) {
    7646. -
    7647. $this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
    7648. -
    7649. foreach ($HTTP_SERVER_VARS as $k => $v) {
    7650. -
    7651. if (substr($k, 0, 5) == 'HTTP_') {
    7652. -
    7653. $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5));
    7654. -
    7655. } else {
    7656. -
    7657. $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k);
    7658. -
    7659. }
    7660. -
    7661. if ($k == 'soapaction') {
    7662. -
    7663. // get SOAPAction header
    7664. -
    7665. $k = 'SOAPAction';
    7666. -
    7667. $v = str_replace('"', '', $v);
    7668. -
    7669. $v = str_replace('\\', '', $v);
    7670. -
    7671. $this->SOAPAction = $v;
    7672. -
    7673. } else if ($k == 'content-type') {
    7674. -
    7675. // get the character encoding of the incoming request
    7676. -
    7677. if (strpos($v, '=')) {
    7678. -
    7679. $enc = substr(strstr($v, '='), 1);
    7680. -
    7681. $enc = str_replace('"', '', $enc);
    7682. -
    7683. $enc = str_replace('\\', '', $enc);
    7684. -
    7685. if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
    7686. -
    7687. $this->xml_encoding = strtoupper($enc);
    7688. -
    7689. } else {
    7690. -
    7691. $this->xml_encoding = 'US-ASCII';
    7692. -
    7693. }
    7694. -
    7695. } else {
    7696. -
    7697. // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
    7698. -
    7699. $this->xml_encoding = 'ISO-8859-1';
    7700. -
    7701. }
    7702. -
    7703. }
    7704. -
    7705. $this->headers[$k] = $v;
    7706. -
    7707. $this->request .= "$k: $v\r\n";
    7708. -
    7709. $this->debug("$k: $v");
    7710. -
    7711. }
    7712. -
    7713. } else {
    7714. -
    7715. $this->debug("In parse_http_headers, HTTP headers not accessible");
    7716. -
    7717. $this->setError("HTTP headers not accessible");
    7718. -
    7719. }
    7720. -
    7721. }
    7722. -
    7723.  
    7724. -
    7725. /**
    7726. -
    7727. * parses a request
    7728. -
    7729. *
    7730. -
    7731. * The following fields are set by this function (when successful)
    7732. -
    7733. *
    7734. -
    7735. * headers
    7736. -
    7737. * request
    7738. -
    7739. * xml_encoding
    7740. -
    7741. * SOAPAction
    7742. -
    7743. * request
    7744. -
    7745. * requestSOAP
    7746. -
    7747. * methodURI
    7748. -
    7749. * methodname
    7750. -
    7751. * methodparams
    7752. -
    7753. * requestHeaders
    7754. -
    7755. * document
    7756. -
    7757. *
    7758. -
    7759. * This sets the fault field on error
    7760. -
    7761. *
    7762. -
    7763. * @param string $data XML string
    7764. -
    7765. * @access private
    7766. -
    7767. */
    7768. -
    7769. function parse_request($data='') {
    7770. -
    7771. $this->debug('entering parse_request()');
    7772. -
    7773. $this->parse_http_headers();
    7774. -
    7775. $this->debug('got character encoding: '.$this->xml_encoding);
    7776. -
    7777. // uncompress if necessary
    7778. -
    7779. if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
    7780. -
    7781. $this->debug('got content encoding: ' . $this->headers['content-encoding']);
    7782. -
    7783. if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
    7784. -
    7785. // if decoding works, use it. else assume data wasn't gzencoded
    7786. -
    7787. if (function_exists('gzuncompress')) {
    7788. -
    7789. if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
    7790. -
    7791. $data = $degzdata;
    7792. -
    7793. } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) {
    7794. -
    7795. $data = $degzdata;
    7796. -
    7797. } else {
    7798. -
    7799. $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data');
    7800. -
    7801. return;
    7802. -
    7803. }
    7804. -
    7805. } else {
    7806. -
    7807. $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data');
    7808. -
    7809. return;
    7810. -
    7811. }
    7812. -
    7813. }
    7814. -
    7815. }
    7816. -
    7817. $this->request .= "\r\n".$data;
    7818. -
    7819. $data = $this->parseRequest($this->headers, $data);
    7820. -
    7821. $this->requestSOAP = $data;
    7822. -
    7823. $this->debug('leaving parse_request');
    7824. -
    7825. }
    7826. -
    7827.  
    7828. -
    7829. /**
    7830. -
    7831. * invokes a PHP function for the requested SOAP method
    7832. -
    7833. *
    7834. -
    7835. * The following fields are set by this function (when successful)
    7836. -
    7837. *
    7838. -
    7839. * methodreturn
    7840. -
    7841. *
    7842. -
    7843. * Note that the PHP function that is called may also set the following
    7844. -
    7845. * fields to affect the response sent to the client
    7846. -
    7847. *
    7848. -
    7849. * responseHeaders
    7850. -
    7851. * outgoing_headers
    7852. -
    7853. *
    7854. -
    7855. * This sets the fault field on error
    7856. -
    7857. *
    7858. -
    7859. * @access private
    7860. -
    7861. */
    7862. -
    7863. function invoke_method() {
    7864. -
    7865. $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
    7866. -
    7867.  
    7868. -
    7869. //
    7870. -
    7871. // if you are debugging in this area of the code, your service uses a class to implement methods,
    7872. -
    7873. // you use SOAP RPC, and the client is .NET, please be aware of the following...
    7874. -
    7875. // when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the
    7876. -
    7877. // method name. that is fine for naming the .NET methods. it is not fine for properly constructing
    7878. -
    7879. // the XML request and reading the XML response. you need to add the RequestElementName and
    7880. -
    7881. // ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe
    7882. -
    7883. // generates for the method. these parameters are used to specify the correct XML element names
    7884. -
    7885. // for .NET to use, i.e. the names with the '.' in them.
    7886. -
    7887. //
    7888. -
    7889. $orig_methodname = $this->methodname;
    7890. -
    7891. if ($this->wsdl) {
    7892. -
    7893. if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
    7894. -
    7895. $this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
    7896. -
    7897. $this->appendDebug('opData=' . $this->varDump($this->opData));
    7898. -
    7899. } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
    7900. -
    7901. // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
    7902. -
    7903. $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
    7904. -
    7905. $this->appendDebug('opData=' . $this->varDump($this->opData));
    7906. -
    7907. $this->methodname = $this->opData['name'];
    7908. -
    7909. } else {
    7910. -
    7911. $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
    7912. -
    7913. $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
    7914. -
    7915. return;
    7916. -
    7917. }
    7918. -
    7919. } else {
    7920. -
    7921. $this->debug('in invoke_method, no WSDL to validate method');
    7922. -
    7923. }
    7924. -
    7925.  
    7926. -
    7927. // if a . is present in $this->methodname, we see if there is a class in scope,
    7928. -
    7929. // which could be referred to. We will also distinguish between two deliminators,
    7930. -
    7931. // to allow methods to be called a the class or an instance
    7932. -
    7933. if (strpos($this->methodname, '..') > 0) {
    7934. -
    7935. $delim = '..';
    7936. -
    7937. } else if (strpos($this->methodname, '.') > 0) {
    7938. -
    7939. $delim = '.';
    7940. -
    7941. } else {
    7942. -
    7943. $delim = '';
    7944. -
    7945. }
    7946. -
    7947. $this->debug("in invoke_method, delim=$delim");
    7948. -
    7949.  
    7950. -
    7951. $class = '';
    7952. -
    7953. $method = '';
    7954. -
    7955. if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) {
    7956. -
    7957. $try_class = substr($this->methodname, 0, strpos($this->methodname, $delim));
    7958. -
    7959. if (class_exists($try_class)) {
    7960. -
    7961. // get the class and method name
    7962. -
    7963. $class = $try_class;
    7964. -
    7965. $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
    7966. -
    7967. $this->debug("in invoke_method, class=$class method=$method delim=$delim");
    7968. -
    7969. } else {
    7970. -
    7971. $this->debug("in invoke_method, class=$try_class not found");
    7972. -
    7973. }
    7974. -
    7975. } else {
    7976. -
    7977. $try_class = '';
    7978. -
    7979. $this->debug("in invoke_method, no class to try");
    7980. -
    7981. }
    7982. -
    7983.  
    7984. -
    7985. // does method exist?
    7986. -
    7987. if ($class == '') {
    7988. -
    7989. if (!function_exists($this->methodname)) {
    7990. -
    7991. $this->debug("in invoke_method, function '$this->methodname' not found!");
    7992. -
    7993. $this->result = 'fault: method not found';
    7994. -
    7995. $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')");
    7996. -
    7997. return;
    7998. -
    7999. }
    8000. -
    8001. } else {
    8002. -
    8003. $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method;
    8004. -
    8005. if (!in_array($method_to_compare, get_class_methods($class))) {
    8006. -
    8007. $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
    8008. -
    8009. $this->result = 'fault: method not found';
    8010. -
    8011. $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')");
    8012. -
    8013. return;
    8014. -
    8015. }
    8016. -
    8017. }
    8018. -
    8019.  
    8020. -
    8021. // evaluate message, getting back parameters
    8022. -
    8023. // verify that request parameters match the method's signature
    8024. -
    8025. if(! $this->verify_method($this->methodname,$this->methodparams)){
    8026. -
    8027. // debug
    8028. -
    8029. $this->debug('ERROR: request not verified against method signature');
    8030. -
    8031. $this->result = 'fault: request failed validation against method signature';
    8032. -
    8033. // return fault
    8034. -
    8035. $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service.");
    8036. -
    8037. return;
    8038. -
    8039. }
    8040. -
    8041.  
    8042. -
    8043. // if there are parameters to pass
    8044. -
    8045. $this->debug('in invoke_method, params:');
    8046. -
    8047. $this->appendDebug($this->varDump($this->methodparams));
    8048. -
    8049. $this->debug("in invoke_method, calling '$this->methodname'");
    8050. -
    8051. if (!function_exists('call_user_func_array')) {
    8052. -
    8053. if ($class == '') {
    8054. -
    8055. $this->debug('in invoke_method, calling function using eval()');
    8056. -
    8057. $funcCall = "\$this->methodreturn = $this->methodname(";
    8058. -
    8059. } else {
    8060. -
    8061. if ($delim == '..') {
    8062. -
    8063. $this->debug('in invoke_method, calling class method using eval()');
    8064. -
    8065. $funcCall = "\$this->methodreturn = ".$class."::".$method."(";
    8066. -
    8067. } else {
    8068. -
    8069. $this->debug('in invoke_method, calling instance method using eval()');
    8070. -
    8071. // generate unique instance name
    8072. -
    8073. $instname = "\$inst_".time();
    8074. -
    8075. $funcCall = $instname." = new ".$class."(); ";
    8076. -
    8077. $funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
    8078. -
    8079. }
    8080. -
    8081. }
    8082. -
    8083. if ($this->methodparams) {
    8084. -
    8085. foreach ($this->methodparams as $param) {
    8086. -
    8087. if (is_array($param) || is_object($param)) {
    8088. -
    8089. $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
    8090. -
    8091. return;
    8092. -
    8093. }
    8094. -
    8095. $funcCall .= "\"$param\",";
    8096. -
    8097. }
    8098. -
    8099. $funcCall = substr($funcCall, 0, -1);
    8100. -
    8101. }
    8102. -
    8103. $funcCall .= ');';
    8104. -
    8105. $this->debug('in invoke_method, function call: '.$funcCall);
    8106. -
    8107. @eval($funcCall);
    8108. -
    8109. } else {
    8110. -
    8111. if ($class == '') {
    8112. -
    8113. $this->debug('in invoke_method, calling function using call_user_func_array()');
    8114. -
    8115. $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array()
    8116. -
    8117. } elseif ($delim == '..') {
    8118. -
    8119. $this->debug('in invoke_method, calling class method using call_user_func_array()');
    8120. -
    8121. $call_arg = array ($class, $method);
    8122. -
    8123. } else {
    8124. -
    8125. $this->debug('in invoke_method, calling instance method using call_user_func_array()');
    8126. -
    8127. $instance = new $class ();
    8128. -
    8129. $call_arg = array(&$instance, $method);
    8130. -
    8131. }
    8132. -
    8133. if (is_array($this->methodparams)) {
    8134. -
    8135. $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams));
    8136. -
    8137. } else {
    8138. -
    8139. $this->methodreturn = call_user_func_array($call_arg, array());
    8140. -
    8141. }
    8142. -
    8143. }
    8144. -
    8145. $this->debug('in invoke_method, methodreturn:');
    8146. -
    8147. $this->appendDebug($this->varDump($this->methodreturn));
    8148. -
    8149. $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn));
    8150. -
    8151. }
    8152. -
    8153.  
    8154. -
    8155. /**
    8156. -
    8157. * serializes the return value from a PHP function into a full SOAP Envelope
    8158. -
    8159. *
    8160. -
    8161. * The following fields are set by this function (when successful)
    8162. -
    8163. *
    8164. -
    8165. * responseSOAP
    8166. -
    8167. *
    8168. -
    8169. * This sets the fault field on error
    8170. -
    8171. *
    8172. -
    8173. * @access private
    8174. -
    8175. */
    8176. -
    8177. function serialize_return() {
    8178. -
    8179. $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
    8180. -
    8181. // if fault
    8182. -
    8183. if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
    8184. -
    8185. $this->debug('got a fault object from method');
    8186. -
    8187. $this->fault = $this->methodreturn;
    8188. -
    8189. return;
    8190. -
    8191. } elseif ($this->methodreturnisliteralxml) {
    8192. -
    8193. $return_val = $this->methodreturn;
    8194. -
    8195. // returned value(s)
    8196. -
    8197. } else {
    8198. -
    8199. $this->debug('got a(n) '.gettype($this->methodreturn).' from method');
    8200. -
    8201. $this->debug('serializing return value');
    8202. -
    8203. if($this->wsdl){
    8204. -
    8205. if (sizeof($this->opData['output']['parts']) > 1) {
    8206. -
    8207. $this->debug('more than one output part, so use the method return unchanged');
    8208. -
    8209. $opParams = $this->methodreturn;
    8210. -
    8211. } elseif (sizeof($this->opData['output']['parts']) == 1) {
    8212. -
    8213. $this->debug('exactly one output part, so wrap the method return in a simple array');
    8214. -
    8215. // TODO: verify that it is not already wrapped!
    8216. -
    8217. //foreach ($this->opData['output']['parts'] as $name => $type) {
    8218. -
    8219. // $this->debug('wrap in element named ' . $name);
    8220. -
    8221. //}
    8222. -
    8223. $opParams = array($this->methodreturn);
    8224. -
    8225. }
    8226. -
    8227. $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
    8228. -
    8229. $this->appendDebug($this->wsdl->getDebug());
    8230. -
    8231. $this->wsdl->clearDebug();
    8232. -
    8233. if($errstr = $this->wsdl->getError()){
    8234. -
    8235. $this->debug('got wsdl error: '.$errstr);
    8236. -
    8237. $this->fault('SOAP-ENV:Server', 'unable to serialize result');
    8238. -
    8239. return;
    8240. -
    8241. }
    8242. -
    8243. } else {
    8244. -
    8245. if (isset($this->methodreturn)) {
    8246. -
    8247. $return_val = $this->serialize_val($this->methodreturn, 'return');
    8248. -
    8249. } else {
    8250. -
    8251. $return_val = '';
    8252. -
    8253. $this->debug('in absence of WSDL, assume void return for backward compatibility');
    8254. -
    8255. }
    8256. -
    8257. }
    8258. -
    8259. }
    8260. -
    8261. $this->debug('return value:');
    8262. -
    8263. $this->appendDebug($this->varDump($return_val));
    8264. -
    8265.  
    8266. -
    8267. $this->debug('serializing response');
    8268. -
    8269. if ($this->wsdl) {
    8270. -
    8271. $this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
    8272. -
    8273. if ($this->opData['style'] == 'rpc') {
    8274. -
    8275. $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
    8276. -
    8277. if ($this->opData['output']['use'] == 'literal') {
    8278. -
    8279. // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
    8280. -
    8281. if ($this->methodURI) {
    8282. -
    8283. $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
    8284. -
    8285. } else {
    8286. -
    8287. $payload = '<'.$this->methodname.'Response>'.$return_val.'</'.$this->methodname.'Response>';
    8288. -
    8289. }
    8290. -
    8291. } else {
    8292. -
    8293. if ($this->methodURI) {
    8294. -
    8295. $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
    8296. -
    8297. } else {
    8298. -
    8299. $payload = '<'.$this->methodname.'Response>'.$return_val.'</'.$this->methodname.'Response>';
    8300. -
    8301. }
    8302. -
    8303. }
    8304. -
    8305. } else {
    8306. -
    8307. $this->debug('style is not rpc for serialization: assume document');
    8308. -
    8309. $payload = $return_val;
    8310. -
    8311. }
    8312. -
    8313. } else {
    8314. -
    8315. $this->debug('do not have WSDL for serialization: assume rpc/encoded');
    8316. -
    8317. $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
    8318. -
    8319. }
    8320. -
    8321. $this->result = 'successful';
    8322. -
    8323. if($this->wsdl){
    8324. -
    8325. //if($this->debug_flag){
    8326. -
    8327. $this->appendDebug($this->wsdl->getDebug());
    8328. -
    8329. // }
    8330. -
    8331. if (isset($this->opData['output']['encodingStyle'])) {
    8332. -
    8333. $encodingStyle = $this->opData['output']['encodingStyle'];
    8334. -
    8335. } else {
    8336. -
    8337. $encodingStyle = '';
    8338. -
    8339. }
    8340. -
    8341. // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
    8342. -
    8343. $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle);
    8344. -
    8345. } else {
    8346. -
    8347. $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
    8348. -
    8349. }
    8350. -
    8351. $this->debug("Leaving serialize_return");
    8352. -
    8353. }
    8354. -
    8355.  
    8356. -
    8357. /**
    8358. -
    8359. * sends an HTTP response
    8360. -
    8361. *
    8362. -
    8363. * The following fields are set by this function (when successful)
    8364. -
    8365. *
    8366. -
    8367. * outgoing_headers
    8368. -
    8369. * response
    8370. -
    8371. *
    8372. -
    8373. * @access private
    8374. -
    8375. */
    8376. -
    8377. function send_response() {
    8378. -
    8379. $this->debug('Enter send_response');
    8380. -
    8381. if ($this->fault) {
    8382. -
    8383. $payload = $this->fault->serialize();
    8384. -
    8385. $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
    8386. -
    8387. $this->outgoing_headers[] = "Status: 500 Internal Server Error";
    8388. -
    8389. } else {
    8390. -
    8391. $payload = $this->responseSOAP;
    8392. -
    8393. // Some combinations of PHP+Web server allow the Status
    8394. -
    8395. // to come through as a header. Since OK is the default
    8396. -
    8397. // just do nothing.
    8398. -
    8399. // $this->outgoing_headers[] = "HTTP/1.0 200 OK";
    8400. -
    8401. // $this->outgoing_headers[] = "Status: 200 OK";
    8402. -
    8403. }
    8404. -
    8405. // add debug data if in debug mode
    8406. -
    8407. if(isset($this->debug_flag) && $this->debug_flag){
    8408. -
    8409. $payload .= $this->getDebugAsXMLComment();
    8410. -
    8411. }
    8412. -
    8413. $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
    8414. -
    8415. preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
    8416. -
    8417. $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
    8418. -
    8419. // Let the Web server decide about this
    8420. -
    8421. //$this->outgoing_headers[] = "Connection: Close\r\n";
    8422. -
    8423. $payload = $this->getHTTPBody($payload);
    8424. -
    8425. $type = $this->getHTTPContentType();
    8426. -
    8427. $charset = $this->getHTTPContentTypeCharset();
    8428. -
    8429. $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
    8430. -
    8431. //begin code to compress payload - by John
    8432. -
    8433. // NOTE: there is no way to know whether the Web server will also compress
    8434. -
    8435. // this data.
    8436. -
    8437. if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
    8438. -
    8439. if (strstr($this->headers['accept-encoding'], 'gzip')) {
    8440. -
    8441. if (function_exists('gzencode')) {
    8442. -
    8443. if (isset($this->debug_flag) && $this->debug_flag) {
    8444. -
    8445. $payload .= "<!-- Content being gzipped -->";
    8446. -
    8447. }
    8448. -
    8449. $this->outgoing_headers[] = "Content-Encoding: gzip";
    8450. -
    8451. $payload = gzencode($payload);
    8452. -
    8453. } else {
    8454. -
    8455. if (isset($this->debug_flag) && $this->debug_flag) {
    8456. -
    8457. $payload .= "<!-- Content will not be gzipped: no gzencode -->";
    8458. -
    8459. }
    8460. -
    8461. }
    8462. -
    8463. } elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
    8464. -
    8465. // Note: MSIE requires gzdeflate output (no Zlib header and checksum),
    8466. -
    8467. // instead of gzcompress output,
    8468. -
    8469. // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5)
    8470. -
    8471. if (function_exists('gzdeflate')) {
    8472. -
    8473. if (isset($this->debug_flag) && $this->debug_flag) {
    8474. -
    8475. $payload .= "<!-- Content being deflated -->";
    8476. -
    8477. }
    8478. -
    8479. $this->outgoing_headers[] = "Content-Encoding: deflate";
    8480. -
    8481. $payload = gzdeflate($payload);
    8482. -
    8483. } else {
    8484. -
    8485. if (isset($this->debug_flag) && $this->debug_flag) {
    8486. -
    8487. $payload .= "<!-- Content will not be deflated: no gzcompress -->";
    8488. -
    8489. }
    8490. -
    8491. }
    8492. -
    8493. }
    8494. -
    8495. }
    8496. -
    8497. //end code
    8498. -
    8499. $this->outgoing_headers[] = "Content-Length: ".strlen($payload);
    8500. -
    8501. reset($this->outgoing_headers);
    8502. -
    8503. foreach($this->outgoing_headers as $hdr){
    8504. -
    8505. header($hdr, false);
    8506. -
    8507. }
    8508. -
    8509. print $payload;
    8510. -
    8511. $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
    8512. -
    8513. }
    8514. -
    8515.  
    8516. -
    8517. /**
    8518. -
    8519. * takes the value that was created by parsing the request
    8520. -
    8521. * and compares to the method's signature, if available.
    8522. -
    8523. *
    8524. -
    8525. * @param string $operation The operation to be invoked
    8526. -
    8527. * @param array $request The array of parameter values
    8528. -
    8529. * @return boolean Whether the operation was found
    8530. -
    8531. * @access private
    8532. -
    8533. */
    8534. -
    8535. function verify_method($operation,$request){
    8536. -
    8537. if(isset($this->wsdl) && is_object($this->wsdl)){
    8538. -
    8539. if($this->wsdl->getOperationData($operation)){
    8540. -
    8541. return true;
    8542. -
    8543. }
    8544. -
    8545. } elseif(isset($this->operations[$operation])){
    8546. -
    8547. return true;
    8548. -
    8549. }
    8550. -
    8551. return false;
    8552. -
    8553. }
    8554. -
    8555.  
    8556. -
    8557. /**
    8558. -
    8559. * processes SOAP message received from client
    8560. -
    8561. *
    8562. -
    8563. * @param array $headers The HTTP headers
    8564. -
    8565. * @param string $data unprocessed request data from client
    8566. -
    8567. * @return mixed value of the message, decoded into a PHP type
    8568. -
    8569. * @access private
    8570. -
    8571. */
    8572. -
    8573. function parseRequest($headers, $data) {
    8574. -
    8575. $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:');
    8576. -
    8577. $this->appendDebug($this->varDump($headers));
    8578. -
    8579. if (!isset($headers['content-type'])) {
    8580. -
    8581. $this->setError('Request not of type text/xml (no content-type header)');
    8582. -
    8583. return false;
    8584. -
    8585. }
    8586. -
    8587. if (!strstr($headers['content-type'], 'text/xml')) {
    8588. -
    8589. $this->setError('Request not of type text/xml');
    8590. -
    8591. return false;
    8592. -
    8593. }
    8594. -
    8595. if (strpos($headers['content-type'], '=')) {
    8596. -
    8597. $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
    8598. -
    8599. $this->debug('Got response encoding: ' . $enc);
    8600. -
    8601. if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
    8602. -
    8603. $this->xml_encoding = strtoupper($enc);
    8604. -
    8605. } else {
    8606. -
    8607. $this->xml_encoding = 'US-ASCII';
    8608. -
    8609. }
    8610. -
    8611. } else {
    8612. -
    8613. // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
    8614. -
    8615. $this->xml_encoding = 'ISO-8859-1';
    8616. -
    8617. }
    8618. -
    8619. $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
    8620. -
    8621. // parse response, get soap parser obj
    8622. -
    8623. $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
    8624. -
    8625. // parser debug
    8626. -
    8627. $this->debug("parser debug: \n".$parser->getDebug());
    8628. -
    8629. // if fault occurred during message parsing
    8630. -
    8631. if($err = $parser->getError()){
    8632. -
    8633. $this->result = 'fault: error in msg parsing: '.$err;
    8634. -
    8635. $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err);
    8636. -
    8637. // else successfully parsed request into soapval object
    8638. -
    8639. } else {
    8640. -
    8641. // get/set methodname
    8642. -
    8643. $this->methodURI = $parser->root_struct_namespace;
    8644. -
    8645. $this->methodname = $parser->root_struct_name;
    8646. -
    8647. $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
    8648. -
    8649. $this->debug('calling parser->get_soapbody()');
    8650. -
    8651. $this->methodparams = $parser->get_soapbody();
    8652. -
    8653. // get SOAP headers
    8654. -
    8655. $this->requestHeaders = $parser->getHeaders();
    8656. -
    8657. // get SOAP Header
    8658. -
    8659. $this->requestHeader = $parser->get_soapheader();
    8660. -
    8661. // add document for doclit support
    8662. -
    8663. $this->document = $parser->document;
    8664. -
    8665. }
    8666. -
    8667. }
    8668. -
    8669.  
    8670. -
    8671. /**
    8672. -
    8673. * gets the HTTP body for the current response.
    8674. -
    8675. *
    8676. -
    8677. * @param string $soapmsg The SOAP payload
    8678. -
    8679. * @return string The HTTP body, which includes the SOAP payload
    8680. -
    8681. * @access private
    8682. -
    8683. */
    8684. -
    8685. function getHTTPBody($soapmsg) {
    8686. -
    8687. return $soapmsg;
    8688. -
    8689. }
    8690. -
    8691. -
    8692. /**
    8693. -
    8694. * gets the HTTP content type for the current response.
    8695. -
    8696. *
    8697. -
    8698. * Note: getHTTPBody must be called before this.
    8699. -
    8700. *
    8701. -
    8702. * @return string the HTTP content type for the current response.
    8703. -
    8704. * @access private
    8705. -
    8706. */
    8707. -
    8708. function getHTTPContentType() {
    8709. -
    8710. return 'text/xml';
    8711. -
    8712. }
    8713. -
    8714. -
    8715. /**
    8716. -
    8717. * gets the HTTP content type charset for the current response.
    8718. -
    8719. * returns false for non-text content types.
    8720. -
    8721. *
    8722. -
    8723. * Note: getHTTPBody must be called before this.
    8724. -
    8725. *
    8726. -
    8727. * @return string the HTTP content type charset for the current response.
    8728. -
    8729. * @access private
    8730. -
    8731. */
    8732. -
    8733. function getHTTPContentTypeCharset() {
    8734. -
    8735. return $this->soap_defencoding;
    8736. -
    8737. }
    8738. -
    8739.  
    8740. -
    8741. /**
    8742. -
    8743. * add a method to the dispatch map (this has been replaced by the register method)
    8744. -
    8745. *
    8746. -
    8747. * @param string $methodname
    8748. -
    8749. * @param string $in array of input values
    8750. -
    8751. * @param string $out array of output values
    8752. -
    8753. * @access public
    8754. -
    8755. * @deprecated
    8756. -
    8757. */
    8758. -
    8759. function add_to_map($methodname,$in,$out){
    8760. -
    8761. $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
    8762. -
    8763. }
    8764. -
    8765.  
    8766. -
    8767. /**
    8768. -
    8769. * register a service function with the server
    8770. -
    8771. *
    8772. -
    8773. * @param string $name the name of the PHP function, class.method or class..method
    8774. -
    8775. * @param array $in assoc array of input values: key = param name, value = param type
    8776. -
    8777. * @param array $out assoc array of output values: key = param name, value = param type
    8778. -
    8779. * @param mixed $namespace the element namespace for the method or false
    8780. -
    8781. * @param mixed $soapaction the soapaction for the method or false
    8782. -
    8783. * @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
    8784. -
    8785. * @param mixed $use optional (encoded|literal) or false
    8786. -
    8787. * @param string $documentation optional Description to include in WSDL
    8788. -
    8789. * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
    8790. -
    8791. * @access public
    8792. -
    8793. */
    8794. -
    8795. function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){
    8796. -
    8797. global $HTTP_SERVER_VARS;
    8798. -
    8799.  
    8800. -
    8801. if($this->externalWSDLURL){
    8802. -
    8803. die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
    8804. -
    8805. }
    8806. -
    8807. if (! $name) {
    8808. -
    8809. die('You must specify a name when you register an operation');
    8810. -
    8811. }
    8812. -
    8813. if (!is_array($in)) {
    8814. -
    8815. die('You must provide an array for operation inputs');
    8816. -
    8817. }
    8818. -
    8819. if (!is_array($out)) {
    8820. -
    8821. die('You must provide an array for operation outputs');
    8822. -
    8823. }
    8824. -
    8825. if(false == $namespace) {
    8826. -
    8827. }
    8828. -
    8829. if(false == $soapaction) {
    8830. -
    8831. if (isset($_SERVER)) {
    8832. -
    8833. $SERVER_NAME = $_SERVER['SERVER_NAME'];
    8834. -
    8835. $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
    8836. -
    8837. $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
    8838. -
    8839. } elseif (isset($HTTP_SERVER_VARS)) {
    8840. -
    8841. $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
    8842. -
    8843. $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
    8844. -
    8845. $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
    8846. -
    8847. } else {
    8848. -
    8849. $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
    8850. -
    8851. }
    8852. -
    8853. if ($HTTPS == '1' || $HTTPS == 'on') {
    8854. -
    8855. $SCHEME = 'https';
    8856. -
    8857. } else {
    8858. -
    8859. $SCHEME = 'http';
    8860. -
    8861. }
    8862. -
    8863. $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name";
    8864. -
    8865. }
    8866. -
    8867. if(false == $style) {
    8868. -
    8869. $style = "rpc";
    8870. -
    8871. }
    8872. -
    8873. if(false == $use) {
    8874. -
    8875. $use = "encoded";
    8876. -
    8877. }
    8878. -
    8879. if ($use == 'encoded' && $encodingStyle == '') {
    8880. -
    8881. $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
    8882. -
    8883. }
    8884. -
    8885.  
    8886. -
    8887. $this->operations[$name] = array(
    8888. -
    8889. 'name' => $name,
    8890. -
    8891. 'in' => $in,
    8892. -
    8893. 'out' => $out,
    8894. -
    8895. 'namespace' => $namespace,
    8896. -
    8897. 'soapaction' => $soapaction,
    8898. -
    8899. 'style' => $style);
    8900. -
    8901. if($this->wsdl){
    8902. -
    8903. $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle);
    8904. -
    8905. }
    8906. -
    8907. return true;
    8908. -
    8909. }
    8910. -
    8911.  
    8912. -
    8913. /**
    8914. -
    8915. * Specify a fault to be returned to the client.
    8916. -
    8917. * This also acts as a flag to the server that a fault has occured.
    8918. -
    8919. *
    8920. -
    8921. * @param string $faultcode
    8922. -
    8923. * @param string $faultstring
    8924. -
    8925. * @param string $faultactor
    8926. -
    8927. * @param string $faultdetail
    8928. -
    8929. * @access public
    8930. -
    8931. */
    8932. -
    8933. function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){
    8934. -
    8935. if ($faultdetail == '' && $this->debug_flag) {
    8936. -
    8937. $faultdetail = $this->getDebug();
    8938. -
    8939. }
    8940. -
    8941. $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
    8942. -
    8943. $this->fault->soap_defencoding = $this->soap_defencoding;
    8944. -
    8945. }
    8946. -
    8947.  
    8948. -
    8949. /**
    8950. -
    8951. * Sets up wsdl object.
    8952. -
    8953. * Acts as a flag to enable internal WSDL generation
    8954. -
    8955. *
    8956. -
    8957. * @param string $serviceName, name of the service
    8958. -
    8959. * @param mixed $namespace optional 'tns' service namespace or false
    8960. -
    8961. * @param mixed $endpoint optional URL of service endpoint or false
    8962. -
    8963. * @param string $style optional (rpc|document) WSDL style (also specified by operation)
    8964. -
    8965. * @param string $transport optional SOAP transport
    8966. -
    8967. * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false
    8968. -
    8969. */
    8970. -
    8971. function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
    8972. -
    8973. {
    8974. -
    8975. global $HTTP_SERVER_VARS;
    8976. -
    8977.  
    8978. -
    8979. if (isset($_SERVER)) {
    8980. -
    8981. $SERVER_NAME = $_SERVER['SERVER_NAME'];
    8982. -
    8983. $SERVER_PORT = $_SERVER['SERVER_PORT'];
    8984. -
    8985. $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
    8986. -
    8987. $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
    8988. -
    8989. } elseif (isset($HTTP_SERVER_VARS)) {
    8990. -
    8991. $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
    8992. -
    8993. $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
    8994. -
    8995. $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
    8996. -
    8997. $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
    8998. -
    8999. } else {
    9000. -
    9001. $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
    9002. -
    9003. }
    9004. -
    9005. // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI)
    9006. -
    9007. $colon = strpos($SERVER_NAME,":");
    9008. -
    9009. if ($colon) {
    9010. -
    9011. $SERVER_NAME = substr($SERVER_NAME, 0, $colon);
    9012. -
    9013. }
    9014. -
    9015. if ($SERVER_PORT == 80) {
    9016. -
    9017. $SERVER_PORT = '';
    9018. -
    9019. } else {
    9020. -
    9021. $SERVER_PORT = ':' . $SERVER_PORT;
    9022. -
    9023. }
    9024. -
    9025. if(false == $namespace) {
    9026. -
    9027. $namespace = "http://$SERVER_NAME/soap/$serviceName";
    9028. -
    9029. }
    9030. -
    9031. -
    9032. if(false == $endpoint) {
    9033. -
    9034. if ($HTTPS == '1' || $HTTPS == 'on') {
    9035. -
    9036. $SCHEME = 'https';
    9037. -
    9038. } else {
    9039. -
    9040. $SCHEME = 'http';
    9041. -
    9042. }
    9043. -
    9044. $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
    9045. -
    9046. }
    9047. -
    9048. -
    9049. if(false == $schemaTargetNamespace) {
    9050. -
    9051. $schemaTargetNamespace = $namespace;
    9052. -
    9053. }
    9054. -
    9055. -
    9056. $this->wsdl = new wsdl;
    9057. -
    9058. $this->wsdl->serviceName = $serviceName;
    9059. -
    9060. $this->wsdl->endpoint = $endpoint;
    9061. -
    9062. $this->wsdl->namespaces['tns'] = $namespace;
    9063. -
    9064. $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
    9065. -
    9066. $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
    9067. -
    9068. if ($schemaTargetNamespace != $namespace) {
    9069. -
    9070. $this->wsdl->namespaces['types'] = $schemaTargetNamespace;
    9071. -
    9072. }
    9073. -
    9074. $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces);
    9075. -
    9076. if ($style == 'document') {
    9077. -
    9078. $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified';
    9079. -
    9080. }
    9081. -
    9082. $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
    9083. -
    9084. $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true);
    9085. -
    9086. $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true);
    9087. -
    9088. $this->wsdl->bindings[$serviceName.'Binding'] = array(
    9089. -
    9090. 'name'=>$serviceName.'Binding',
    9091. -
    9092. 'style'=>$style,
    9093. -
    9094. 'transport'=>$transport,
    9095. -
    9096. 'portType'=>$serviceName.'PortType');
    9097. -
    9098. $this->wsdl->ports[$serviceName.'Port'] = array(
    9099. -
    9100. 'binding'=>$serviceName.'Binding',
    9101. -
    9102. 'location'=>$endpoint,
    9103. -
    9104. 'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/');
    9105. -
    9106. }
    9107. -
    9108. }
    9109. -
    9110.  
    9111. -
    9112. /**
    9113. -
    9114. * Backward compatibility
    9115. -
    9116. */
    9117. -
    9118. class soap_server extends nusoap_server {
    9119. -
    9120. }
    9121. -
    9122.  
    9123. -
    9124. ?><?php
    9125. -
    9126.  
    9127. -
    9128.  
    9129. -
    9130.  
    9131. -
    9132. /**
    9133. -
    9134. * parses a WSDL file, allows access to it's data, other utility methods.
    9135. -
    9136. * also builds WSDL structures programmatically.
    9137. -
    9138. *
    9139. -
    9140. * @author Dietrich Ayala <dietrich@ganx4.com>
    9141. -
    9142. * @author Scott Nichol <snichol@users.sourceforge.net>
    9143. -
    9144. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    9145. -
    9146. * @access public
    9147. -
    9148. */
    9149. -
    9150. class wsdl extends nusoap_base {
    9151. -
    9152. // URL or filename of the root of this WSDL
    9153. -
    9154. -
    9155. var $wsdl;
    9156. -
    9157. // define internal arrays of bindings, ports, operations, messages, etc.
    9158. -
    9159. -
    9160. var $schemas = array();
    9161. -
    9162. var $currentSchema;
    9163. -
    9164. var $message = array();
    9165. -
    9166. var $complexTypes = array();
    9167. -
    9168. var $messages = array();
    9169. -
    9170. var $currentMessage;
    9171. -
    9172. var $currentOperation;
    9173. -
    9174. var $portTypes = array();
    9175. -
    9176. var $currentPortType;
    9177. -
    9178. var $bindings = array();
    9179. -
    9180. var $currentBinding;
    9181. -
    9182. var $ports = array();
    9183. -
    9184. var $currentPort;
    9185. -
    9186. var $opData = array();
    9187. -
    9188. var $status = '';
    9189. -
    9190. var $documentation = false;
    9191. -
    9192. var $endpoint = '';
    9193. -
    9194. // array of wsdl docs to import
    9195. -
    9196. -
    9197. var $import = array();
    9198. -
    9199. // parser vars
    9200. -
    9201. -
    9202. var $parser;
    9203. -
    9204. var $position = 0;
    9205. -
    9206. var $depth = 0;
    9207. -
    9208. var $depth_array = array();
    9209. -
    9210. // for getting wsdl
    9211. -
    9212. -
    9213. var $proxyhost = '';
    9214. -
    9215. var $proxyport = '';
    9216. -
    9217. var $proxyusername = '';
    9218. -
    9219. var $proxypassword = '';
    9220. -
    9221. var $timeout = 0;
    9222. -
    9223. var $response_timeout = 30;
    9224. -
    9225. var $curl_options = array(); // User-specified cURL options
    9226. -
    9227. -
    9228. var $use_curl = false; // whether to always try to use cURL
    9229. -
    9230. // for HTTP authentication
    9231. -
    9232. -
    9233. var $username = ''; // Username for HTTP authentication
    9234. -
    9235. -
    9236. var $password = ''; // Password for HTTP authentication
    9237. -
    9238. -
    9239. var $authtype = ''; // Type of HTTP authentication
    9240. -
    9241. -
    9242. var $certRequest = array(); // Certificate for HTTP SSL authentication
    9243. -
    9244.  
    9245. -
    9246. -
    9247.  
    9248. -
    9249. /**
    9250. -
    9251. * constructor
    9252. -
    9253. *
    9254. -
    9255. * @param string $wsdl WSDL document URL
    9256. -
    9257. * @param string $proxyhost
    9258. -
    9259. * @param string $proxyport
    9260. -
    9261. * @param string $proxyusername
    9262. -
    9263. * @param string $proxypassword
    9264. -
    9265. * @param integer $timeout set the connection timeout
    9266. -
    9267. * @param integer $response_timeout set the response timeout
    9268. -
    9269. * @param array $curl_options user-specified cURL options
    9270. -
    9271. * @param boolean $use_curl try to use cURL
    9272. -
    9273. * @access public
    9274. -
    9275. */
    9276. -
    9277. function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
    9278. -
    9279. parent::nusoap_base();
    9280. -
    9281. $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
    9282. -
    9283. $this->proxyhost = $proxyhost;
    9284. -
    9285. $this->proxyport = $proxyport;
    9286. -
    9287. $this->proxyusername = $proxyusername;
    9288. -
    9289. $this->proxypassword = $proxypassword;
    9290. -
    9291. $this->timeout = $timeout;
    9292. -
    9293. $this->response_timeout = $response_timeout;
    9294. -
    9295. if (is_array($curl_options))
    9296. -
    9297. $this->curl_options = $curl_options;
    9298. -
    9299. $this->use_curl = $use_curl;
    9300. -
    9301. $this->fetchWSDL($wsdl);
    9302. -
    9303. }
    9304. -
    9305.  
    9306. -
    9307. /**
    9308. -
    9309. * fetches the WSDL document and parses it
    9310. -
    9311. *
    9312. -
    9313. * @access public
    9314. -
    9315. */
    9316. -
    9317. function fetchWSDL($wsdl) {
    9318. -
    9319. $this->debug("parse and process WSDL path=$wsdl");
    9320. -
    9321. $this->wsdl = $wsdl;
    9322. -
    9323. // parse wsdl file
    9324. -
    9325. if ($this->wsdl != "") {
    9326. -
    9327. $this->parseWSDL($this->wsdl);
    9328. -
    9329. }
    9330. -
    9331. // imports
    9332. -
    9333. // TODO: handle imports more properly, grabbing them in-line and nesting them
    9334. -
    9335. $imported_urls = array();
    9336. -
    9337. $imported = 1;
    9338. -
    9339. while ($imported > 0) {
    9340. -
    9341. $imported = 0;
    9342. -
    9343. // Schema imports
    9344. -
    9345. foreach ($this->schemas as $ns => $list) {
    9346. -
    9347. foreach ($list as $xs) {
    9348. -
    9349. $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
    9350. -
    9351. foreach ($xs->imports as $ns2 => $list2) {
    9352. -
    9353. for ($ii = 0; $ii < count($list2); $ii++) {
    9354. -
    9355. if (! $list2[$ii]['loaded']) {
    9356. -
    9357. $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
    9358. -
    9359. $url = $list2[$ii]['location'];
    9360. -
    9361. if ($url != '') {
    9362. -
    9363. $urlparts = parse_url($url);
    9364. -
    9365. if (!isset($urlparts['host'])) {
    9366. -
    9367. $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') .
    9368. -
    9369. substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
    9370. -
    9371. }
    9372. -
    9373. if (! in_array($url, $imported_urls)) {
    9374. -
    9375. $this->parseWSDL($url);
    9376. -
    9377. $imported++;
    9378. -
    9379. $imported_urls[] = $url;
    9380. -
    9381. }
    9382. -
    9383. } else {
    9384. -
    9385. $this->debug("Unexpected scenario: empty URL for unloaded import");
    9386. -
    9387. }
    9388. -
    9389. }
    9390. -
    9391. }
    9392. -
    9393. }
    9394. -
    9395. }
    9396. -
    9397. }
    9398. -
    9399. // WSDL imports
    9400. -
    9401. $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
    9402. -
    9403. foreach ($this->import as $ns => $list) {
    9404. -
    9405. for ($ii = 0; $ii < count($list); $ii++) {
    9406. -
    9407. if (! $list[$ii]['loaded']) {
    9408. -
    9409. $this->import[$ns][$ii]['loaded'] = true;
    9410. -
    9411. $url = $list[$ii]['location'];
    9412. -
    9413. if ($url != '') {
    9414. -
    9415. $urlparts = parse_url($url);
    9416. -
    9417. if (!isset($urlparts['host'])) {
    9418. -
    9419. $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
    9420. -
    9421. substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
    9422. -
    9423. }
    9424. -
    9425. if (! in_array($url, $imported_urls)) {
    9426. -
    9427. $this->parseWSDL($url);
    9428. -
    9429. $imported++;
    9430. -
    9431. $imported_urls[] = $url;
    9432. -
    9433. }
    9434. -
    9435. } else {
    9436. -
    9437. $this->debug("Unexpected scenario: empty URL for unloaded import");
    9438. -
    9439. }
    9440. -
    9441. }
    9442. -
    9443. }
    9444. -
    9445. }
    9446. -
    9447. }
    9448. -
    9449. // add new data to operation data
    9450. -
    9451. foreach($this->bindings as $binding => $bindingData) {
    9452. -
    9453. if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
    9454. -
    9455. foreach($bindingData['operations'] as $operation => $data) {
    9456. -
    9457. $this->debug('post-parse data gathering for ' . $operation);
    9458. -
    9459. $this->bindings[$binding]['operations'][$operation]['input'] =
    9460. -
    9461. isset($this->bindings[$binding]['operations'][$operation]['input']) ?
    9462. -
    9463. array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
    9464. -
    9465. $this->portTypes[ $bindingData['portType'] ][$operation]['input'];
    9466. -
    9467. $this->bindings[$binding]['operations'][$operation]['output'] =
    9468. -
    9469. isset($this->bindings[$binding]['operations'][$operation]['output']) ?
    9470. -
    9471. array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
    9472. -
    9473. $this->portTypes[ $bindingData['portType'] ][$operation]['output'];
    9474. -
    9475. if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){
    9476. -
    9477. $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
    9478. -
    9479. }
    9480. -
    9481. if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){
    9482. -
    9483. $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
    9484. -
    9485. }
    9486. -
    9487. // Set operation style if necessary, but do not override one already provided
    9488. -
    9489. if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) {
    9490. -
    9491. $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
    9492. -
    9493. }
    9494. -
    9495. $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
    9496. -
    9497. $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
    9498. -
    9499. $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
    9500. -
    9501. }
    9502. -
    9503. }
    9504. -
    9505. }
    9506. -
    9507. }
    9508. -
    9509.  
    9510. -
    9511. /**
    9512. -
    9513. * parses the wsdl document
    9514. -
    9515. *
    9516. -
    9517. * @param string $wsdl path or URL
    9518. -
    9519. * @access private
    9520. -
    9521. */
    9522. -
    9523. function parseWSDL($wsdl = '') {
    9524. -
    9525. $this->debug("parse WSDL at path=$wsdl");
    9526. -
    9527.  
    9528. -
    9529. if ($wsdl == '') {
    9530. -
    9531. $this->debug('no wsdl passed to parseWSDL()!!');
    9532. -
    9533. $this->setError('no wsdl passed to parseWSDL()!!');
    9534. -
    9535. return false;
    9536. -
    9537. }
    9538. -
    9539. -
    9540. // parse $wsdl for url format
    9541. -
    9542. $wsdl_props = parse_url($wsdl);
    9543. -
    9544.  
    9545. -
    9546. if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
    9547. -
    9548. $this->debug('getting WSDL http(s) URL ' . $wsdl);
    9549. -
    9550. // get wsdl
    9551. -
    9552. $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl);
    9553. -
    9554. $tr->request_method = 'GET';
    9555. -
    9556. $tr->useSOAPAction = false;
    9557. -
    9558. if($this->proxyhost && $this->proxyport){
    9559. -
    9560. $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
    9561. -
    9562. }
    9563. -
    9564. if ($this->authtype != '') {
    9565. -
    9566. $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
    9567. -
    9568. }
    9569. -
    9570. $tr->setEncoding('gzip, deflate');
    9571. -
    9572. $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
    9573. -
    9574. //$this->debug("WSDL request\n" . $tr->outgoing_payload);
    9575. -
    9576. //$this->debug("WSDL response\n" . $tr->incoming_payload);
    9577. -
    9578. $this->appendDebug($tr->getDebug());
    9579. -
    9580. // catch errors
    9581. -
    9582. if($err = $tr->getError() ){
    9583. -
    9584. $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err;
    9585. -
    9586. $this->debug($errstr);
    9587. -
    9588. $this->setError($errstr);
    9589. -
    9590. unset($tr);
    9591. -
    9592. return false;
    9593. -
    9594. }
    9595. -
    9596. unset($tr);
    9597. -
    9598. $this->debug("got WSDL URL");
    9599. -
    9600. } else {
    9601. -
    9602. // $wsdl is not http(s), so treat it as a file URL or plain file path
    9603. -
    9604. if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
    9605. -
    9606. $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
    9607. -
    9608. } else {
    9609. -
    9610. $path = $wsdl;
    9611. -
    9612. }
    9613. -
    9614. $this->debug('getting WSDL file ' . $path);
    9615. -
    9616. if ($fp = @fopen($path, 'r')) {
    9617. -
    9618. $wsdl_string = '';
    9619. -
    9620. while ($data = fread($fp, 32768)) {
    9621. -
    9622. $wsdl_string .= $data;
    9623. -
    9624. }
    9625. -
    9626. fclose($fp);
    9627. -
    9628. } else {
    9629. -
    9630. $errstr = "Bad path to WSDL file $path";
    9631. -
    9632. $this->debug($errstr);
    9633. -
    9634. $this->setError($errstr);
    9635. -
    9636. return false;
    9637. -
    9638. }
    9639. -
    9640. }
    9641. -
    9642. $this->debug('Parse WSDL');
    9643. -
    9644. // end new code added
    9645. -
    9646. // Create an XML parser.
    9647. -
    9648. $this->parser = xml_parser_create();
    9649. -
    9650. // Set the options for parsing the XML data.
    9651. -
    9652. // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    9653. -
    9654. xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    9655. -
    9656. // Set the object for the parser.
    9657. -
    9658. xml_set_object($this->parser, $this);
    9659. -
    9660. // Set the element handlers for the parser.
    9661. -
    9662. xml_set_element_handler($this->parser, 'start_element', 'end_element');
    9663. -
    9664. xml_set_character_data_handler($this->parser, 'character_data');
    9665. -
    9666. // Parse the XML file.
    9667. -
    9668. if (!xml_parse($this->parser, $wsdl_string, true)) {
    9669. -
    9670. // Display an error message.
    9671. -
    9672. $errstr = sprintf(
    9673. -
    9674. 'XML error parsing WSDL from %s on line %d: %s',
    9675. -
    9676. $wsdl,
    9677. -
    9678. xml_get_current_line_number($this->parser),
    9679. -
    9680. xml_error_string(xml_get_error_code($this->parser))
    9681. -
    9682. );
    9683. -
    9684. $this->debug($errstr);
    9685. -
    9686. $this->debug("XML payload:\n" . $wsdl_string);
    9687. -
    9688. $this->setError($errstr);
    9689. -
    9690. return false;
    9691. -
    9692. }
    9693. -
    9694. // free the parser
    9695. -
    9696. xml_parser_free($this->parser);
    9697. -
    9698. $this->debug('Parsing WSDL done');
    9699. -
    9700. // catch wsdl parse errors
    9701. -
    9702. if($this->getError()){
    9703. -
    9704. return false;
    9705. -
    9706. }
    9707. -
    9708. return true;
    9709. -
    9710. }
    9711. -
    9712.  
    9713. -
    9714. /**
    9715. -
    9716. * start-element handler
    9717. -
    9718. *
    9719. -
    9720. * @param string $parser XML parser object
    9721. -
    9722. * @param string $name element name
    9723. -
    9724. * @param string $attrs associative array of attributes
    9725. -
    9726. * @access private
    9727. -
    9728. */
    9729. -
    9730. function start_element($parser, $name, $attrs)
    9731. -
    9732. {
    9733. -
    9734. if ($this->status == 'schema') {
    9735. -
    9736. $this->currentSchema->schemaStartElement($parser, $name, $attrs);
    9737. -
    9738. $this->appendDebug($this->currentSchema->getDebug());
    9739. -
    9740. $this->currentSchema->clearDebug();
    9741. -
    9742. } elseif (preg_match('/schema$/', $name)) {
    9743. -
    9744. $this->debug('Parsing WSDL schema');
    9745. -
    9746. // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
    9747. -
    9748. $this->status = 'schema';
    9749. -
    9750. $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces);
    9751. -
    9752. $this->currentSchema->schemaStartElement($parser, $name, $attrs);
    9753. -
    9754. $this->appendDebug($this->currentSchema->getDebug());
    9755. -
    9756. $this->currentSchema->clearDebug();
    9757. -
    9758. } else {
    9759. -
    9760. // position in the total number of elements, starting from 0
    9761. -
    9762. $pos = $this->position++;
    9763. -
    9764. $depth = $this->depth++;
    9765. -
    9766. // set self as current value for this depth
    9767. -
    9768. $this->depth_array[$depth] = $pos;
    9769. -
    9770. $this->message[$pos] = array('cdata' => '');
    9771. -
    9772. // process attributes
    9773. -
    9774. if (count($attrs) > 0) {
    9775. -
    9776. // register namespace declarations
    9777. -
    9778. foreach($attrs as $k => $v) {
    9779. -
    9780. if (preg_match('/^xmlns/',$k)) {
    9781. -
    9782. if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
    9783. -
    9784. $this->namespaces[$ns_prefix] = $v;
    9785. -
    9786. } else {
    9787. -
    9788. $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
    9789. -
    9790. }
    9791. -
    9792. if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
    9793. -
    9794. $this->XMLSchemaVersion = $v;
    9795. -
    9796. $this->namespaces['xsi'] = $v . '-instance';
    9797. -
    9798. }
    9799. -
    9800. }
    9801. -
    9802. }
    9803. -
    9804. // expand each attribute prefix to its namespace
    9805. -
    9806. foreach($attrs as $k => $v) {
    9807. -
    9808. $k = strpos($k, ':') ? $this->expandQname($k) : $k;
    9809. -
    9810. if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
    9811. -
    9812. $v = strpos($v, ':') ? $this->expandQname($v) : $v;
    9813. -
    9814. }
    9815. -
    9816. $eAttrs[$k] = $v;
    9817. -
    9818. }
    9819. -
    9820. $attrs = $eAttrs;
    9821. -
    9822. } else {
    9823. -
    9824. $attrs = array();
    9825. -
    9826. }
    9827. -
    9828. // get element prefix, namespace and name
    9829. -
    9830. if (preg_match('/:/', $name)) {
    9831. -
    9832. // get ns prefix
    9833. -
    9834. $prefix = substr($name, 0, strpos($name, ':'));
    9835. -
    9836. // get ns
    9837. -
    9838. $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
    9839. -
    9840. // get unqualified name
    9841. -
    9842. $name = substr(strstr($name, ':'), 1);
    9843. -
    9844. }
    9845. -
    9846. // process attributes, expanding any prefixes to namespaces
    9847. -
    9848. // find status, register data
    9849. -
    9850. switch ($this->status) {
    9851. -
    9852. case 'message':
    9853. -
    9854. if ($name == 'part') {
    9855. -
    9856. if (isset($attrs['type'])) {
    9857. -
    9858. $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs));
    9859. -
    9860. $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
    9861. -
    9862. }
    9863. -
    9864. if (isset($attrs['element'])) {
    9865. -
    9866. $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs));
    9867. -
    9868. $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
    9869. -
    9870. }
    9871. -
    9872. }
    9873. -
    9874. break;
    9875. -
    9876. case 'portType':
    9877. -
    9878. switch ($name) {
    9879. -
    9880. case 'operation':
    9881. -
    9882. $this->currentPortOperation = $attrs['name'];
    9883. -
    9884. $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
    9885. -
    9886. if (isset($attrs['parameterOrder'])) {
    9887. -
    9888. $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
    9889. -
    9890. }
    9891. -
    9892. break;
    9893. -
    9894. case 'documentation':
    9895. -
    9896. $this->documentation = true;
    9897. -
    9898. break;
    9899. -
    9900. // merge input/output data
    9901. -
    9902. default:
    9903. -
    9904. $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
    9905. -
    9906. $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
    9907. -
    9908. break;
    9909. -
    9910. }
    9911. -
    9912. break;
    9913. -
    9914. case 'binding':
    9915. -
    9916. switch ($name) {
    9917. -
    9918. case 'binding':
    9919. -
    9920. // get ns prefix
    9921. -
    9922. if (isset($attrs['style'])) {
    9923. -
    9924. $this->bindings[$this->currentBinding]['prefix'] = $prefix;
    9925. -
    9926. }
    9927. -
    9928. $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
    9929. -
    9930. break;
    9931. -
    9932. case 'header':
    9933. -
    9934. $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
    9935. -
    9936. break;
    9937. -
    9938. case 'operation':
    9939. -
    9940. if (isset($attrs['soapAction'])) {
    9941. -
    9942. $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
    9943. -
    9944. }
    9945. -
    9946. if (isset($attrs['style'])) {
    9947. -
    9948. $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
    9949. -
    9950. }
    9951. -
    9952. if (isset($attrs['name'])) {
    9953. -
    9954. $this->currentOperation = $attrs['name'];
    9955. -
    9956. $this->debug("current binding operation: $this->currentOperation");
    9957. -
    9958. $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
    9959. -
    9960. $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
    9961. -
    9962. $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
    9963. -
    9964. }
    9965. -
    9966. break;
    9967. -
    9968. case 'input':
    9969. -
    9970. $this->opStatus = 'input';
    9971. -
    9972. break;
    9973. -
    9974. case 'output':
    9975. -
    9976. $this->opStatus = 'output';
    9977. -
    9978. break;
    9979. -
    9980. case 'body':
    9981. -
    9982. if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) {
    9983. -
    9984. $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
    9985. -
    9986. } else {
    9987. -
    9988. $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
    9989. -
    9990. }
    9991. -
    9992. break;
    9993. -
    9994. }
    9995. -
    9996. break;
    9997. -
    9998. case 'service':
    9999. -
    10000. switch ($name) {
    10001. -
    10002. case 'port':
    10003. -
    10004. $this->currentPort = $attrs['name'];
    10005. -
    10006. $this->debug('current port: ' . $this->currentPort);
    10007. -
    10008. $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
    10009. -
    10010. -
    10011. break;
    10012. -
    10013. case 'address':
    10014. -
    10015. $this->ports[$this->currentPort]['location'] = $attrs['location'];
    10016. -
    10017. $this->ports[$this->currentPort]['bindingType'] = $namespace;
    10018. -
    10019. $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
    10020. -
    10021. $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
    10022. -
    10023. break;
    10024. -
    10025. }
    10026. -
    10027. break;
    10028. -
    10029. }
    10030. -
    10031. // set status
    10032. -
    10033. switch ($name) {
    10034. -
    10035. case 'import':
    10036. -
    10037. if (isset($attrs['location'])) {
    10038. -
    10039. $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
    10040. -
    10041. $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')');
    10042. -
    10043. } else {
    10044. -
    10045. $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
    10046. -
    10047. if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
    10048. -
    10049. $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
    10050. -
    10051. }
    10052. -
    10053. $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')');
    10054. -
    10055. }
    10056. -
    10057. break;
    10058. -
    10059. //wait for schema
    10060. -
    10061. //case 'types':
    10062. -
    10063. // $this->status = 'schema';
    10064. -
    10065. // break;
    10066. -
    10067. case 'message':
    10068. -
    10069. $this->status = 'message';
    10070. -
    10071. $this->messages[$attrs['name']] = array();
    10072. -
    10073. $this->currentMessage = $attrs['name'];
    10074. -
    10075. break;
    10076. -
    10077. case 'portType':
    10078. -
    10079. $this->status = 'portType';
    10080. -
    10081. $this->portTypes[$attrs['name']] = array();
    10082. -
    10083. $this->currentPortType = $attrs['name'];
    10084. -
    10085. break;
    10086. -
    10087. case "binding":
    10088. -
    10089. if (isset($attrs['name'])) {
    10090. -
    10091. // get binding name
    10092. -
    10093. if (strpos($attrs['name'], ':')) {
    10094. -
    10095. $this->currentBinding = $this->getLocalPart($attrs['name']);
    10096. -
    10097. } else {
    10098. -
    10099. $this->currentBinding = $attrs['name'];
    10100. -
    10101. }
    10102. -
    10103. $this->status = 'binding';
    10104. -
    10105. $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
    10106. -
    10107. $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
    10108. -
    10109. }
    10110. -
    10111. break;
    10112. -
    10113. case 'service':
    10114. -
    10115. $this->serviceName = $attrs['name'];
    10116. -
    10117. $this->status = 'service';
    10118. -
    10119. $this->debug('current service: ' . $this->serviceName);
    10120. -
    10121. break;
    10122. -
    10123. case 'definitions':
    10124. -
    10125. foreach ($attrs as $name => $value) {
    10126. -
    10127. $this->wsdl_info[$name] = $value;
    10128. -
    10129. }
    10130. -
    10131. break;
    10132. -
    10133. }
    10134. -
    10135. }
    10136. -
    10137. }
    10138. -
    10139.  
    10140. -
    10141. /**
    10142. -
    10143. * end-element handler
    10144. -
    10145. *
    10146. -
    10147. * @param string $parser XML parser object
    10148. -
    10149. * @param string $name element name
    10150. -
    10151. * @access private
    10152. -
    10153. */
    10154. -
    10155. function end_element($parser, $name){
    10156. -
    10157. // unset schema status
    10158. -
    10159. if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
    10160. -
    10161. $this->status = "";
    10162. -
    10163. $this->appendDebug($this->currentSchema->getDebug());
    10164. -
    10165. $this->currentSchema->clearDebug();
    10166. -
    10167. $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
    10168. -
    10169. $this->debug('Parsing WSDL schema done');
    10170. -
    10171. }
    10172. -
    10173. if ($this->status == 'schema') {
    10174. -
    10175. $this->currentSchema->schemaEndElement($parser, $name);
    10176. -
    10177. } else {
    10178. -
    10179. // bring depth down a notch
    10180. -
    10181. $this->depth--;
    10182. -
    10183. }
    10184. -
    10185. // end documentation
    10186. -
    10187. if ($this->documentation) {
    10188. -
    10189. //TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
    10190. -
    10191. //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
    10192. -
    10193. $this->documentation = false;
    10194. -
    10195. }
    10196. -
    10197. }
    10198. -
    10199.  
    10200. -
    10201. /**
    10202. -
    10203. * element content handler
    10204. -
    10205. *
    10206. -
    10207. * @param string $parser XML parser object
    10208. -
    10209. * @param string $data element content
    10210. -
    10211. * @access private
    10212. -
    10213. */
    10214. -
    10215. function character_data($parser, $data)
    10216. -
    10217. {
    10218. -
    10219. $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
    10220. -
    10221. if (isset($this->message[$pos]['cdata'])) {
    10222. -
    10223. $this->message[$pos]['cdata'] .= $data;
    10224. -
    10225. }
    10226. -
    10227. if ($this->documentation) {
    10228. -
    10229. $this->documentation .= $data;
    10230. -
    10231. }
    10232. -
    10233. }
    10234. -
    10235.  
    10236. -
    10237. /**
    10238. -
    10239. * if authenticating, set user credentials here
    10240. -
    10241. *
    10242. -
    10243. * @param string $username
    10244. -
    10245. * @param string $password
    10246. -
    10247. * @param string $authtype (basic|digest|certificate|ntlm)
    10248. -
    10249. * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
    10250. -
    10251. * @access public
    10252. -
    10253. */
    10254. -
    10255. function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) {
    10256. -
    10257. $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
    10258. -
    10259. $this->appendDebug($this->varDump($certRequest));
    10260. -
    10261. $this->username = $username;
    10262. -
    10263. $this->password = $password;
    10264. -
    10265. $this->authtype = $authtype;
    10266. -
    10267. $this->certRequest = $certRequest;
    10268. -
    10269. }
    10270. -
    10271. -
    10272. function getBindingData($binding)
    10273. -
    10274. {
    10275. -
    10276. if (is_array($this->bindings[$binding])) {
    10277. -
    10278. return $this->bindings[$binding];
    10279. -
    10280. }
    10281. -
    10282. }
    10283. -
    10284. -
    10285. /**
    10286. -
    10287. * returns an assoc array of operation names => operation data
    10288. -
    10289. *
    10290. -
    10291. * @param string $portName WSDL port name
    10292. -
    10293. * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported)
    10294. -
    10295. * @return array
    10296. -
    10297. * @access public
    10298. -
    10299. */
    10300. -
    10301. function getOperations($portName = '', $bindingType = 'soap') {
    10302. -
    10303. $ops = array();
    10304. -
    10305. if ($bindingType == 'soap') {
    10306. -
    10307. $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
    10308. -
    10309. } elseif ($bindingType == 'soap12') {
    10310. -
    10311. $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
    10312. -
    10313. } else {
    10314. -
    10315. $this->debug("getOperations bindingType $bindingType may not be supported");
    10316. -
    10317. }
    10318. -
    10319. $this->debug("getOperations for port '$portName' bindingType $bindingType");
    10320. -
    10321. // loop thru ports
    10322. -
    10323. foreach($this->ports as $port => $portData) {
    10324. -
    10325. $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']);
    10326. -
    10327. if ($portName == '' || $port == $portName) {
    10328. -
    10329. // binding type of port matches parameter
    10330. -
    10331. if ($portData['bindingType'] == $bindingType) {
    10332. -
    10333. $this->debug("getOperations found port $port bindingType $bindingType");
    10334. -
    10335. //$this->debug("port data: " . $this->varDump($portData));
    10336. -
    10337. //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
    10338. -
    10339. // merge bindings
    10340. -
    10341. if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
    10342. -
    10343. $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
    10344. -
    10345. }
    10346. -
    10347. }
    10348. -
    10349. }
    10350. -
    10351. }
    10352. -
    10353. if (count($ops) == 0) {
    10354. -
    10355. $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType");
    10356. -
    10357. }
    10358. -
    10359. return $ops;
    10360. -
    10361. }
    10362. -
    10363. -
    10364. /**
    10365. -
    10366. * returns an associative array of data necessary for calling an operation
    10367. -
    10368. *
    10369. -
    10370. * @param string $operation name of operation
    10371. -
    10372. * @param string $bindingType type of binding eg: soap, soap12
    10373. -
    10374. * @return array
    10375. -
    10376. * @access public
    10377. -
    10378. */
    10379. -
    10380. function getOperationData($operation, $bindingType = 'soap')
    10381. -
    10382. {
    10383. -
    10384. if ($bindingType == 'soap') {
    10385. -
    10386. $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
    10387. -
    10388. } elseif ($bindingType == 'soap12') {
    10389. -
    10390. $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
    10391. -
    10392. }
    10393. -
    10394. // loop thru ports
    10395. -
    10396. foreach($this->ports as $port => $portData) {
    10397. -
    10398. // binding type of port matches parameter
    10399. -
    10400. if ($portData['bindingType'] == $bindingType) {
    10401. -
    10402. // get binding
    10403. -
    10404. //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
    10405. -
    10406. foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
    10407. -
    10408. // note that we could/should also check the namespace here
    10409. -
    10410. if ($operation == $bOperation) {
    10411. -
    10412. $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
    10413. -
    10414. return $opData;
    10415. -
    10416. }
    10417. -
    10418. }
    10419. -
    10420. }
    10421. -
    10422. }
    10423. -
    10424. }
    10425. -
    10426. -
    10427. /**
    10428. -
    10429. * returns an associative array of data necessary for calling an operation
    10430. -
    10431. *
    10432. -
    10433. * @param string $soapAction soapAction for operation
    10434. -
    10435. * @param string $bindingType type of binding eg: soap, soap12
    10436. -
    10437. * @return array
    10438. -
    10439. * @access public
    10440. -
    10441. */
    10442. -
    10443. function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') {
    10444. -
    10445. if ($bindingType == 'soap') {
    10446. -
    10447. $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
    10448. -
    10449. } elseif ($bindingType == 'soap12') {
    10450. -
    10451. $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
    10452. -
    10453. }
    10454. -
    10455. // loop thru ports
    10456. -
    10457. foreach($this->ports as $port => $portData) {
    10458. -
    10459. // binding type of port matches parameter
    10460. -
    10461. if ($portData['bindingType'] == $bindingType) {
    10462. -
    10463. // loop through operations for the binding
    10464. -
    10465. foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
    10466. -
    10467. if ($opData['soapAction'] == $soapAction) {
    10468. -
    10469. return $opData;
    10470. -
    10471. }
    10472. -
    10473. }
    10474. -
    10475. }
    10476. -
    10477. }
    10478. -
    10479. }
    10480. -
    10481. -
    10482. /**
    10483. -
    10484. * returns an array of information about a given type
    10485. -
    10486. * returns false if no type exists by the given name
    10487. -
    10488. *
    10489. -
    10490. * typeDef = array(
    10491. -
    10492. * 'elements' => array(), // refs to elements array
    10493. -
    10494. * 'restrictionBase' => '',
    10495. -
    10496. * 'phpType' => '',
    10497. -
    10498. * 'order' => '(sequence|all)',
    10499. -
    10500. * 'attrs' => array() // refs to attributes array
    10501. -
    10502. * )
    10503. -
    10504. *
    10505. -
    10506. * @param string $type the type
    10507. -
    10508. * @param string $ns namespace (not prefix) of the type
    10509. -
    10510. * @return mixed
    10511. -
    10512. * @access public
    10513. -
    10514. * @see nusoap_xmlschema
    10515. -
    10516. */
    10517. -
    10518. function getTypeDef($type, $ns) {
    10519. -
    10520. $this->debug("in getTypeDef: type=$type, ns=$ns");
    10521. -
    10522. if ((! $ns) && isset($this->namespaces['tns'])) {
    10523. -
    10524. $ns = $this->namespaces['tns'];
    10525. -
    10526. $this->debug("in getTypeDef: type namespace forced to $ns");
    10527. -
    10528. }
    10529. -
    10530. if (!isset($this->schemas[$ns])) {
    10531. -
    10532. foreach ($this->schemas as $ns0 => $schema0) {
    10533. -
    10534. if (strcasecmp($ns, $ns0) == 0) {
    10535. -
    10536. $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0");
    10537. -
    10538. $ns = $ns0;
    10539. -
    10540. break;
    10541. -
    10542. }
    10543. -
    10544. }
    10545. -
    10546. }
    10547. -
    10548. if (isset($this->schemas[$ns])) {
    10549. -
    10550. $this->debug("in getTypeDef: have schema for namespace $ns");
    10551. -
    10552. for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
    10553. -
    10554. $xs = &$this->schemas[$ns][$i];
    10555. -
    10556. $t = $xs->getTypeDef($type);
    10557. -
    10558. $this->appendDebug($xs->getDebug());
    10559. -
    10560. $xs->clearDebug();
    10561. -
    10562. if ($t) {
    10563. -
    10564. $this->debug("in getTypeDef: found type $type");
    10565. -
    10566. if (!isset($t['phpType'])) {
    10567. -
    10568. // get info for type to tack onto the element
    10569. -
    10570. $uqType = substr($t['type'], strrpos($t['type'], ':') + 1);
    10571. -
    10572. $ns = substr($t['type'], 0, strrpos($t['type'], ':'));
    10573. -
    10574. $etype = $this->getTypeDef($uqType, $ns);
    10575. -
    10576. if ($etype) {
    10577. -
    10578. $this->debug("found type for [element] $type:");
    10579. -
    10580. $this->debug($this->varDump($etype));
    10581. -
    10582. if (isset($etype['phpType'])) {
    10583. -
    10584. $t['phpType'] = $etype['phpType'];
    10585. -
    10586. }
    10587. -
    10588. if (isset($etype['elements'])) {
    10589. -
    10590. $t['elements'] = $etype['elements'];
    10591. -
    10592. }
    10593. -
    10594. if (isset($etype['attrs'])) {
    10595. -
    10596. $t['attrs'] = $etype['attrs'];
    10597. -
    10598. }
    10599. -
    10600. } else {
    10601. -
    10602. $this->debug("did not find type for [element] $type");
    10603. -
    10604. }
    10605. -
    10606. }
    10607. -
    10608. return $t;
    10609. -
    10610. }
    10611. -
    10612. }
    10613. -
    10614. $this->debug("in getTypeDef: did not find type $type");
    10615. -
    10616. } else {
    10617. -
    10618. $this->debug("in getTypeDef: do not have schema for namespace $ns");
    10619. -
    10620. }
    10621. -
    10622. return false;
    10623. -
    10624. }
    10625. -
    10626.  
    10627. -
    10628. /**
    10629. -
    10630. * prints html description of services
    10631. -
    10632. *
    10633. -
    10634. * @access private
    10635. -
    10636. */
    10637. -
    10638. function webDescription(){
    10639. -
    10640. global $HTTP_SERVER_VARS;
    10641. -
    10642.  
    10643. -
    10644. if (isset($_SERVER)) {
    10645. -
    10646. $PHP_SELF = $_SERVER['PHP_SELF'];
    10647. -
    10648. } elseif (isset($HTTP_SERVER_VARS)) {
    10649. -
    10650. $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
    10651. -
    10652. } else {
    10653. -
    10654. $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
    10655. -
    10656. }
    10657. -
    10658.  
    10659. -
    10660. $b = '
    10661. -
    10662. <html><head><title>NuSOAP: '.$this->serviceName.'</title>
    10663. -
    10664. <style type="text/css">
    10665. -
    10666. body { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
    10667. -
    10668. p { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
    10669. -
    10670. pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color: #000000;}
    10671. -
    10672. ul { margin-top: 10px; margin-left: 20px; }
    10673. -
    10674. li { list-style-type: none; margin-top: 10px; color: #000000; }
    10675. -
    10676. .content{
    10677. -
    10678. margin-left: 0px; padding-bottom: 2em; }
    10679. -
    10680. .nav {
    10681. -
    10682. padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em;
    10683. -
    10684. margin-top: 10px; margin-left: 0px; color: #000000;
    10685. -
    10686. background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; }
    10687. -
    10688. .title {
    10689. -
    10690. font-family: arial; font-size: 26px; color: #ffffff;
    10691. -
    10692. background-color: #999999; width: 100%;
    10693. -
    10694. margin-left: 0px; margin-right: 0px;
    10695. -
    10696. padding-top: 10px; padding-bottom: 10px;}
    10697. -
    10698. .hidden {
    10699. -
    10700. position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px;
    10701. -
    10702. font-family: arial; overflow: hidden; width: 600;
    10703. -
    10704. padding: 20px; font-size: 10px; background-color: #999999;
    10705. -
    10706. layer-background-color:#FFFFFF; }
    10707. -
    10708. a,a:active { color: charcoal; font-weight: bold; }
    10709. -
    10710. a:visited { color: #666666; font-weight: bold; }
    10711. -
    10712. a:hover { color: cc3300; font-weight: bold; }
    10713. -
    10714. </style>
    10715. -
    10716. <script language="JavaScript" type="text/javascript">
    10717. -
    10718. <!--
    10719. -
    10720. // POP-UP CAPTIONS...
    10721. -
    10722. function lib_bwcheck(){ //Browsercheck (needed)
    10723. -
    10724. this.ver=navigator.appVersion
    10725. -
    10726. this.agent=navigator.userAgent
    10727. -
    10728. this.dom=document.getElementById?1:0
    10729. -
    10730. this.opera5=this.agent.indexOf("Opera 5")>-1
    10731. -
    10732. this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
    10733. -
    10734. this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
    10735. -
    10736. this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
    10737. -
    10738. this.ie=this.ie4||this.ie5||this.ie6
    10739. -
    10740. this.mac=this.agent.indexOf("Mac")>-1
    10741. -
    10742. this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    10743. -
    10744. this.ns4=(document.layers && !this.dom)?1:0;
    10745. -
    10746. this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
    10747. -
    10748. return this
    10749. -
    10750. }
    10751. -
    10752. var bw = new lib_bwcheck()
    10753. -
    10754. //Makes crossbrowser object.
    10755. -
    10756. function makeObj(obj){
    10757. -
    10758. this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
    10759. -
    10760. if(!this.evnt) return false
    10761. -
    10762. this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;
    10763. -
    10764. this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;
    10765. -
    10766. this.writeIt=b_writeIt;
    10767. -
    10768. return this
    10769. -
    10770. }
    10771. -
    10772. // A unit of measure that will be added when setting the position of a layer.
    10773. -
    10774. //var px = bw.ns4||window.opera?"":"px";
    10775. -
    10776. function b_writeIt(text){
    10777. -
    10778. if (bw.ns4){this.wref.write(text);this.wref.close()}
    10779. -
    10780. else this.wref.innerHTML = text
    10781. -
    10782. }
    10783. -
    10784. //Shows the messages
    10785. -
    10786. var oDesc;
    10787. -
    10788. function popup(divid){
    10789. -
    10790. if(oDesc = new makeObj(divid)){
    10791. -
    10792. oDesc.css.visibility = "visible"
    10793. -
    10794. }
    10795. -
    10796. }
    10797. -
    10798. function popout(){ // Hides message
    10799. -
    10800. if(oDesc) oDesc.css.visibility = "hidden"
    10801. -
    10802. }
    10803. -
    10804. //-->
    10805. -
    10806. </script>
    10807. -
    10808. </head>
    10809. -
    10810. <body>
    10811. -
    10812. <div class=content>
    10813. -
    10814. <br><br>
    10815. -
    10816. <div class=title>'.$this->serviceName.'</div>
    10817. -
    10818. <div class=nav>
    10819. -
    10820. <p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service.
    10821. -
    10822. Click on an operation name to view it&apos;s details.</p>
    10823. -
    10824. <ul>';
    10825. -
    10826. foreach($this->getOperations() as $op => $data){
    10827. -
    10828. $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
    10829. -
    10830. // create hidden div
    10831. -
    10832. $b .= "<div id='$op' class='hidden'>
    10833. -
    10834. <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
    10835. -
    10836. foreach($data as $donnie => $marie){ // loop through opdata
    10837. -
    10838. if($donnie == 'input' || $donnie == 'output'){ // show input/output data
    10839. -
    10840. $b .= "<font color='white'>".ucfirst($donnie).':</font><br>';
    10841. -
    10842. foreach($marie as $captain => $tenille){ // loop through data
    10843. -
    10844. if($captain == 'parts'){ // loop thru parts
    10845. -
    10846. $b .= "&nbsp;&nbsp;$captain:<br>";
    10847. -
    10848. //if(is_array($tenille)){
    10849. -
    10850. foreach($tenille as $joanie => $chachi){
    10851. -
    10852. $b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
    10853. -
    10854. }
    10855. -
    10856. //}
    10857. -
    10858. } else {
    10859. -
    10860. $b .= "&nbsp;&nbsp;$captain: $tenille<br>";
    10861. -
    10862. }
    10863. -
    10864. }
    10865. -
    10866. } else {
    10867. -
    10868. $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>";
    10869. -
    10870. }
    10871. -
    10872. }
    10873. -
    10874. $b .= '</div>';
    10875. -
    10876. }
    10877. -
    10878. $b .= '
    10879. -
    10880. <ul>
    10881. -
    10882. </div>
    10883. -
    10884. </div></body></html>';
    10885. -
    10886. return $b;
    10887. -
    10888. }
    10889. -
    10890.  
    10891. -
    10892. /**
    10893. -
    10894. * serialize the parsed wsdl
    10895. -
    10896. *
    10897. -
    10898. * @param mixed $debug whether to put debug=1 in endpoint URL
    10899. -
    10900. * @return string serialization of WSDL
    10901. -
    10902. * @access public
    10903. -
    10904. */
    10905. -
    10906. function serialize($debug = 0)
    10907. -
    10908. {
    10909. -
    10910. $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
    10911. -
    10912. $xml .= "\n<definitions";
    10913. -
    10914. foreach($this->namespaces as $k => $v) {
    10915. -
    10916. $xml .= " xmlns:$k=\"$v\"";
    10917. -
    10918. }
    10919. -
    10920. // 10.9.02 - add poulter fix for wsdl and tns declarations
    10921. -
    10922. if (isset($this->namespaces['wsdl'])) {
    10923. -
    10924. $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
    10925. -
    10926. }
    10927. -
    10928. if (isset($this->namespaces['tns'])) {
    10929. -
    10930. $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
    10931. -
    10932. }
    10933. -
    10934. $xml .= '>';
    10935. -
    10936. // imports
    10937. -
    10938. if (sizeof($this->import) > 0) {
    10939. -
    10940. foreach($this->import as $ns => $list) {
    10941. -
    10942. foreach ($list as $ii) {
    10943. -
    10944. if ($ii['location'] != '') {
    10945. -
    10946. $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
    10947. -
    10948. } else {
    10949. -
    10950. $xml .= '<import namespace="' . $ns . '" />';
    10951. -
    10952. }
    10953. -
    10954. }
    10955. -
    10956. }
    10957. -
    10958. }
    10959. -
    10960. // types
    10961. -
    10962. if (count($this->schemas)>=1) {
    10963. -
    10964. $xml .= "\n<types>\n";
    10965. -
    10966. foreach ($this->schemas as $ns => $list) {
    10967. -
    10968. foreach ($list as $xs) {
    10969. -
    10970. $xml .= $xs->serializeSchema();
    10971. -
    10972. }
    10973. -
    10974. }
    10975. -
    10976. $xml .= '</types>';
    10977. -
    10978. }
    10979. -
    10980. // messages
    10981. -
    10982. if (count($this->messages) >= 1) {
    10983. -
    10984. foreach($this->messages as $msgName => $msgParts) {
    10985. -
    10986. $xml .= "\n<message name=\"" . $msgName . '">';
    10987. -
    10988. if(is_array($msgParts)){
    10989. -
    10990. foreach($msgParts as $partName => $partType) {
    10991. -
    10992. // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
    10993. -
    10994. if (strpos($partType, ':')) {
    10995. -
    10996. $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
    10997. -
    10998. } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
    10999. -
    11000. // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
    11001. -
    11002. $typePrefix = 'xsd';
    11003. -
    11004. } else {
    11005. -
    11006. foreach($this->typemap as $ns => $types) {
    11007. -
    11008. if (isset($types[$partType])) {
    11009. -
    11010. $typePrefix = $this->getPrefixFromNamespace($ns);
    11011. -
    11012. }
    11013. -
    11014. }
    11015. -
    11016. if (!isset($typePrefix)) {
    11017. -
    11018. die("$partType has no namespace!");
    11019. -
    11020. }
    11021. -
    11022. }
    11023. -
    11024. $ns = $this->getNamespaceFromPrefix($typePrefix);
    11025. -
    11026. $localPart = $this->getLocalPart($partType);
    11027. -
    11028. $typeDef = $this->getTypeDef($localPart, $ns);
    11029. -
    11030. if ($typeDef['typeClass'] == 'element') {
    11031. -
    11032. $elementortype = 'element';
    11033. -
    11034. if (substr($localPart, -1) == '^') {
    11035. -
    11036. $localPart = substr($localPart, 0, -1);
    11037. -
    11038. }
    11039. -
    11040. } else {
    11041. -
    11042. $elementortype = 'type';
    11043. -
    11044. }
    11045. -
    11046. $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />';
    11047. -
    11048. }
    11049. -
    11050. }
    11051. -
    11052. $xml .= '</message>';
    11053. -
    11054. }
    11055. -
    11056. }
    11057. -
    11058. // bindings & porttypes
    11059. -
    11060. if (count($this->bindings) >= 1) {
    11061. -
    11062. $binding_xml = '';
    11063. -
    11064. $portType_xml = '';
    11065. -
    11066. foreach($this->bindings as $bindingName => $attrs) {
    11067. -
    11068. $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
    11069. -
    11070. $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
    11071. -
    11072. $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
    11073. -
    11074. foreach($attrs['operations'] as $opName => $opParts) {
    11075. -
    11076. $binding_xml .= "\n" . ' <operation name="' . $opName . '">';
    11077. -
    11078. $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>';
    11079. -
    11080. if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
    11081. -
    11082. $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
    11083. -
    11084. } else {
    11085. -
    11086. $enc_style = '';
    11087. -
    11088. }
    11089. -
    11090. $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
    11091. -
    11092. if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
    11093. -
    11094. $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
    11095. -
    11096. } else {
    11097. -
    11098. $enc_style = '';
    11099. -
    11100. }
    11101. -
    11102. $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
    11103. -
    11104. $binding_xml .= "\n" . ' </operation>';
    11105. -
    11106. $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"';
    11107. -
    11108. if (isset($opParts['parameterOrder'])) {
    11109. -
    11110. $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
    11111. -
    11112. }
    11113. -
    11114. $portType_xml .= '>';
    11115. -
    11116. if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
    11117. -
    11118. $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
    11119. -
    11120. }
    11121. -
    11122. $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>';
    11123. -
    11124. $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>';
    11125. -
    11126. $portType_xml .= "\n" . ' </operation>';
    11127. -
    11128. }
    11129. -
    11130. $portType_xml .= "\n" . '</portType>';
    11131. -
    11132. $binding_xml .= "\n" . '</binding>';
    11133. -
    11134. }
    11135. -
    11136. $xml .= $portType_xml . $binding_xml;
    11137. -
    11138. }
    11139. -
    11140. // services
    11141. -
    11142. $xml .= "\n<service name=\"" . $this->serviceName . '">';
    11143. -
    11144. if (count($this->ports) >= 1) {
    11145. -
    11146. foreach($this->ports as $pName => $attrs) {
    11147. -
    11148. $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
    11149. -
    11150. $xml .= "\n" . ' <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>';
    11151. -
    11152. $xml .= "\n" . ' </port>';
    11153. -
    11154. }
    11155. -
    11156. }
    11157. -
    11158. $xml .= "\n" . '</service>';
    11159. -
    11160. return $xml . "\n</definitions>";
    11161. -
    11162. }
    11163. -
    11164.  
    11165. -
    11166. /**
    11167. -
    11168. * determine whether a set of parameters are unwrapped
    11169. -
    11170. * when they are expect to be wrapped, Microsoft-style.
    11171. -
    11172. *
    11173. -
    11174. * @param string $type the type (element name) of the wrapper
    11175. -
    11176. * @param array $parameters the parameter values for the SOAP call
    11177. -
    11178. * @return boolean whether they parameters are unwrapped (and should be wrapped)
    11179. -
    11180. * @access private
    11181. -
    11182. */
    11183. -
    11184. function parametersMatchWrapped($type, &$parameters) {
    11185. -
    11186. $this->debug("in parametersMatchWrapped type=$type, parameters=");
    11187. -
    11188. $this->appendDebug($this->varDump($parameters));
    11189. -
    11190.  
    11191. -
    11192. // split type into namespace:unqualified-type
    11193. -
    11194. if (strpos($type, ':')) {
    11195. -
    11196. $uqType = substr($type, strrpos($type, ':') + 1);
    11197. -
    11198. $ns = substr($type, 0, strrpos($type, ':'));
    11199. -
    11200. $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns");
    11201. -
    11202. if ($this->getNamespaceFromPrefix($ns)) {
    11203. -
    11204. $ns = $this->getNamespaceFromPrefix($ns);
    11205. -
    11206. $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns");
    11207. -
    11208. }
    11209. -
    11210. } else {
    11211. -
    11212. // TODO: should the type be compared to types in XSD, and the namespace
    11213. -
    11214. // set to XSD if the type matches?
    11215. -
    11216. $this->debug("in parametersMatchWrapped: No namespace for type $type");
    11217. -
    11218. $ns = '';
    11219. -
    11220. $uqType = $type;
    11221. -
    11222. }
    11223. -
    11224.  
    11225. -
    11226. // get the type information
    11227. -
    11228. if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
    11229. -
    11230. $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type.");
    11231. -
    11232. return false;
    11233. -
    11234. }
    11235. -
    11236. $this->debug("in parametersMatchWrapped: found typeDef=");
    11237. -
    11238. $this->appendDebug($this->varDump($typeDef));
    11239. -
    11240. if (substr($uqType, -1) == '^') {
    11241. -
    11242. $uqType = substr($uqType, 0, -1);
    11243. -
    11244. }
    11245. -
    11246. $phpType = $typeDef['phpType'];
    11247. -
    11248. $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '');
    11249. -
    11250. $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType");
    11251. -
    11252. -
    11253. // we expect a complexType or element of complexType
    11254. -
    11255. if ($phpType != 'struct') {
    11256. -
    11257. $this->debug("in parametersMatchWrapped: not a struct");
    11258. -
    11259. return false;
    11260. -
    11261. }
    11262. -
    11263.  
    11264. -
    11265. // see whether the parameter names match the elements
    11266. -
    11267. if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
    11268. -
    11269. $elements = 0;
    11270. -
    11271. $matches = 0;
    11272. -
    11273. foreach ($typeDef['elements'] as $name => $attrs) {
    11274. -
    11275. if (isset($parameters[$name])) {
    11276. -
    11277. $this->debug("in parametersMatchWrapped: have parameter named $name");
    11278. -
    11279. $matches++;
    11280. -
    11281. } else {
    11282. -
    11283. $this->debug("in parametersMatchWrapped: do not have parameter named $name");
    11284. -
    11285. }
    11286. -
    11287. $elements++;
    11288. -
    11289. }
    11290. -
    11291.  
    11292. -
    11293. $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names");
    11294. -
    11295. if ($matches == 0) {
    11296. -
    11297. return false;
    11298. -
    11299. }
    11300. -
    11301. return true;
    11302. -
    11303. }
    11304. -
    11305.  
    11306. -
    11307. // since there are no elements for the type, if the user passed no
    11308. -
    11309. // parameters, the parameters match wrapped.
    11310. -
    11311. $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType");
    11312. -
    11313. return count($parameters) == 0;
    11314. -
    11315. }
    11316. -
    11317.  
    11318. -
    11319. /**
    11320. -
    11321. * serialize PHP values according to a WSDL message definition
    11322. -
    11323. * contrary to the method name, this is not limited to RPC
    11324. -
    11325. *
    11326. -
    11327. * TODO
    11328. -
    11329. * - multi-ref serialization
    11330. -
    11331. * - validate PHP values against type definitions, return errors if invalid
    11332. -
    11333. *
    11334. -
    11335. * @param string $operation operation name
    11336. -
    11337. * @param string $direction (input|output)
    11338. -
    11339. * @param mixed $parameters parameter value(s)
    11340. -
    11341. * @param string $bindingType (soap|soap12)
    11342. -
    11343. * @return mixed parameters serialized as XML or false on error (e.g. operation not found)
    11344. -
    11345. * @access public
    11346. -
    11347. */
    11348. -
    11349. function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') {
    11350. -
    11351. $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
    11352. -
    11353. $this->appendDebug('parameters=' . $this->varDump($parameters));
    11354. -
    11355. -
    11356. if ($direction != 'input' && $direction != 'output') {
    11357. -
    11358. $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
    11359. -
    11360. $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
    11361. -
    11362. return false;
    11363. -
    11364. }
    11365. -
    11366. if (!$opData = $this->getOperationData($operation, $bindingType)) {
    11367. -
    11368. $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
    11369. -
    11370. $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
    11371. -
    11372. return false;
    11373. -
    11374. }
    11375. -
    11376. $this->debug('in serializeRPCParameters: opData:');
    11377. -
    11378. $this->appendDebug($this->varDump($opData));
    11379. -
    11380.  
    11381. -
    11382. // Get encoding style for output and set to current
    11383. -
    11384. $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
    11385. -
    11386. if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
    11387. -
    11388. $encodingStyle = $opData['output']['encodingStyle'];
    11389. -
    11390. $enc_style = $encodingStyle;
    11391. -
    11392. }
    11393. -
    11394.  
    11395. -
    11396. // set input params
    11397. -
    11398. $xml = '';
    11399. -
    11400. if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
    11401. -
    11402. $parts = &$opData[$direction]['parts'];
    11403. -
    11404. $part_count = sizeof($parts);
    11405. -
    11406. $style = $opData['style'];
    11407. -
    11408. $use = $opData[$direction]['use'];
    11409. -
    11410. $this->debug("have $part_count part(s) to serialize using $style/$use");
    11411. -
    11412. if (is_array($parameters)) {
    11413. -
    11414. $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
    11415. -
    11416. $parameter_count = count($parameters);
    11417. -
    11418. $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize");
    11419. -
    11420. // check for Microsoft-style wrapped parameters
    11421. -
    11422. if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) {
    11423. -
    11424. $this->debug('check whether the caller has wrapped the parameters');
    11425. -
    11426. if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) {
    11427. -
    11428. // TODO: consider checking here for double-wrapping, when
    11429. -
    11430. // service function wraps, then NuSOAP wraps again
    11431. -
    11432. $this->debug("change simple array to associative with 'parameters' element");
    11433. -
    11434. $parameters['parameters'] = $parameters[0];
    11435. -
    11436. unset($parameters[0]);
    11437. -
    11438. }
    11439. -
    11440. if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) {
    11441. -
    11442. $this->debug('check whether caller\'s parameters match the wrapped ones');
    11443. -
    11444. if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) {
    11445. -
    11446. $this->debug('wrap the parameters for the caller');
    11447. -
    11448. $parameters = array('parameters' => $parameters);
    11449. -
    11450. $parameter_count = 1;
    11451. -
    11452. }
    11453. -
    11454. }
    11455. -
    11456. }
    11457. -
    11458. foreach ($parts as $name => $type) {
    11459. -
    11460. $this->debug("serializing part $name of type $type");
    11461. -
    11462. // Track encoding style
    11463. -
    11464. if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
    11465. -
    11466. $encodingStyle = $opData[$direction]['encodingStyle'];
    11467. -
    11468. $enc_style = $encodingStyle;
    11469. -
    11470. } else {
    11471. -
    11472. $enc_style = false;
    11473. -
    11474. }
    11475. -
    11476. // NOTE: add error handling here
    11477. -
    11478. // if serializeType returns false, then catch global error and fault
    11479. -
    11480. if ($parametersArrayType == 'arraySimple') {
    11481. -
    11482. $p = array_shift($parameters);
    11483. -
    11484. $this->debug('calling serializeType w/indexed param');
    11485. -
    11486. $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
    11487. -
    11488. } elseif (isset($parameters[$name])) {
    11489. -
    11490. $this->debug('calling serializeType w/named param');
    11491. -
    11492. $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
    11493. -
    11494. } else {
    11495. -
    11496. // TODO: only send nillable
    11497. -
    11498. $this->debug('calling serializeType w/null param');
    11499. -
    11500. $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
    11501. -
    11502. }
    11503. -
    11504. }
    11505. -
    11506. } else {
    11507. -
    11508. $this->debug('no parameters passed.');
    11509. -
    11510. }
    11511. -
    11512. }
    11513. -
    11514. $this->debug("serializeRPCParameters returning: $xml");
    11515. -
    11516. return $xml;
    11517. -
    11518. }
    11519. -
    11520. -
    11521. /**
    11522. -
    11523. * serialize a PHP value according to a WSDL message definition
    11524. -
    11525. *
    11526. -
    11527. * TODO
    11528. -
    11529. * - multi-ref serialization
    11530. -
    11531. * - validate PHP values against type definitions, return errors if invalid
    11532. -
    11533. *
    11534. -
    11535. * @param string $operation operation name
    11536. -
    11537. * @param string $direction (input|output)
    11538. -
    11539. * @param mixed $parameters parameter value(s)
    11540. -
    11541. * @return mixed parameters serialized as XML or false on error (e.g. operation not found)
    11542. -
    11543. * @access public
    11544. -
    11545. * @deprecated
    11546. -
    11547. */
    11548. -
    11549. function serializeParameters($operation, $direction, $parameters)
    11550. -
    11551. {
    11552. -
    11553. $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
    11554. -
    11555. $this->appendDebug('parameters=' . $this->varDump($parameters));
    11556. -
    11557. -
    11558. if ($direction != 'input' && $direction != 'output') {
    11559. -
    11560. $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
    11561. -
    11562. $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
    11563. -
    11564. return false;
    11565. -
    11566. }
    11567. -
    11568. if (!$opData = $this->getOperationData($operation)) {
    11569. -
    11570. $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
    11571. -
    11572. $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
    11573. -
    11574. return false;
    11575. -
    11576. }
    11577. -
    11578. $this->debug('opData:');
    11579. -
    11580. $this->appendDebug($this->varDump($opData));
    11581. -
    11582. -
    11583. // Get encoding style for output and set to current
    11584. -
    11585. $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
    11586. -
    11587. if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
    11588. -
    11589. $encodingStyle = $opData['output']['encodingStyle'];
    11590. -
    11591. $enc_style = $encodingStyle;
    11592. -
    11593. }
    11594. -
    11595. -
    11596. // set input params
    11597. -
    11598. $xml = '';
    11599. -
    11600. if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
    11601. -
    11602. -
    11603. $use = $opData[$direction]['use'];
    11604. -
    11605. $this->debug("use=$use");
    11606. -
    11607. $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
    11608. -
    11609. if (is_array($parameters)) {
    11610. -
    11611. $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
    11612. -
    11613. $this->debug('have ' . $parametersArrayType . ' parameters');
    11614. -
    11615. foreach($opData[$direction]['parts'] as $name => $type) {
    11616. -
    11617. $this->debug('serializing part "'.$name.'" of type "'.$type.'"');
    11618. -
    11619. // Track encoding style
    11620. -
    11621. if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
    11622. -
    11623. $encodingStyle = $opData[$direction]['encodingStyle'];
    11624. -
    11625. $enc_style = $encodingStyle;
    11626. -
    11627. } else {
    11628. -
    11629. $enc_style = false;
    11630. -
    11631. }
    11632. -
    11633. // NOTE: add error handling here
    11634. -
    11635. // if serializeType returns false, then catch global error and fault
    11636. -
    11637. if ($parametersArrayType == 'arraySimple') {
    11638. -
    11639. $p = array_shift($parameters);
    11640. -
    11641. $this->debug('calling serializeType w/indexed param');
    11642. -
    11643. $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
    11644. -
    11645. } elseif (isset($parameters[$name])) {
    11646. -
    11647. $this->debug('calling serializeType w/named param');
    11648. -
    11649. $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
    11650. -
    11651. } else {
    11652. -
    11653. // TODO: only send nillable
    11654. -
    11655. $this->debug('calling serializeType w/null param');
    11656. -
    11657. $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
    11658. -
    11659. }
    11660. -
    11661. }
    11662. -
    11663. } else {
    11664. -
    11665. $this->debug('no parameters passed.');
    11666. -
    11667. }
    11668. -
    11669. }
    11670. -
    11671. $this->debug("serializeParameters returning: $xml");
    11672. -
    11673. return $xml;
    11674. -
    11675. }
    11676. -
    11677. -
    11678. /**
    11679. -
    11680. * serializes a PHP value according a given type definition
    11681. -
    11682. *
    11683. -
    11684. * @param string $name name of value (part or element)
    11685. -
    11686. * @param string $type XML schema type of value (type or element)
    11687. -
    11688. * @param mixed $value a native PHP value (parameter value)
    11689. -
    11690. * @param string $use use for part (encoded|literal)
    11691. -
    11692. * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style)
    11693. -
    11694. * @param boolean $unqualified a kludge for what should be XML namespace form handling
    11695. -
    11696. * @return string value serialized as an XML string
    11697. -
    11698. * @access private
    11699. -
    11700. */
    11701. -
    11702. function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
    11703. -
    11704. {
    11705. -
    11706. $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified"));
    11707. -
    11708. $this->appendDebug("value=" . $this->varDump($value));
    11709. -
    11710. if($use == 'encoded' && $encodingStyle) {
    11711. -
    11712. $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
    11713. -
    11714. }
    11715. -
    11716.  
    11717. -
    11718. // if a soapval has been supplied, let its type override the WSDL
    11719. -
    11720. if (is_object($value) && get_class($value) == 'soapval') {
    11721. -
    11722. if ($value->type_ns) {
    11723. -
    11724. $type = $value->type_ns . ':' . $value->type;
    11725. -
    11726. $forceType = true;
    11727. -
    11728. $this->debug("in serializeType: soapval overrides type to $type");
    11729. -
    11730. } elseif ($value->type) {
    11731. -
    11732. $type = $value->type;
    11733. -
    11734. $forceType = true;
    11735. -
    11736. $this->debug("in serializeType: soapval overrides type to $type");
    11737. -
    11738. } else {
    11739. -
    11740. $forceType = false;
    11741. -
    11742. $this->debug("in serializeType: soapval does not override type");
    11743. -
    11744. }
    11745. -
    11746. $attrs = $value->attributes;
    11747. -
    11748. $value = $value->value;
    11749. -
    11750. $this->debug("in serializeType: soapval overrides value to $value");
    11751. -
    11752. if ($attrs) {
    11753. -
    11754. if (!is_array($value)) {
    11755. -
    11756. $value['!'] = $value;
    11757. -
    11758. }
    11759. -
    11760. foreach ($attrs as $n => $v) {
    11761. -
    11762. $value['!' . $n] = $v;
    11763. -
    11764. }
    11765. -
    11766. $this->debug("in serializeType: soapval provides attributes");
    11767. -
    11768. }
    11769. -
    11770. } else {
    11771. -
    11772. $forceType = false;
    11773. -
    11774. }
    11775. -
    11776.  
    11777. -
    11778. $xml = '';
    11779. -
    11780. if (strpos($type, ':')) {
    11781. -
    11782. $uqType = substr($type, strrpos($type, ':') + 1);
    11783. -
    11784. $ns = substr($type, 0, strrpos($type, ':'));
    11785. -
    11786. $this->debug("in serializeType: got a prefixed type: $uqType, $ns");
    11787. -
    11788. if ($this->getNamespaceFromPrefix($ns)) {
    11789. -
    11790. $ns = $this->getNamespaceFromPrefix($ns);
    11791. -
    11792. $this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
    11793. -
    11794. }
    11795. -
    11796.  
    11797. -
    11798. if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){
    11799. -
    11800. $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
    11801. -
    11802. if ($unqualified && $use == 'literal') {
    11803. -
    11804. $elementNS = " xmlns=\"\"";
    11805. -
    11806. } else {
    11807. -
    11808. $elementNS = '';
    11809. -
    11810. }
    11811. -
    11812. if (is_null($value)) {
    11813. -
    11814. if ($use == 'literal') {
    11815. -
    11816. // TODO: depends on minOccurs
    11817. -
    11818. $xml = "<$name$elementNS/>";
    11819. -
    11820. } else {
    11821. -
    11822. // TODO: depends on nillable, which should be checked before calling this method
    11823. -
    11824. $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
    11825. -
    11826. }
    11827. -
    11828. $this->debug("in serializeType: returning: $xml");
    11829. -
    11830. return $xml;
    11831. -
    11832. }
    11833. -
    11834. if ($uqType == 'Array') {
    11835. -
    11836. // JBoss/Axis does this sometimes
    11837. -
    11838. return $this->serialize_val($value, $name, false, false, false, false, $use);
    11839. -
    11840. }
    11841. -
    11842. if ($uqType == 'boolean') {
    11843. -
    11844. if ((is_string($value) && $value == 'false') || (! $value)) {
    11845. -
    11846. $value = 'false';
    11847. -
    11848. } else {
    11849. -
    11850. $value = 'true';
    11851. -
    11852. }
    11853. -
    11854. }
    11855. -
    11856. if ($uqType == 'string' && gettype($value) == 'string') {
    11857. -
    11858. $value = $this->expandEntities($value);
    11859. -
    11860. }
    11861. -
    11862. if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') {
    11863. -
    11864. $value = sprintf("%.0lf", $value);
    11865. -
    11866. }
    11867. -
    11868. // it's a scalar
    11869. -
    11870. // TODO: what about null/nil values?
    11871. -
    11872. // check type isn't a custom type extending xmlschema namespace
    11873. -
    11874. if (!$this->getTypeDef($uqType, $ns)) {
    11875. -
    11876. if ($use == 'literal') {
    11877. -
    11878. if ($forceType) {
    11879. -
    11880. $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
    11881. -
    11882. } else {
    11883. -
    11884. $xml = "<$name$elementNS>$value</$name>";
    11885. -
    11886. }
    11887. -
    11888. } else {
    11889. -
    11890. $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
    11891. -
    11892. }
    11893. -
    11894. $this->debug("in serializeType: returning: $xml");
    11895. -
    11896. return $xml;
    11897. -
    11898. }
    11899. -
    11900. $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)');
    11901. -
    11902. } else if ($ns == 'http://xml.apache.org/xml-soap') {
    11903. -
    11904. $this->debug('in serializeType: appears to be Apache SOAP type');
    11905. -
    11906. if ($uqType == 'Map') {
    11907. -
    11908. $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
    11909. -
    11910. if (! $tt_prefix) {
    11911. -
    11912. $this->debug('in serializeType: Add namespace for Apache SOAP type');
    11913. -
    11914. $tt_prefix = 'ns' . rand(1000, 9999);
    11915. -
    11916. $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
    11917. -
    11918. // force this to be added to usedNamespaces
    11919. -
    11920. $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
    11921. -
    11922. }
    11923. -
    11924. $contents = '';
    11925. -
    11926. foreach($value as $k => $v) {
    11927. -
    11928. $this->debug("serializing map element: key $k, value $v");
    11929. -
    11930. $contents .= '<item>';
    11931. -
    11932. $contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
    11933. -
    11934. $contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
    11935. -
    11936. $contents .= '</item>';
    11937. -
    11938. }
    11939. -
    11940. if ($use == 'literal') {
    11941. -
    11942. if ($forceType) {
    11943. -
    11944. $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>";
    11945. -
    11946. } else {
    11947. -
    11948. $xml = "<$name>$contents</$name>";
    11949. -
    11950. }
    11951. -
    11952. } else {
    11953. -
    11954. $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>";
    11955. -
    11956. }
    11957. -
    11958. $this->debug("in serializeType: returning: $xml");
    11959. -
    11960. return $xml;
    11961. -
    11962. }
    11963. -
    11964. $this->debug('in serializeType: Apache SOAP type, but only support Map');
    11965. -
    11966. }
    11967. -
    11968. } else {
    11969. -
    11970. // TODO: should the type be compared to types in XSD, and the namespace
    11971. -
    11972. // set to XSD if the type matches?
    11973. -
    11974. $this->debug("in serializeType: No namespace for type $type");
    11975. -
    11976. $ns = '';
    11977. -
    11978. $uqType = $type;
    11979. -
    11980. }
    11981. -
    11982. if(!$typeDef = $this->getTypeDef($uqType, $ns)){
    11983. -
    11984. $this->setError("$type ($uqType) is not a supported type.");
    11985. -
    11986. $this->debug("in serializeType: $type ($uqType) is not a supported type.");
    11987. -
    11988. return false;
    11989. -
    11990. } else {
    11991. -
    11992. $this->debug("in serializeType: found typeDef");
    11993. -
    11994. $this->appendDebug('typeDef=' . $this->varDump($typeDef));
    11995. -
    11996. if (substr($uqType, -1) == '^') {
    11997. -
    11998. $uqType = substr($uqType, 0, -1);
    11999. -
    12000. }
    12001. -
    12002. }
    12003. -
    12004. if (!isset($typeDef['phpType'])) {
    12005. -
    12006. $this->setError("$type ($uqType) has no phpType.");
    12007. -
    12008. $this->debug("in serializeType: $type ($uqType) has no phpType.");
    12009. -
    12010. return false;
    12011. -
    12012. }
    12013. -
    12014. $phpType = $typeDef['phpType'];
    12015. -
    12016. $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
    12017. -
    12018. // if php type == struct, map value to the <all> element names
    12019. -
    12020. if ($phpType == 'struct') {
    12021. -
    12022. if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
    12023. -
    12024. $elementName = $uqType;
    12025. -
    12026. if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
    12027. -
    12028. $elementNS = " xmlns=\"$ns\"";
    12029. -
    12030. } else {
    12031. -
    12032. $elementNS = " xmlns=\"\"";
    12033. -
    12034. }
    12035. -
    12036. } else {
    12037. -
    12038. $elementName = $name;
    12039. -
    12040. if ($unqualified) {
    12041. -
    12042. $elementNS = " xmlns=\"\"";
    12043. -
    12044. } else {
    12045. -
    12046. $elementNS = '';
    12047. -
    12048. }
    12049. -
    12050. }
    12051. -
    12052. if (is_null($value)) {
    12053. -
    12054. if ($use == 'literal') {
    12055. -
    12056. // TODO: depends on minOccurs and nillable
    12057. -
    12058. $xml = "<$elementName$elementNS/>";
    12059. -
    12060. } else {
    12061. -
    12062. $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
    12063. -
    12064. }
    12065. -
    12066. $this->debug("in serializeType: returning: $xml");
    12067. -
    12068. return $xml;
    12069. -
    12070. }
    12071. -
    12072. if (is_object($value)) {
    12073. -
    12074. $value = get_object_vars($value);
    12075. -
    12076. }
    12077. -
    12078. if (is_array($value)) {
    12079. -
    12080. $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
    12081. -
    12082. if ($use == 'literal') {
    12083. -
    12084. if ($forceType) {
    12085. -
    12086. $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">";
    12087. -
    12088. } else {
    12089. -
    12090. $xml = "<$elementName$elementNS$elementAttrs>";
    12091. -
    12092. }
    12093. -
    12094. } else {
    12095. -
    12096. $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>";
    12097. -
    12098. }
    12099. -
    12100.  
    12101. -
    12102. if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') {
    12103. -
    12104. if (isset($value['!'])) {
    12105. -
    12106. $xml .= $value['!'];
    12107. -
    12108. $this->debug("in serializeType: serialized simpleContent for type $type");
    12109. -
    12110. } else {
    12111. -
    12112. $this->debug("in serializeType: no simpleContent to serialize for type $type");
    12113. -
    12114. }
    12115. -
    12116. } else {
    12117. -
    12118. // complexContent
    12119. -
    12120. $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
    12121. -
    12122. }
    12123. -
    12124. $xml .= "</$elementName>";
    12125. -
    12126. } else {
    12127. -
    12128. $this->debug("in serializeType: phpType is struct, but value is not an array");
    12129. -
    12130. $this->setError("phpType is struct, but value is not an array: see debug output for details");
    12131. -
    12132. $xml = '';
    12133. -
    12134. }
    12135. -
    12136. } elseif ($phpType == 'array') {
    12137. -
    12138. if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
    12139. -
    12140. $elementNS = " xmlns=\"$ns\"";
    12141. -
    12142. } else {
    12143. -
    12144. if ($unqualified) {
    12145. -
    12146. $elementNS = " xmlns=\"\"";
    12147. -
    12148. } else {
    12149. -
    12150. $elementNS = '';
    12151. -
    12152. }
    12153. -
    12154. }
    12155. -
    12156. if (is_null($value)) {
    12157. -
    12158. if ($use == 'literal') {
    12159. -
    12160. // TODO: depends on minOccurs
    12161. -
    12162. $xml = "<$name$elementNS/>";
    12163. -
    12164. } else {
    12165. -
    12166. $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" .
    12167. -
    12168. $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
    12169. -
    12170. ":Array\" " .
    12171. -
    12172. $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
    12173. -
    12174. ':arrayType="' .
    12175. -
    12176. $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
    12177. -
    12178. ':' .
    12179. -
    12180. $this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
    12181. -
    12182. }
    12183. -
    12184. $this->debug("in serializeType: returning: $xml");
    12185. -
    12186. return $xml;
    12187. -
    12188. }
    12189. -
    12190. if (isset($typeDef['multidimensional'])) {
    12191. -
    12192. $nv = array();
    12193. -
    12194. foreach($value as $v) {
    12195. -
    12196. $cols = ',' . sizeof($v);
    12197. -
    12198. $nv = array_merge($nv, $v);
    12199. -
    12200. }
    12201. -
    12202. $value = $nv;
    12203. -
    12204. } else {
    12205. -
    12206. $cols = '';
    12207. -
    12208. }
    12209. -
    12210. if (is_array($value) && sizeof($value) >= 1) {
    12211. -
    12212. $rows = sizeof($value);
    12213. -
    12214. $contents = '';
    12215. -
    12216. foreach($value as $k => $v) {
    12217. -
    12218. $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
    12219. -
    12220. //if (strpos($typeDef['arrayType'], ':') ) {
    12221. -
    12222. if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
    12223. -
    12224. $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
    12225. -
    12226. } else {
    12227. -
    12228. $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
    12229. -
    12230. }
    12231. -
    12232. }
    12233. -
    12234. } else {
    12235. -
    12236. $rows = 0;
    12237. -
    12238. $contents = null;
    12239. -
    12240. }
    12241. -
    12242. // TODO: for now, an empty value will be serialized as a zero element
    12243. -
    12244. // array. Revisit this when coding the handling of null/nil values.
    12245. -
    12246. if ($use == 'literal') {
    12247. -
    12248. $xml = "<$name$elementNS>"
    12249. -
    12250. .$contents
    12251. -
    12252. ."</$name>";
    12253. -
    12254. } else {
    12255. -
    12256. $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '.
    12257. -
    12258. $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
    12259. -
    12260. .':arrayType="'
    12261. -
    12262. .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
    12263. -
    12264. .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">"
    12265. -
    12266. .$contents
    12267. -
    12268. ."</$name>";
    12269. -
    12270. }
    12271. -
    12272. } elseif ($phpType == 'scalar') {
    12273. -
    12274. if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
    12275. -
    12276. $elementNS = " xmlns=\"$ns\"";
    12277. -
    12278. } else {
    12279. -
    12280. if ($unqualified) {
    12281. -
    12282. $elementNS = " xmlns=\"\"";
    12283. -
    12284. } else {
    12285. -
    12286. $elementNS = '';
    12287. -
    12288. }
    12289. -
    12290. }
    12291. -
    12292. if ($use == 'literal') {
    12293. -
    12294. if ($forceType) {
    12295. -
    12296. $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
    12297. -
    12298. } else {
    12299. -
    12300. $xml = "<$name$elementNS>$value</$name>";
    12301. -
    12302. }
    12303. -
    12304. } else {
    12305. -
    12306. $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
    12307. -
    12308. }
    12309. -
    12310. }
    12311. -
    12312. $this->debug("in serializeType: returning: $xml");
    12313. -
    12314. return $xml;
    12315. -
    12316. }
    12317. -
    12318. -
    12319. /**
    12320. -
    12321. * serializes the attributes for a complexType
    12322. -
    12323. *
    12324. -
    12325. * @param array $typeDef our internal representation of an XML schema type (or element)
    12326. -
    12327. * @param mixed $value a native PHP value (parameter value)
    12328. -
    12329. * @param string $ns the namespace of the type
    12330. -
    12331. * @param string $uqType the local part of the type
    12332. -
    12333. * @return string value serialized as an XML string
    12334. -
    12335. * @access private
    12336. -
    12337. */
    12338. -
    12339. function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) {
    12340. -
    12341. $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType");
    12342. -
    12343. $xml = '';
    12344. -
    12345. if (isset($typeDef['extensionBase'])) {
    12346. -
    12347. $nsx = $this->getPrefix($typeDef['extensionBase']);
    12348. -
    12349. $uqTypex = $this->getLocalPart($typeDef['extensionBase']);
    12350. -
    12351. if ($this->getNamespaceFromPrefix($nsx)) {
    12352. -
    12353. $nsx = $this->getNamespaceFromPrefix($nsx);
    12354. -
    12355. }
    12356. -
    12357. if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) {
    12358. -
    12359. $this->debug("serialize attributes for extension base $nsx:$uqTypex");
    12360. -
    12361. $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex);
    12362. -
    12363. } else {
    12364. -
    12365. $this->debug("extension base $nsx:$uqTypex is not a supported type");
    12366. -
    12367. }
    12368. -
    12369. }
    12370. -
    12371. if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) {
    12372. -
    12373. $this->debug("serialize attributes for XML Schema type $ns:$uqType");
    12374. -
    12375. if (is_array($value)) {
    12376. -
    12377. $xvalue = $value;
    12378. -
    12379. } elseif (is_object($value)) {
    12380. -
    12381. $xvalue = get_object_vars($value);
    12382. -
    12383. } else {
    12384. -
    12385. $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
    12386. -
    12387. $xvalue = array();
    12388. -
    12389. }
    12390. -
    12391. foreach ($typeDef['attrs'] as $aName => $attrs) {
    12392. -
    12393. if (isset($xvalue['!' . $aName])) {
    12394. -
    12395. $xname = '!' . $aName;
    12396. -
    12397. $this->debug("value provided for attribute $aName with key $xname");
    12398. -
    12399. } elseif (isset($xvalue[$aName])) {
    12400. -
    12401. $xname = $aName;
    12402. -
    12403. $this->debug("value provided for attribute $aName with key $xname");
    12404. -
    12405. } elseif (isset($attrs['default'])) {
    12406. -
    12407. $xname = '!' . $aName;
    12408. -
    12409. $xvalue[$xname] = $attrs['default'];
    12410. -
    12411. $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
    12412. -
    12413. } else {
    12414. -
    12415. $xname = '';
    12416. -
    12417. $this->debug("no value provided for attribute $aName");
    12418. -
    12419. }
    12420. -
    12421. if ($xname) {
    12422. -
    12423. $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
    12424. -
    12425. }
    12426. -
    12427. }
    12428. -
    12429. } else {
    12430. -
    12431. $this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
    12432. -
    12433. }
    12434. -
    12435. return $xml;
    12436. -
    12437. }
    12438. -
    12439.  
    12440. -
    12441. /**
    12442. -
    12443. * serializes the elements for a complexType
    12444. -
    12445. *
    12446. -
    12447. * @param array $typeDef our internal representation of an XML schema type (or element)
    12448. -
    12449. * @param mixed $value a native PHP value (parameter value)
    12450. -
    12451. * @param string $ns the namespace of the type
    12452. -
    12453. * @param string $uqType the local part of the type
    12454. -
    12455. * @param string $use use for part (encoded|literal)
    12456. -
    12457. * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style)
    12458. -
    12459. * @return string value serialized as an XML string
    12460. -
    12461. * @access private
    12462. -
    12463. */
    12464. -
    12465. function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) {
    12466. -
    12467. $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType");
    12468. -
    12469. $xml = '';
    12470. -
    12471. if (isset($typeDef['extensionBase'])) {
    12472. -
    12473. $nsx = $this->getPrefix($typeDef['extensionBase']);
    12474. -
    12475. $uqTypex = $this->getLocalPart($typeDef['extensionBase']);
    12476. -
    12477. if ($this->getNamespaceFromPrefix($nsx)) {
    12478. -
    12479. $nsx = $this->getNamespaceFromPrefix($nsx);
    12480. -
    12481. }
    12482. -
    12483. if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) {
    12484. -
    12485. $this->debug("serialize elements for extension base $nsx:$uqTypex");
    12486. -
    12487. $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle);
    12488. -
    12489. } else {
    12490. -
    12491. $this->debug("extension base $nsx:$uqTypex is not a supported type");
    12492. -
    12493. }
    12494. -
    12495. }
    12496. -
    12497. if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
    12498. -
    12499. $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType");
    12500. -
    12501. if (is_array($value)) {
    12502. -
    12503. $xvalue = $value;
    12504. -
    12505. } elseif (is_object($value)) {
    12506. -
    12507. $xvalue = get_object_vars($value);
    12508. -
    12509. } else {
    12510. -
    12511. $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
    12512. -
    12513. $xvalue = array();
    12514. -
    12515. }
    12516. -
    12517. // toggle whether all elements are present - ideally should validate against schema
    12518. -
    12519. if (count($typeDef['elements']) != count($xvalue)){
    12520. -
    12521. $optionals = true;
    12522. -
    12523. }
    12524. -
    12525. foreach ($typeDef['elements'] as $eName => $attrs) {
    12526. -
    12527. if (!isset($xvalue[$eName])) {
    12528. -
    12529. if (isset($attrs['default'])) {
    12530. -
    12531. $xvalue[$eName] = $attrs['default'];
    12532. -
    12533. $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
    12534. -
    12535. }
    12536. -
    12537. }
    12538. -
    12539. // if user took advantage of a minOccurs=0, then only serialize named parameters
    12540. -
    12541. if (isset($optionals)
    12542. -
    12543. && (!isset($xvalue[$eName]))
    12544. -
    12545. && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
    12546. -
    12547. ){
    12548. -
    12549. if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
    12550. -
    12551. $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
    12552. -
    12553. }
    12554. -
    12555. // do nothing
    12556. -
    12557. $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
    12558. -
    12559. } else {
    12560. -
    12561. // get value
    12562. -
    12563. if (isset($xvalue[$eName])) {
    12564. -
    12565. $v = $xvalue[$eName];
    12566. -
    12567. } else {
    12568. -
    12569. $v = null;
    12570. -
    12571. }
    12572. -
    12573. if (isset($attrs['form'])) {
    12574. -
    12575. $unqualified = ($attrs['form'] == 'unqualified');
    12576. -
    12577. } else {
    12578. -
    12579. $unqualified = false;
    12580. -
    12581. }
    12582. -
    12583. if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') {
    12584. -
    12585. $vv = $v;
    12586. -
    12587. foreach ($vv as $k => $v) {
    12588. -
    12589. if (isset($attrs['type']) || isset($attrs['ref'])) {
    12590. -
    12591. // serialize schema-defined type
    12592. -
    12593. $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
    12594. -
    12595. } else {
    12596. -
    12597. // serialize generic type (can this ever really happen?)
    12598. -
    12599. $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
    12600. -
    12601. $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
    12602. -
    12603. }
    12604. -
    12605. }
    12606. -
    12607. } else {
    12608. -
    12609. if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') {
    12610. -
    12611. // do nothing
    12612. -
    12613. } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') {
    12614. -
    12615. // TODO: serialize a nil correctly, but for now serialize schema-defined type
    12616. -
    12617. $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
    12618. -
    12619. } elseif (isset($attrs['type']) || isset($attrs['ref'])) {
    12620. -
    12621. // serialize schema-defined type
    12622. -
    12623. $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
    12624. -
    12625. } else {
    12626. -
    12627. // serialize generic type (can this ever really happen?)
    12628. -
    12629. $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
    12630. -
    12631. $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
    12632. -
    12633. }
    12634. -
    12635. }
    12636. -
    12637. }
    12638. -
    12639. }
    12640. -
    12641. } else {
    12642. -
    12643. $this->debug("no elements to serialize for XML Schema type $ns:$uqType");
    12644. -
    12645. }
    12646. -
    12647. return $xml;
    12648. -
    12649. }
    12650. -
    12651.  
    12652. -
    12653. /**
    12654. -
    12655. * adds an XML Schema complex type to the WSDL types
    12656. -
    12657. *
    12658. -
    12659. * @param string $name
    12660. -
    12661. * @param string $typeClass (complexType|simpleType|attribute)
    12662. -
    12663. * @param string $phpType currently supported are array and struct (php assoc array)
    12664. -
    12665. * @param string $compositor (all|sequence|choice)
    12666. -
    12667. * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
    12668. -
    12669. * @param array $elements e.g. array ( name => array(name=>'',type=>'') )
    12670. -
    12671. * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]'))
    12672. -
    12673. * @param string $arrayType as namespace:name (xsd:string)
    12674. -
    12675. * @see nusoap_xmlschema
    12676. -
    12677. * @access public
    12678. -
    12679. */
    12680. -
    12681. function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') {
    12682. -
    12683. if (count($elements) > 0) {
    12684. -
    12685. $eElements = array();
    12686. -
    12687. foreach($elements as $n => $e){
    12688. -
    12689. // expand each element
    12690. -
    12691. $ee = array();
    12692. -
    12693. foreach ($e as $k => $v) {
    12694. -
    12695. $k = strpos($k,':') ? $this->expandQname($k) : $k;
    12696. -
    12697. $v = strpos($v,':') ? $this->expandQname($v) : $v;
    12698. -
    12699. $ee[$k] = $v;
    12700. -
    12701. }
    12702. -
    12703. $eElements[$n] = $ee;
    12704. -
    12705. }
    12706. -
    12707. $elements = $eElements;
    12708. -
    12709. }
    12710. -
    12711. -
    12712. if (count($attrs) > 0) {
    12713. -
    12714. foreach($attrs as $n => $a){
    12715. -
    12716. // expand each attribute
    12717. -
    12718. foreach ($a as $k => $v) {
    12719. -
    12720. $k = strpos($k,':') ? $this->expandQname($k) : $k;
    12721. -
    12722. $v = strpos($v,':') ? $this->expandQname($v) : $v;
    12723. -
    12724. $aa[$k] = $v;
    12725. -
    12726. }
    12727. -
    12728. $eAttrs[$n] = $aa;
    12729. -
    12730. }
    12731. -
    12732. $attrs = $eAttrs;
    12733. -
    12734. }
    12735. -
    12736.  
    12737. -
    12738. $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
    12739. -
    12740. $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
    12741. -
    12742.  
    12743. -
    12744. $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
    12745. -
    12746. $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
    12747. -
    12748. }
    12749. -
    12750.  
    12751. -
    12752. /**
    12753. -
    12754. * adds an XML Schema simple type to the WSDL types
    12755. -
    12756. *
    12757. -
    12758. * @param string $name
    12759. -
    12760. * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
    12761. -
    12762. * @param string $typeClass (should always be simpleType)
    12763. -
    12764. * @param string $phpType (should always be scalar)
    12765. -
    12766. * @param array $enumeration array of values
    12767. -
    12768. * @see nusoap_xmlschema
    12769. -
    12770. * @access public
    12771. -
    12772. */
    12773. -
    12774. function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
    12775. -
    12776. $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
    12777. -
    12778.  
    12779. -
    12780. $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
    12781. -
    12782. $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
    12783. -
    12784. }
    12785. -
    12786.  
    12787. -
    12788. /**
    12789. -
    12790. * adds an element to the WSDL types
    12791. -
    12792. *
    12793. -
    12794. * @param array $attrs attributes that must include name and type
    12795. -
    12796. * @see nusoap_xmlschema
    12797. -
    12798. * @access public
    12799. -
    12800. */
    12801. -
    12802. function addElement($attrs) {
    12803. -
    12804. $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
    12805. -
    12806. $this->schemas[$typens][0]->addElement($attrs);
    12807. -
    12808. }
    12809. -
    12810.  
    12811. -
    12812. /**
    12813. -
    12814. * register an operation with the server
    12815. -
    12816. *
    12817. -
    12818. * @param string $name operation (method) name
    12819. -
    12820. * @param array $in assoc array of input values: key = param name, value = param type
    12821. -
    12822. * @param array $out assoc array of output values: key = param name, value = param type
    12823. -
    12824. * @param string $namespace optional The namespace for the operation
    12825. -
    12826. * @param string $soapaction optional The soapaction for the operation
    12827. -
    12828. * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically
    12829. -
    12830. * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now)
    12831. -
    12832. * @param string $documentation optional The description to include in the WSDL
    12833. -
    12834. * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
    12835. -
    12836. * @access public
    12837. -
    12838. */
    12839. -
    12840. function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){
    12841. -
    12842. if ($use == 'encoded' && $encodingStyle == '') {
    12843. -
    12844. $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
    12845. -
    12846. }
    12847. -
    12848.  
    12849. -
    12850. if ($style == 'document') {
    12851. -
    12852. $elements = array();
    12853. -
    12854. foreach ($in as $n => $t) {
    12855. -
    12856. $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified');
    12857. -
    12858. }
    12859. -
    12860. $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
    12861. -
    12862. $this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
    12863. -
    12864. $in = array('parameters' => 'tns:' . $name . '^');
    12865. -
    12866.  
    12867. -
    12868. $elements = array();
    12869. -
    12870. foreach ($out as $n => $t) {
    12871. -
    12872. $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified');
    12873. -
    12874. }
    12875. -
    12876. $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
    12877. -
    12878. $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified'));
    12879. -
    12880. $out = array('parameters' => 'tns:' . $name . 'Response' . '^');
    12881. -
    12882. }
    12883. -
    12884.  
    12885. -
    12886. // get binding
    12887. -
    12888. $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
    12889. -
    12890. array(
    12891. -
    12892. 'name' => $name,
    12893. -
    12894. 'binding' => $this->serviceName . 'Binding',
    12895. -
    12896. 'endpoint' => $this->endpoint,
    12897. -
    12898. 'soapAction' => $soapaction,
    12899. -
    12900. 'style' => $style,
    12901. -
    12902. 'input' => array(
    12903. -
    12904. 'use' => $use,
    12905. -
    12906. 'namespace' => $namespace,
    12907. -
    12908. 'encodingStyle' => $encodingStyle,
    12909. -
    12910. 'message' => $name . 'Request',
    12911. -
    12912. 'parts' => $in),
    12913. -
    12914. 'output' => array(
    12915. -
    12916. 'use' => $use,
    12917. -
    12918. 'namespace' => $namespace,
    12919. -
    12920. 'encodingStyle' => $encodingStyle,
    12921. -
    12922. 'message' => $name . 'Response',
    12923. -
    12924. 'parts' => $out),
    12925. -
    12926. 'namespace' => $namespace,
    12927. -
    12928. 'transport' => 'http://schemas.xmlsoap.org/soap/http',
    12929. -
    12930. 'documentation' => $documentation);
    12931. -
    12932. // add portTypes
    12933. -
    12934. // add messages
    12935. -
    12936. if($in)
    12937. -
    12938. {
    12939. -
    12940. foreach($in as $pName => $pType)
    12941. -
    12942. {
    12943. -
    12944. if(strpos($pType,':')) {
    12945. -
    12946. $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
    12947. -
    12948. }
    12949. -
    12950. $this->messages[$name.'Request'][$pName] = $pType;
    12951. -
    12952. }
    12953. -
    12954. } else {
    12955. -
    12956. $this->messages[$name.'Request']= '0';
    12957. -
    12958. }
    12959. -
    12960. if($out)
    12961. -
    12962. {
    12963. -
    12964. foreach($out as $pName => $pType)
    12965. -
    12966. {
    12967. -
    12968. if(strpos($pType,':')) {
    12969. -
    12970. $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
    12971. -
    12972. }
    12973. -
    12974. $this->messages[$name.'Response'][$pName] = $pType;
    12975. -
    12976. }
    12977. -
    12978. } else {
    12979. -
    12980. $this->messages[$name.'Response']= '0';
    12981. -
    12982. }
    12983. -
    12984. return true;
    12985. -
    12986. }
    12987. -
    12988. }
    12989. -
    12990. ?><?php
    12991. -
    12992.  
    12993. -
    12994.  
    12995. -
    12996.  
    12997. -
    12998. /**
    12999. -
    13000. *
    13001. -
    13002. * nusoap_parser class parses SOAP XML messages into native PHP values
    13003. -
    13004. *
    13005. -
    13006. * @author Dietrich Ayala <dietrich@ganx4.com>
    13007. -
    13008. * @author Scott Nichol <snichol@users.sourceforge.net>
    13009. -
    13010. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    13011. -
    13012. * @access public
    13013. -
    13014. */
    13015. -
    13016. class nusoap_parser extends nusoap_base {
    13017. -
    13018.  
    13019. -
    13020. var $xml = '';
    13021. -
    13022. var $xml_encoding = '';
    13023. -
    13024. var $method = '';
    13025. -
    13026. var $root_struct = '';
    13027. -
    13028. var $root_struct_name = '';
    13029. -
    13030. var $root_struct_namespace = '';
    13031. -
    13032. var $root_header = '';
    13033. -
    13034. var $document = ''; // incoming SOAP body (text)
    13035. -
    13036. // determines where in the message we are (envelope,header,body,method)
    13037. -
    13038. -
    13039. var $status = '';
    13040. -
    13041. var $position = 0;
    13042. -
    13043. var $depth = 0;
    13044. -
    13045. var $default_namespace = '';
    13046. -
    13047. var $namespaces = array();
    13048. -
    13049. var $message = array();
    13050. -
    13051. var $parent = '';
    13052. -
    13053. var $fault = false;
    13054. -
    13055. var $fault_code = '';
    13056. -
    13057. var $fault_str = '';
    13058. -
    13059. var $fault_detail = '';
    13060. -
    13061. var $depth_array = array();
    13062. -
    13063. var $debug_flag = true;
    13064. -
    13065. var $soapresponse = NULL; // parsed SOAP Body
    13066. -
    13067. -
    13068. var $soapheader = NULL; // parsed SOAP Header
    13069. -
    13070. -
    13071. var $responseHeaders = ''; // incoming SOAP headers (text)
    13072. -
    13073. -
    13074. var $body_position = 0;
    13075. -
    13076. // for multiref parsing:
    13077. -
    13078. // array of id => pos
    13079. -
    13080. -
    13081. var $ids = array();
    13082. -
    13083. // array of id => hrefs => pos
    13084. -
    13085. -
    13086. var $multirefs = array();
    13087. -
    13088. // toggle for auto-decoding element content
    13089. -
    13090. -
    13091. var $decode_utf8 = true;
    13092. -
    13093.  
    13094. -
    13095. /**
    13096. -
    13097. * constructor that actually does the parsing
    13098. -
    13099. *
    13100. -
    13101. * @param string $xml SOAP message
    13102. -
    13103. * @param string $encoding character encoding scheme of message
    13104. -
    13105. * @param string $method method for which XML is parsed (unused?)
    13106. -
    13107. * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
    13108. -
    13109. * @access public
    13110. -
    13111. */
    13112. -
    13113. function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
    13114. -
    13115. parent::nusoap_base();
    13116. -
    13117. $this->xml = $xml;
    13118. -
    13119. $this->xml_encoding = $encoding;
    13120. -
    13121. $this->method = $method;
    13122. -
    13123. $this->decode_utf8 = $decode_utf8;
    13124. -
    13125.  
    13126. -
    13127. // Check whether content has been read.
    13128. -
    13129. if(!empty($xml)){
    13130. -
    13131. // Check XML encoding
    13132. -
    13133. $pos_xml = strpos($xml, '<?xml');
    13134. -
    13135. if ($pos_xml !== FALSE) {
    13136. -
    13137. $xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
    13138. -
    13139. if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
    13140. -
    13141. $xml_encoding = $res[1];
    13142. -
    13143. if (strtoupper($xml_encoding) != $encoding) {
    13144. -
    13145. $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
    13146. -
    13147. $this->debug($err);
    13148. -
    13149. if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
    13150. -
    13151. $this->setError($err);
    13152. -
    13153. return;
    13154. -
    13155. }
    13156. -
    13157. // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
    13158. -
    13159. } else {
    13160. -
    13161. $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
    13162. -
    13163. }
    13164. -
    13165. } else {
    13166. -
    13167. $this->debug('No encoding specified in XML declaration');
    13168. -
    13169. }
    13170. -
    13171. } else {
    13172. -
    13173. $this->debug('No XML declaration');
    13174. -
    13175. }
    13176. -
    13177. $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
    13178. -
    13179. // Create an XML parser - why not xml_parser_create_ns?
    13180. -
    13181. $this->parser = xml_parser_create($this->xml_encoding);
    13182. -
    13183. // Set the options for parsing the XML data.
    13184. -
    13185. //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    13186. -
    13187. xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
    13188. -
    13189. xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
    13190. -
    13191. // Set the object for the parser.
    13192. -
    13193. xml_set_object($this->parser, $this);
    13194. -
    13195. // Set the element handlers for the parser.
    13196. -
    13197. xml_set_element_handler($this->parser, 'start_element','end_element');
    13198. -
    13199. xml_set_character_data_handler($this->parser,'character_data');
    13200. -
    13201.  
    13202. -
    13203. // Parse the XML file.
    13204. -
    13205. if(!xml_parse($this->parser,$xml,true)){
    13206. -
    13207. // Display an error message.
    13208. -
    13209. $err = sprintf('XML error parsing SOAP payload on line %d: %s',
    13210. -
    13211. xml_get_current_line_number($this->parser),
    13212. -
    13213. xml_error_string(xml_get_error_code($this->parser)));
    13214. -
    13215. $this->debug($err);
    13216. -
    13217. $this->debug("XML payload:\n" . $xml);
    13218. -
    13219. $this->setError($err);
    13220. -
    13221. } else {
    13222. -
    13223. $this->debug('in nusoap_parser ctor, message:');
    13224. -
    13225. $this->appendDebug($this->varDump($this->message));
    13226. -
    13227. $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
    13228. -
    13229. // get final value
    13230. -
    13231. $this->soapresponse = $this->message[$this->root_struct]['result'];
    13232. -
    13233. // get header value
    13234. -
    13235. if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
    13236. -
    13237. $this->soapheader = $this->message[$this->root_header]['result'];
    13238. -
    13239. }
    13240. -
    13241. // resolve hrefs/ids
    13242. -
    13243. if(sizeof($this->multirefs) > 0){
    13244. -
    13245. foreach($this->multirefs as $id => $hrefs){
    13246. -
    13247. $this->debug('resolving multirefs for id: '.$id);
    13248. -
    13249. $idVal = $this->buildVal($this->ids[$id]);
    13250. -
    13251. if (is_array($idVal) && isset($idVal['!id'])) {
    13252. -
    13253. unset($idVal['!id']);
    13254. -
    13255. }
    13256. -
    13257. foreach($hrefs as $refPos => $ref){
    13258. -
    13259. $this->debug('resolving href at pos '.$refPos);
    13260. -
    13261. $this->multirefs[$id][$refPos] = $idVal;
    13262. -
    13263. }
    13264. -
    13265. }
    13266. -
    13267. }
    13268. -
    13269. }
    13270. -
    13271. xml_parser_free($this->parser);
    13272. -
    13273. } else {
    13274. -
    13275. $this->debug('xml was empty, didn\'t parse!');
    13276. -
    13277. $this->setError('xml was empty, didn\'t parse!');
    13278. -
    13279. }
    13280. -
    13281. }
    13282. -
    13283.  
    13284. -
    13285. /**
    13286. -
    13287. * start-element handler
    13288. -
    13289. *
    13290. -
    13291. * @param resource $parser XML parser object
    13292. -
    13293. * @param string $name element name
    13294. -
    13295. * @param array $attrs associative array of attributes
    13296. -
    13297. * @access private
    13298. -
    13299. */
    13300. -
    13301. function start_element($parser, $name, $attrs) {
    13302. -
    13303. // position in a total number of elements, starting from 0
    13304. -
    13305. // update class level pos
    13306. -
    13307. $pos = $this->position++;
    13308. -
    13309. // and set mine
    13310. -
    13311. $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
    13312. -
    13313. // depth = how many levels removed from root?
    13314. -
    13315. // set mine as current global depth and increment global depth value
    13316. -
    13317. $this->message[$pos]['depth'] = $this->depth++;
    13318. -
    13319.  
    13320. -
    13321. // else add self as child to whoever the current parent is
    13322. -
    13323. if($pos != 0){
    13324. -
    13325. $this->message[$this->parent]['children'] .= '|'.$pos;
    13326. -
    13327. }
    13328. -
    13329. // set my parent
    13330. -
    13331. $this->message[$pos]['parent'] = $this->parent;
    13332. -
    13333. // set self as current parent
    13334. -
    13335. $this->parent = $pos;
    13336. -
    13337. // set self as current value for this depth
    13338. -
    13339. $this->depth_array[$this->depth] = $pos;
    13340. -
    13341. // get element prefix
    13342. -
    13343. if(strpos($name,':')){
    13344. -
    13345. // get ns prefix
    13346. -
    13347. $prefix = substr($name,0,strpos($name,':'));
    13348. -
    13349. // get unqualified name
    13350. -
    13351. $name = substr(strstr($name,':'),1);
    13352. -
    13353. }
    13354. -
    13355. // set status
    13356. -
    13357. if ($name == 'Envelope' && $this->status == '') {
    13358. -
    13359. $this->status = 'envelope';
    13360. -
    13361. } elseif ($name == 'Header' && $this->status == 'envelope') {
    13362. -
    13363. $this->root_header = $pos;
    13364. -
    13365. $this->status = 'header';
    13366. -
    13367. } elseif ($name == 'Body' && $this->status == 'envelope'){
    13368. -
    13369. $this->status = 'body';
    13370. -
    13371. $this->body_position = $pos;
    13372. -
    13373. // set method
    13374. -
    13375. } elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
    13376. -
    13377. $this->status = 'method';
    13378. -
    13379. $this->root_struct_name = $name;
    13380. -
    13381. $this->root_struct = $pos;
    13382. -
    13383. $this->message[$pos]['type'] = 'struct';
    13384. -
    13385. $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
    13386. -
    13387. }
    13388. -
    13389. // set my status
    13390. -
    13391. $this->message[$pos]['status'] = $this->status;
    13392. -
    13393. // set name
    13394. -
    13395. $this->message[$pos]['name'] = htmlspecialchars($name);
    13396. -
    13397. // set attrs
    13398. -
    13399. $this->message[$pos]['attrs'] = $attrs;
    13400. -
    13401.  
    13402. -
    13403. // loop through atts, logging ns and type declarations
    13404. -
    13405. $attstr = '';
    13406. -
    13407. foreach($attrs as $key => $value){
    13408. -
    13409. $key_prefix = $this->getPrefix($key);
    13410. -
    13411. $key_localpart = $this->getLocalPart($key);
    13412. -
    13413. // if ns declarations, add to class level array of valid namespaces
    13414. -
    13415. if($key_prefix == 'xmlns'){
    13416. -
    13417. if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
    13418. -
    13419. $this->XMLSchemaVersion = $value;
    13420. -
    13421. $this->namespaces['xsd'] = $this->XMLSchemaVersion;
    13422. -
    13423. $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
    13424. -
    13425. }
    13426. -
    13427. $this->namespaces[$key_localpart] = $value;
    13428. -
    13429. // set method namespace
    13430. -
    13431. if($name == $this->root_struct_name){
    13432. -
    13433. $this->methodNamespace = $value;
    13434. -
    13435. }
    13436. -
    13437. // if it's a type declaration, set type
    13438. -
    13439. } elseif($key_localpart == 'type'){
    13440. -
    13441. if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
    13442. -
    13443. // do nothing: already processed arrayType
    13444. -
    13445. } else {
    13446. -
    13447. $value_prefix = $this->getPrefix($value);
    13448. -
    13449. $value_localpart = $this->getLocalPart($value);
    13450. -
    13451. $this->message[$pos]['type'] = $value_localpart;
    13452. -
    13453. $this->message[$pos]['typePrefix'] = $value_prefix;
    13454. -
    13455. if(isset($this->namespaces[$value_prefix])){
    13456. -
    13457. $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
    13458. -
    13459. } else if(isset($attrs['xmlns:'.$value_prefix])) {
    13460. -
    13461. $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
    13462. -
    13463. }
    13464. -
    13465. // should do something here with the namespace of specified type?
    13466. -
    13467. }
    13468. -
    13469. } elseif($key_localpart == 'arrayType'){
    13470. -
    13471. $this->message[$pos]['type'] = 'array';
    13472. -
    13473. /* do arrayType ereg here
    13474. -
    13475. [1] arrayTypeValue ::= atype asize
    13476. -
    13477. [2] atype ::= QName rank*
    13478. -
    13479. [3] rank ::= '[' (',')* ']'
    13480. -
    13481. [4] asize ::= '[' length~ ']'
    13482. -
    13483. [5] length ::= nextDimension* Digit+
    13484. -
    13485. [6] nextDimension ::= Digit+ ','
    13486. -
    13487. */
    13488. -
    13489. $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
    13490. -
    13491. if(preg_match($expr,$value,$regs)){
    13492. -
    13493. $this->message[$pos]['typePrefix'] = $regs[1];
    13494. -
    13495. $this->message[$pos]['arrayTypePrefix'] = $regs[1];
    13496. -
    13497. if (isset($this->namespaces[$regs[1]])) {
    13498. -
    13499. $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
    13500. -
    13501. } else if (isset($attrs['xmlns:'.$regs[1]])) {
    13502. -
    13503. $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
    13504. -
    13505. }
    13506. -
    13507. $this->message[$pos]['arrayType'] = $regs[2];
    13508. -
    13509. $this->message[$pos]['arraySize'] = $regs[3];
    13510. -
    13511. $this->message[$pos]['arrayCols'] = $regs[4];
    13512. -
    13513. }
    13514. -
    13515. // specifies nil value (or not)
    13516. -
    13517. } elseif ($key_localpart == 'nil'){
    13518. -
    13519. $this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
    13520. -
    13521. // some other attribute
    13522. -
    13523. } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
    13524. -
    13525. $this->message[$pos]['xattrs']['!' . $key] = $value;
    13526. -
    13527. }
    13528. -
    13529.  
    13530. -
    13531. if ($key == 'xmlns') {
    13532. -
    13533. $this->default_namespace = $value;
    13534. -
    13535. }
    13536. -
    13537. // log id
    13538. -
    13539. if($key == 'id'){
    13540. -
    13541. $this->ids[$value] = $pos;
    13542. -
    13543. }
    13544. -
    13545. // root
    13546. -
    13547. if($key_localpart == 'root' && $value == 1){
    13548. -
    13549. $this->status = 'method';
    13550. -
    13551. $this->root_struct_name = $name;
    13552. -
    13553. $this->root_struct = $pos;
    13554. -
    13555. $this->debug("found root struct $this->root_struct_name, pos $pos");
    13556. -
    13557. }
    13558. -
    13559. // for doclit
    13560. -
    13561. $attstr .= " $key=\"$value\"";
    13562. -
    13563. }
    13564. -
    13565. // get namespace - must be done after namespace atts are processed
    13566. -
    13567. if(isset($prefix)){
    13568. -
    13569. $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
    13570. -
    13571. $this->default_namespace = $this->namespaces[$prefix];
    13572. -
    13573. } else {
    13574. -
    13575. $this->message[$pos]['namespace'] = $this->default_namespace;
    13576. -
    13577. }
    13578. -
    13579. if($this->status == 'header'){
    13580. -
    13581. if ($this->root_header != $pos) {
    13582. -
    13583. $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
    13584. -
    13585. }
    13586. -
    13587. } elseif($this->root_struct_name != ''){
    13588. -
    13589. $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
    13590. -
    13591. }
    13592. -
    13593. }
    13594. -
    13595.  
    13596. -
    13597. /**
    13598. -
    13599. * end-element handler
    13600. -
    13601. *
    13602. -
    13603. * @param resource $parser XML parser object
    13604. -
    13605. * @param string $name element name
    13606. -
    13607. * @access private
    13608. -
    13609. */
    13610. -
    13611. function end_element($parser, $name) {
    13612. -
    13613. // position of current element is equal to the last value left in depth_array for my depth
    13614. -
    13615. $pos = $this->depth_array[$this->depth--];
    13616. -
    13617.  
    13618. -
    13619. // get element prefix
    13620. -
    13621. if(strpos($name,':')){
    13622. -
    13623. // get ns prefix
    13624. -
    13625. $prefix = substr($name,0,strpos($name,':'));
    13626. -
    13627. // get unqualified name
    13628. -
    13629. $name = substr(strstr($name,':'),1);
    13630. -
    13631. }
    13632. -
    13633. -
    13634. // build to native type
    13635. -
    13636. if(isset($this->body_position) && $pos > $this->body_position){
    13637. -
    13638. // deal w/ multirefs
    13639. -
    13640. if(isset($this->message[$pos]['attrs']['href'])){
    13641. -
    13642. // get id
    13643. -
    13644. $id = substr($this->message[$pos]['attrs']['href'],1);
    13645. -
    13646. // add placeholder to href array
    13647. -
    13648. $this->multirefs[$id][$pos] = 'placeholder';
    13649. -
    13650. // add set a reference to it as the result value
    13651. -
    13652. $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
    13653. -
    13654. // build complexType values
    13655. -
    13656. } elseif($this->message[$pos]['children'] != ''){
    13657. -
    13658. // if result has already been generated (struct/array)
    13659. -
    13660. if(!isset($this->message[$pos]['result'])){
    13661. -
    13662. $this->message[$pos]['result'] = $this->buildVal($pos);
    13663. -
    13664. }
    13665. -
    13666. // build complexType values of attributes and possibly simpleContent
    13667. -
    13668. } elseif (isset($this->message[$pos]['xattrs'])) {
    13669. -
    13670. if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
    13671. -
    13672. $this->message[$pos]['xattrs']['!'] = null;
    13673. -
    13674. } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
    13675. -
    13676. if (isset($this->message[$pos]['type'])) {
    13677. -
    13678. $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
    13679. -
    13680. } else {
    13681. -
    13682. $parent = $this->message[$pos]['parent'];
    13683. -
    13684. if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
    13685. -
    13686. $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
    13687. -
    13688. } else {
    13689. -
    13690. $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
    13691. -
    13692. }
    13693. -
    13694. }
    13695. -
    13696. }
    13697. -
    13698. $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
    13699. -
    13700. // set value of simpleType (or nil complexType)
    13701. -
    13702. } else {
    13703. -
    13704. //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
    13705. -
    13706. if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
    13707. -
    13708. $this->message[$pos]['xattrs']['!'] = null;
    13709. -
    13710. } elseif (isset($this->message[$pos]['type'])) {
    13711. -
    13712. $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
    13713. -
    13714. } else {
    13715. -
    13716. $parent = $this->message[$pos]['parent'];
    13717. -
    13718. if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
    13719. -
    13720. $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
    13721. -
    13722. } else {
    13723. -
    13724. $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
    13725. -
    13726. }
    13727. -
    13728. }
    13729. -
    13730.  
    13731. -
    13732. /* add value to parent's result, if parent is struct/array
    13733. -
    13734. $parent = $this->message[$pos]['parent'];
    13735. -
    13736. if($this->message[$parent]['type'] != 'map'){
    13737. -
    13738. if(strtolower($this->message[$parent]['type']) == 'array'){
    13739. -
    13740. $this->message[$parent]['result'][] = $this->message[$pos]['result'];
    13741. -
    13742. } else {
    13743. -
    13744. $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result'];
    13745. -
    13746. }
    13747. -
    13748. }
    13749. -
    13750. */
    13751. -
    13752. }
    13753. -
    13754. }
    13755. -
    13756. -
    13757. // for doclit
    13758. -
    13759. if($this->status == 'header'){
    13760. -
    13761. if ($this->root_header != $pos) {
    13762. -
    13763. $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
    13764. -
    13765. }
    13766. -
    13767. } elseif($pos >= $this->root_struct){
    13768. -
    13769. $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
    13770. -
    13771. }
    13772. -
    13773. // switch status
    13774. -
    13775. if ($pos == $this->root_struct){
    13776. -
    13777. $this->status = 'body';
    13778. -
    13779. $this->root_struct_namespace = $this->message[$pos]['namespace'];
    13780. -
    13781. } elseif ($pos == $this->root_header) {
    13782. -
    13783. $this->status = 'envelope';
    13784. -
    13785. } elseif ($name == 'Body' && $this->status == 'body') {
    13786. -
    13787. $this->status = 'envelope';
    13788. -
    13789. } elseif ($name == 'Header' && $this->status == 'header') { // will never happen
    13790. -
    13791. $this->status = 'envelope';
    13792. -
    13793. } elseif ($name == 'Envelope' && $this->status == 'envelope') {
    13794. -
    13795. $this->status = '';
    13796. -
    13797. }
    13798. -
    13799. // set parent back to my parent
    13800. -
    13801. $this->parent = $this->message[$pos]['parent'];
    13802. -
    13803. }
    13804. -
    13805.  
    13806. -
    13807. /**
    13808. -
    13809. * element content handler
    13810. -
    13811. *
    13812. -
    13813. * @param resource $parser XML parser object
    13814. -
    13815. * @param string $data element content
    13816. -
    13817. * @access private
    13818. -
    13819. */
    13820. -
    13821. function character_data($parser, $data){
    13822. -
    13823. $pos = $this->depth_array[$this->depth];
    13824. -
    13825. if ($this->xml_encoding=='UTF-8'){
    13826. -
    13827. // TODO: add an option to disable this for folks who want
    13828. -
    13829. // raw UTF-8 that, e.g., might not map to iso-8859-1
    13830. -
    13831. // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
    13832. -
    13833. if($this->decode_utf8){
    13834. -
    13835. $data = utf8_decode($data);
    13836. -
    13837. }
    13838. -
    13839. }
    13840. -
    13841. $this->message[$pos]['cdata'] .= $data;
    13842. -
    13843. // for doclit
    13844. -
    13845. if($this->status == 'header'){
    13846. -
    13847. $this->responseHeaders .= $data;
    13848. -
    13849. } else {
    13850. -
    13851. $this->document .= $data;
    13852. -
    13853. }
    13854. -
    13855. }
    13856. -
    13857.  
    13858. -
    13859. /**
    13860. -
    13861. * get the parsed message (SOAP Body)
    13862. -
    13863. *
    13864. -
    13865. * @return mixed
    13866. -
    13867. * @access public
    13868. -
    13869. * @deprecated use get_soapbody instead
    13870. -
    13871. */
    13872. -
    13873. function get_response(){
    13874. -
    13875. return $this->soapresponse;
    13876. -
    13877. }
    13878. -
    13879.  
    13880. -
    13881. /**
    13882. -
    13883. * get the parsed SOAP Body (NULL if there was none)
    13884. -
    13885. *
    13886. -
    13887. * @return mixed
    13888. -
    13889. * @access public
    13890. -
    13891. */
    13892. -
    13893. function get_soapbody(){
    13894. -
    13895. return $this->soapresponse;
    13896. -
    13897. }
    13898. -
    13899.  
    13900. -
    13901. /**
    13902. -
    13903. * get the parsed SOAP Header (NULL if there was none)
    13904. -
    13905. *
    13906. -
    13907. * @return mixed
    13908. -
    13909. * @access public
    13910. -
    13911. */
    13912. -
    13913. function get_soapheader(){
    13914. -
    13915. return $this->soapheader;
    13916. -
    13917. }
    13918. -
    13919.  
    13920. -
    13921. /**
    13922. -
    13923. * get the unparsed SOAP Header
    13924. -
    13925. *
    13926. -
    13927. * @return string XML or empty if no Header
    13928. -
    13929. * @access public
    13930. -
    13931. */
    13932. -
    13933. function getHeaders(){
    13934. -
    13935. return $this->responseHeaders;
    13936. -
    13937. }
    13938. -
    13939.  
    13940. -
    13941. /**
    13942. -
    13943. * decodes simple types into PHP variables
    13944. -
    13945. *
    13946. -
    13947. * @param string $value value to decode
    13948. -
    13949. * @param string $type XML type to decode
    13950. -
    13951. * @param string $typens XML type namespace to decode
    13952. -
    13953. * @return mixed PHP value
    13954. -
    13955. * @access private
    13956. -
    13957. */
    13958. -
    13959. function decodeSimple($value, $type, $typens) {
    13960. -
    13961. // TODO: use the namespace!
    13962. -
    13963. if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
    13964. -
    13965. return (string) $value;
    13966. -
    13967. }
    13968. -
    13969. if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
    13970. -
    13971. return (int) $value;
    13972. -
    13973. }
    13974. -
    13975. if ($type == 'float' || $type == 'double' || $type == 'decimal') {
    13976. -
    13977. return (double) $value;
    13978. -
    13979. }
    13980. -
    13981. if ($type == 'boolean') {
    13982. -
    13983. if (strtolower($value) == 'false' || strtolower($value) == 'f') {
    13984. -
    13985. return false;
    13986. -
    13987. }
    13988. -
    13989. return (boolean) $value;
    13990. -
    13991. }
    13992. -
    13993. if ($type == 'base64' || $type == 'base64Binary') {
    13994. -
    13995. $this->debug('Decode base64 value');
    13996. -
    13997. return base64_decode($value);
    13998. -
    13999. }
    14000. -
    14001. // obscure numeric types
    14002. -
    14003. if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
    14004. -
    14005. || $type == 'nonNegativeInteger' || $type == 'positiveInteger'
    14006. -
    14007. || $type == 'unsignedInt'
    14008. -
    14009. || $type == 'unsignedShort' || $type == 'unsignedByte') {
    14010. -
    14011. return (int) $value;
    14012. -
    14013. }
    14014. -
    14015. // bogus: parser treats array with no elements as a simple type
    14016. -
    14017. if ($type == 'array') {
    14018. -
    14019. return array();
    14020. -
    14021. }
    14022. -
    14023. // everything else
    14024. -
    14025. return (string) $value;
    14026. -
    14027. }
    14028. -
    14029.  
    14030. -
    14031. /**
    14032. -
    14033. * builds response structures for compound values (arrays/structs)
    14034. -
    14035. * and scalars
    14036. -
    14037. *
    14038. -
    14039. * @param integer $pos position in node tree
    14040. -
    14041. * @return mixed PHP value
    14042. -
    14043. * @access private
    14044. -
    14045. */
    14046. -
    14047. function buildVal($pos){
    14048. -
    14049. if(!isset($this->message[$pos]['type'])){
    14050. -
    14051. $this->message[$pos]['type'] = '';
    14052. -
    14053. }
    14054. -
    14055. $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
    14056. -
    14057. // if there are children...
    14058. -
    14059. if($this->message[$pos]['children'] != ''){
    14060. -
    14061. $this->debug('in buildVal, there are children');
    14062. -
    14063. $children = explode('|',$this->message[$pos]['children']);
    14064. -
    14065. array_shift($children); // knock off empty
    14066. -
    14067. // md array
    14068. -
    14069. if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
    14070. -
    14071. $r=0; // rowcount
    14072. -
    14073. $c=0; // colcount
    14074. -
    14075. foreach($children as $child_pos){
    14076. -
    14077. $this->debug("in buildVal, got an MD array element: $r, $c");
    14078. -
    14079. $params[$r][] = $this->message[$child_pos]['result'];
    14080. -
    14081. $c++;
    14082. -
    14083. if($c == $this->message[$pos]['arrayCols']){
    14084. -
    14085. $c = 0;
    14086. -
    14087. $r++;
    14088. -
    14089. }
    14090. -
    14091. }
    14092. -
    14093. // array
    14094. -
    14095. } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
    14096. -
    14097. $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
    14098. -
    14099. foreach($children as $child_pos){
    14100. -
    14101. $params[] = &$this->message[$child_pos]['result'];
    14102. -
    14103. }
    14104. -
    14105. // apache Map type: java hashtable
    14106. -
    14107. } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
    14108. -
    14109. $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
    14110. -
    14111. foreach($children as $child_pos){
    14112. -
    14113. $kv = explode("|",$this->message[$child_pos]['children']);
    14114. -
    14115. $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
    14116. -
    14117. }
    14118. -
    14119. // generic compound type
    14120. -
    14121. //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
    14122. -
    14123. } else {
    14124. -
    14125. // Apache Vector type: treat as an array
    14126. -
    14127. $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']);
    14128. -
    14129. if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
    14130. -
    14131. $notstruct = 1;
    14132. -
    14133. } else {
    14134. -
    14135. $notstruct = 0;
    14136. -
    14137. }
    14138. -
    14139. //
    14140. -
    14141. foreach($children as $child_pos){
    14142. -
    14143. if($notstruct){
    14144. -
    14145. $params[] = &$this->message[$child_pos]['result'];
    14146. -
    14147. } else {
    14148. -
    14149. if (isset($params[$this->message[$child_pos]['name']])) {
    14150. -
    14151. // de-serialize repeated element name into an array
    14152. -
    14153. if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
    14154. -
    14155. $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
    14156. -
    14157. }
    14158. -
    14159. $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
    14160. -
    14161. } else {
    14162. -
    14163. $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
    14164. -
    14165. }
    14166. -
    14167. }
    14168. -
    14169. }
    14170. -
    14171. }
    14172. -
    14173. if (isset($this->message[$pos]['xattrs'])) {
    14174. -
    14175. $this->debug('in buildVal, handling attributes');
    14176. -
    14177. foreach ($this->message[$pos]['xattrs'] as $n => $v) {
    14178. -
    14179. $params[$n] = $v;
    14180. -
    14181. }
    14182. -
    14183. }
    14184. -
    14185. // handle simpleContent
    14186. -
    14187. if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
    14188. -
    14189. $this->debug('in buildVal, handling simpleContent');
    14190. -
    14191. if (isset($this->message[$pos]['type'])) {
    14192. -
    14193. $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
    14194. -
    14195. } else {
    14196. -
    14197. $parent = $this->message[$pos]['parent'];
    14198. -
    14199. if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
    14200. -
    14201. $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
    14202. -
    14203. } else {
    14204. -
    14205. $params['!'] = $this->message[$pos]['cdata'];
    14206. -
    14207. }
    14208. -
    14209. }
    14210. -
    14211. }
    14212. -
    14213. $ret = is_array($params) ? $params : array();
    14214. -
    14215. $this->debug('in buildVal, return:');
    14216. -
    14217. $this->appendDebug($this->varDump($ret));
    14218. -
    14219. return $ret;
    14220. -
    14221. } else {
    14222. -
    14223. $this->debug('in buildVal, no children, building scalar');
    14224. -
    14225. $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
    14226. -
    14227. if (isset($this->message[$pos]['type'])) {
    14228. -
    14229. $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
    14230. -
    14231. $this->debug("in buildVal, return: $ret");
    14232. -
    14233. return $ret;
    14234. -
    14235. }
    14236. -
    14237. $parent = $this->message[$pos]['parent'];
    14238. -
    14239. if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
    14240. -
    14241. $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
    14242. -
    14243. $this->debug("in buildVal, return: $ret");
    14244. -
    14245. return $ret;
    14246. -
    14247. }
    14248. -
    14249. $ret = $this->message[$pos]['cdata'];
    14250. -
    14251. $this->debug("in buildVal, return: $ret");
    14252. -
    14253. return $ret;
    14254. -
    14255. }
    14256. -
    14257. }
    14258. -
    14259. }
    14260. -
    14261.  
    14262. -
    14263. /**
    14264. -
    14265. * Backward compatibility
    14266. -
    14267. */
    14268. -
    14269. class soap_parser extends nusoap_parser {
    14270. -
    14271. }
    14272. -
    14273.  
    14274. -
    14275. ?><?php
    14276. -
    14277.  
    14278. -
    14279.  
    14280. -
    14281.  
    14282. -
    14283. /**
    14284. -
    14285. *
    14286. -
    14287. * [nu]soapclient higher level class for easy usage.
    14288. -
    14289. *
    14290. -
    14291. * usage:
    14292. -
    14293. *
    14294. -
    14295. * // instantiate client with server info
    14296. -
    14297. * $soapclient = new nusoap_client( string path [ ,mixed wsdl] );
    14298. -
    14299. *
    14300. -
    14301. * // call method, get results
    14302. -
    14303. * echo $soapclient->call( string methodname [ ,array parameters] );
    14304. -
    14305. *
    14306. -
    14307. * // bye bye client
    14308. -
    14309. * unset($soapclient);
    14310. -
    14311. *
    14312. -
    14313. * @author Dietrich Ayala <dietrich@ganx4.com>
    14314. -
    14315. * @author Scott Nichol <snichol@users.sourceforge.net>
    14316. -
    14317. * @version $Id: fsource_nusoap__nusoap.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    14318. -
    14319. * @access public
    14320. -
    14321. */
    14322. -
    14323. class nusoap_client extends nusoap_base {
    14324. -
    14325.  
    14326. -
    14327. var $username = ''; // Username for HTTP authentication
    14328. -
    14329. -
    14330. var $password = ''; // Password for HTTP authentication
    14331. -
    14332. -
    14333. var $authtype = ''; // Type of HTTP authentication
    14334. -
    14335. -
    14336. var $certRequest = array(); // Certificate for HTTP SSL authentication
    14337. -
    14338. -
    14339. var $requestHeaders = false; // SOAP headers in request (text)
    14340. -
    14341. -
    14342. var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text)
    14343. -
    14344. -
    14345. var $responseHeader = NULL; // SOAP Header from response (parsed)
    14346. -
    14347. -
    14348. var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text)
    14349. -
    14350. -
    14351. var $endpoint;
    14352. -
    14353. var $forceEndpoint = ''; // overrides WSDL endpoint
    14354. -
    14355. -
    14356. var $proxyhost = '';
    14357. -
    14358. var $proxyport = '';
    14359. -
    14360. var $proxyusername = '';
    14361. -
    14362. var $proxypassword = '';
    14363. -
    14364. var $portName = ''; // port name to use in WSDL
    14365. -
    14366. -
    14367. var $xml_encoding = ''; // character set encoding of incoming (response) messages
    14368. -
    14369. -
    14370. var $http_encoding = false;
    14371. -
    14372. var $timeout = 0; // HTTP connection timeout
    14373. -
    14374. -
    14375. var $response_timeout = 30; // HTTP response timeout
    14376. -
    14377. -
    14378. var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error
    14379. -
    14380. -
    14381. var $persistentConnection = false;
    14382. -
    14383. var $defaultRpcParams = false; // This is no longer used
    14384. -
    14385. -
    14386. var $request = ''; // HTTP request
    14387. -
    14388. -
    14389. var $response = ''; // HTTP response
    14390. -
    14391. -
    14392. var $responseData = ''; // SOAP payload of response
    14393. -
    14394. -
    14395. var $cookies = array(); // Cookies from response or for request
    14396. -
    14397. -
    14398. var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode()
    14399. -
    14400. -
    14401. var $operations = array(); // WSDL operations, empty for WSDL initialization error
    14402. -
    14403. -
    14404. var $curl_options = array(); // User-specified cURL options
    14405. -
    14406. -
    14407. var $bindingType = ''; // WSDL operation binding type
    14408. -
    14409. -
    14410. var $use_curl = false; // whether to always try to use cURL
    14411. -
    14412.  
    14413. -
    14414. /*
    14415. -
    14416. * fault related variables
    14417. -
    14418. */
    14419. -
    14420. /**
    14421. -
    14422. * @var fault
    14423. -
    14424. * @access public
    14425. -
    14426. */
    14427. -
    14428. var $fault;
    14429. -
    14430. /**
    14431. -
    14432. * @var faultcode
    14433. -
    14434. * @access public
    14435. -
    14436. */
    14437. -
    14438. var $faultcode;
    14439. -
    14440. /**
    14441. -
    14442. * @var faultstring
    14443. -
    14444. * @access public
    14445. -
    14446. */
    14447. -
    14448. var $faultstring;
    14449. -
    14450. /**
    14451. -
    14452. * @var faultdetail
    14453. -
    14454. * @access public
    14455. -
    14456. */
    14457. -
    14458. var $faultdetail;
    14459. -
    14460.  
    14461. -
    14462. /**
    14463. -
    14464. * constructor
    14465. -
    14466. *
    14467. -
    14468. * @param mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
    14469. -
    14470. * @param mixed $wsdl optional, set to 'wsdl' or true if using WSDL
    14471. -
    14472. * @param string $proxyhost optional
    14473. -
    14474. * @param string $proxyport optional
    14475. -
    14476. * @param string $proxyusername optional
    14477. -
    14478. * @param string $proxypassword optional
    14479. -
    14480. * @param integer $timeout set the connection timeout
    14481. -
    14482. * @param integer $response_timeout set the response timeout
    14483. -
    14484. * @param string $portName optional portName in WSDL document
    14485. -
    14486. * @access public
    14487. -
    14488. */
    14489. -
    14490. function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
    14491. -
    14492. parent::nusoap_base();
    14493. -
    14494. $this->endpoint = $endpoint;
    14495. -
    14496. $this->proxyhost = $proxyhost;
    14497. -
    14498. $this->proxyport = $proxyport;
    14499. -
    14500. $this->proxyusername = $proxyusername;
    14501. -
    14502. $this->proxypassword = $proxypassword;
    14503. -
    14504. $this->timeout = $timeout;
    14505. -
    14506. $this->response_timeout = $response_timeout;
    14507. -
    14508. $this->portName = $portName;
    14509. -
    14510.  
    14511. -
    14512. $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
    14513. -
    14514. $this->appendDebug('endpoint=' . $this->varDump($endpoint));
    14515. -
    14516.  
    14517. -
    14518. // make values
    14519. -
    14520. if($wsdl){
    14521. -
    14522. if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) {
    14523. -
    14524. $this->wsdl = $endpoint;
    14525. -
    14526. $this->endpoint = $this->wsdl->wsdl;
    14527. -
    14528. $this->wsdlFile = $this->endpoint;
    14529. -
    14530. $this->debug('existing wsdl instance created from ' . $this->endpoint);
    14531. -
    14532. $this->checkWSDL();
    14533. -
    14534. } else {
    14535. -
    14536. $this->wsdlFile = $this->endpoint;
    14537. -
    14538. $this->wsdl = null;
    14539. -
    14540. $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint);
    14541. -
    14542. }
    14543. -
    14544. $this->endpointType = 'wsdl';
    14545. -
    14546. } else {
    14547. -
    14548. $this->debug("instantiate SOAP with endpoint at $endpoint");
    14549. -
    14550. $this->endpointType = 'soap';
    14551. -
    14552. }
    14553. -
    14554. }
    14555. -
    14556.  
    14557. -
    14558. /**
    14559. -
    14560. * calls method, returns PHP native type
    14561. -
    14562. *
    14563. -
    14564. * @param string $operation SOAP server URL or path
    14565. -
    14566. * @param mixed $params An array, associative or simple, of the parameters
    14567. -
    14568. * for the method call, or a string that is the XML
    14569. -
    14570. * for the call. For rpc style, this call will
    14571. -
    14572. * wrap the XML in a tag named after the method, as
    14573. -
    14574. * well as the SOAP Envelope and Body. For document
    14575. -
    14576. * style, this will only wrap with the Envelope and Body.
    14577. -
    14578. * IMPORTANT: when using an array with document style,
    14579. -
    14580. * in which case there
    14581. -
    14582. * is really one parameter, the root of the fragment
    14583. -
    14584. * used in the call, which encloses what programmers
    14585. -
    14586. * normally think of parameters. A parameter array
    14587. -
    14588. * *must* include the wrapper.
    14589. -
    14590. * @param string $namespace optional method namespace (WSDL can override)
    14591. -
    14592. * @param string $soapAction optional SOAPAction value (WSDL can override)
    14593. -
    14594. * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array
    14595. -
    14596. * @param boolean $rpcParams optional (no longer used)
    14597. -
    14598. * @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override)
    14599. -
    14600. * @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override)
    14601. -
    14602. * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors
    14603. -
    14604. * @access public
    14605. -
    14606. */
    14607. -
    14608. function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){
    14609. -
    14610. $this->operation = $operation;
    14611. -
    14612. $this->fault = false;
    14613. -
    14614. $this->setError('');
    14615. -
    14616. $this->request = '';
    14617. -
    14618. $this->response = '';
    14619. -
    14620. $this->responseData = '';
    14621. -
    14622. $this->faultstring = '';
    14623. -
    14624. $this->faultcode = '';
    14625. -
    14626. $this->opData = array();
    14627. -
    14628. -
    14629. $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
    14630. -
    14631. $this->appendDebug('params=' . $this->varDump($params));
    14632. -
    14633. $this->appendDebug('headers=' . $this->varDump($headers));
    14634. -
    14635. if ($headers) {
    14636. -
    14637. $this->requestHeaders = $headers;
    14638. -
    14639. }
    14640. -
    14641. if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
    14642. -
    14643. $this->loadWSDL();
    14644. -
    14645. if ($this->getError())
    14646. -
    14647. return false;
    14648. -
    14649. }
    14650. -
    14651. // serialize parameters
    14652. -
    14653. if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
    14654. -
    14655. // use WSDL for operation
    14656. -
    14657. $this->opData = $opData;
    14658. -
    14659. $this->debug("found operation");
    14660. -
    14661. $this->appendDebug('opData=' . $this->varDump($opData));
    14662. -
    14663. if (isset($opData['soapAction'])) {
    14664. -
    14665. $soapAction = $opData['soapAction'];
    14666. -
    14667. }
    14668. -
    14669. if (! $this->forceEndpoint) {
    14670. -
    14671. $this->endpoint = $opData['endpoint'];
    14672. -
    14673. } else {
    14674. -
    14675. $this->endpoint = $this->forceEndpoint;
    14676. -
    14677. }
    14678. -
    14679. $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace;
    14680. -
    14681. $style = $opData['style'];
    14682. -
    14683. $use = $opData['input']['use'];
    14684. -
    14685. // add ns to ns array
    14686. -
    14687. if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
    14688. -
    14689. $nsPrefix = 'ns' . rand(1000, 9999);
    14690. -
    14691. $this->wsdl->namespaces[$nsPrefix] = $namespace;
    14692. -
    14693. }
    14694. -
    14695. $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
    14696. -
    14697. // serialize payload
    14698. -
    14699. if (is_string($params)) {
    14700. -
    14701. $this->debug("serializing param string for WSDL operation $operation");
    14702. -
    14703. $payload = $params;
    14704. -
    14705. } elseif (is_array($params)) {
    14706. -
    14707. $this->debug("serializing param array for WSDL operation $operation");
    14708. -
    14709. $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType);
    14710. -
    14711. } else {
    14712. -
    14713. $this->debug('params must be array or string');
    14714. -
    14715. $this->setError('params must be array or string');
    14716. -
    14717. return false;
    14718. -
    14719. }
    14720. -
    14721. $usedNamespaces = $this->wsdl->usedNamespaces;
    14722. -
    14723. if (isset($opData['input']['encodingStyle'])) {
    14724. -
    14725. $encodingStyle = $opData['input']['encodingStyle'];
    14726. -
    14727. } else {
    14728. -
    14729. $encodingStyle = '';
    14730. -
    14731. }
    14732. -
    14733. $this->appendDebug($this->wsdl->getDebug());
    14734. -
    14735. $this->wsdl->clearDebug();
    14736. -
    14737. if ($errstr = $this->wsdl->getError()) {
    14738. -
    14739. $this->debug('got wsdl error: '.$errstr);
    14740. -
    14741. $this->setError('wsdl error: '.$errstr);
    14742. -
    14743. return false;
    14744. -
    14745. }
    14746. -
    14747. } elseif($this->endpointType == 'wsdl') {
    14748. -
    14749. // operation not in WSDL
    14750. -
    14751. $this->appendDebug($this->wsdl->getDebug());
    14752. -
    14753. $this->wsdl->clearDebug();
    14754. -
    14755. $this->setError('operation '.$operation.' not present in WSDL.');
    14756. -
    14757. $this->debug("operation '$operation' not present in WSDL.");
    14758. -
    14759. return false;
    14760. -
    14761. } else {
    14762. -
    14763. // no WSDL
    14764. -
    14765. //$this->namespaces['ns1'] = $namespace;
    14766. -
    14767. $nsPrefix = 'ns' . rand(1000, 9999);
    14768. -
    14769. // serialize
    14770. -
    14771. $payload = '';
    14772. -
    14773. if (is_string($params)) {
    14774. -
    14775. $this->debug("serializing param string for operation $operation");
    14776. -
    14777. $payload = $params;
    14778. -
    14779. } elseif (is_array($params)) {
    14780. -
    14781. $this->debug("serializing param array for operation $operation");
    14782. -
    14783. foreach($params as $k => $v){
    14784. -
    14785. $payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
    14786. -
    14787. }
    14788. -
    14789. } else {
    14790. -
    14791. $this->debug('params must be array or string');
    14792. -
    14793. $this->setError('params must be array or string');
    14794. -
    14795. return false;
    14796. -
    14797. }
    14798. -
    14799. $usedNamespaces = array();
    14800. -
    14801. if ($use == 'encoded') {
    14802. -
    14803. $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
    14804. -
    14805. } else {
    14806. -
    14807. $encodingStyle = '';
    14808. -
    14809. }
    14810. -
    14811. }
    14812. -
    14813. // wrap RPC calls with method element
    14814. -
    14815. if ($style == 'rpc') {
    14816. -
    14817. if ($use == 'literal') {
    14818. -
    14819. $this->debug("wrapping RPC request with literal method element");
    14820. -
    14821. if ($namespace) {
    14822. -
    14823. // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
    14824. -
    14825. $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
    14826. -
    14827. $payload .
    14828. -
    14829. "</$nsPrefix:$operation>";
    14830. -
    14831. } else {
    14832. -
    14833. $payload = "<$operation>" . $payload . "</$operation>";
    14834. -
    14835. }
    14836. -
    14837. } else {
    14838. -
    14839. $this->debug("wrapping RPC request with encoded method element");
    14840. -
    14841. if ($namespace) {
    14842. -
    14843. $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
    14844. -
    14845. $payload .
    14846. -
    14847. "</$nsPrefix:$operation>";
    14848. -
    14849. } else {
    14850. -
    14851. $payload = "<$operation>" .
    14852. -
    14853. $payload .
    14854. -
    14855. "</$operation>";
    14856. -
    14857. }
    14858. -
    14859. }
    14860. -
    14861. }
    14862. -
    14863. // serialize envelope
    14864. -
    14865. $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle);
    14866. -
    14867. $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle");
    14868. -
    14869. $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));
    14870. -
    14871. // send
    14872. -
    14873. $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
    14874. -
    14875. if($errstr = $this->getError()){
    14876. -
    14877. $this->debug('Error: '.$errstr);
    14878. -
    14879. return false;
    14880. -
    14881. } else {
    14882. -
    14883. $this->return = $return;
    14884. -
    14885. $this->debug('sent message successfully and got a(n) '.gettype($return));
    14886. -
    14887. $this->appendDebug('return=' . $this->varDump($return));
    14888. -
    14889. -
    14890. // fault?
    14891. -
    14892. if(is_array($return) && isset($return['faultcode'])){
    14893. -
    14894. $this->debug('got fault');
    14895. -
    14896. $this->setError($return['faultcode'].': '.$return['faultstring']);
    14897. -
    14898. $this->fault = true;
    14899. -
    14900. foreach($return as $k => $v){
    14901. -
    14902. $this->$k = $v;
    14903. -
    14904. $this->debug("$k = $v<br>");
    14905. -
    14906. }
    14907. -
    14908. return $return;
    14909. -
    14910. } elseif ($style == 'document') {
    14911. -
    14912. // NOTE: if the response is defined to have multiple parts (i.e. unwrapped),
    14913. -
    14914. // we are only going to return the first part here...sorry about that
    14915. -
    14916. return $return;
    14917. -
    14918. } else {
    14919. -
    14920. // array of return values
    14921. -
    14922. if(is_array($return)){
    14923. -
    14924. // multiple 'out' parameters, which we return wrapped up
    14925. -
    14926. // in the array
    14927. -
    14928. if(sizeof($return) > 1){
    14929. -
    14930. return $return;
    14931. -
    14932. }
    14933. -
    14934. // single 'out' parameter (normally the return value)
    14935. -
    14936. $return = array_shift($return);
    14937. -
    14938. $this->debug('return shifted value: ');
    14939. -
    14940. $this->appendDebug($this->varDump($return));
    14941. -
    14942. return $return;
    14943. -
    14944. // nothing returned (ie, echoVoid)
    14945. -
    14946. } else {
    14947. -
    14948. return "";
    14949. -
    14950. }
    14951. -
    14952. }
    14953. -
    14954. }
    14955. -
    14956. }
    14957. -
    14958.  
    14959. -
    14960. /**
    14961. -
    14962. * check WSDL passed as an instance or pulled from an endpoint
    14963. -
    14964. *
    14965. -
    14966. * @access private
    14967. -
    14968. */
    14969. -
    14970. function checkWSDL() {
    14971. -
    14972. $this->appendDebug($this->wsdl->getDebug());
    14973. -
    14974. $this->wsdl->clearDebug();
    14975. -
    14976. $this->debug('checkWSDL');
    14977. -
    14978. // catch errors
    14979. -
    14980. if ($errstr = $this->wsdl->getError()) {
    14981. -
    14982. $this->appendDebug($this->wsdl->getDebug());
    14983. -
    14984. $this->wsdl->clearDebug();
    14985. -
    14986. $this->debug('got wsdl error: '.$errstr);
    14987. -
    14988. $this->setError('wsdl error: '.$errstr);
    14989. -
    14990. } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) {
    14991. -
    14992. $this->appendDebug($this->wsdl->getDebug());
    14993. -
    14994. $this->wsdl->clearDebug();
    14995. -
    14996. $this->bindingType = 'soap';
    14997. -
    14998. $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType);
    14999. -
    15000. } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) {
    15001. -
    15002. $this->appendDebug($this->wsdl->getDebug());
    15003. -
    15004. $this->wsdl->clearDebug();
    15005. -
    15006. $this->bindingType = 'soap12';
    15007. -
    15008. $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType);
    15009. -
    15010. $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************');
    15011. -
    15012. } else {
    15013. -
    15014. $this->appendDebug($this->wsdl->getDebug());
    15015. -
    15016. $this->wsdl->clearDebug();
    15017. -
    15018. $this->debug('getOperations returned false');
    15019. -
    15020. $this->setError('no operations defined in the WSDL document!');
    15021. -
    15022. }
    15023. -
    15024. }
    15025. -
    15026.  
    15027. -
    15028. /**
    15029. -
    15030. * instantiate wsdl object and parse wsdl file
    15031. -
    15032. *
    15033. -
    15034. * @access public
    15035. -
    15036. */
    15037. -
    15038. function loadWSDL() {
    15039. -
    15040. $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile);
    15041. -
    15042. $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl);
    15043. -
    15044. $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest);
    15045. -
    15046. $this->wsdl->fetchWSDL($this->wsdlFile);
    15047. -
    15048. $this->checkWSDL();
    15049. -
    15050. }
    15051. -
    15052.  
    15053. -
    15054. /**
    15055. -
    15056. * get available data pertaining to an operation
    15057. -
    15058. *
    15059. -
    15060. * @param string $operation operation name
    15061. -
    15062. * @return array array of data pertaining to the operation
    15063. -
    15064. * @access public
    15065. -
    15066. */
    15067. -
    15068. function getOperationData($operation){
    15069. -
    15070. if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
    15071. -
    15072. $this->loadWSDL();
    15073. -
    15074. if ($this->getError())
    15075. -
    15076. return false;
    15077. -
    15078. }
    15079. -
    15080. if(isset($this->operations[$operation])){
    15081. -
    15082. return $this->operations[$operation];
    15083. -
    15084. }
    15085. -
    15086. $this->debug("No data for operation: $operation");
    15087. -
    15088. }
    15089. -
    15090.  
    15091. -
    15092. /**
    15093. -
    15094. * send the SOAP message
    15095. -
    15096. *
    15097. -
    15098. * Note: if the operation has multiple return values
    15099. -
    15100. * the return value of this method will be an array
    15101. -
    15102. * of those values.
    15103. -
    15104. *
    15105. -
    15106. * @param string $msg a SOAPx4 soapmsg object
    15107. -
    15108. * @param string $soapaction SOAPAction value
    15109. -
    15110. * @param integer $timeout set connection timeout in seconds
    15111. -
    15112. * @param integer $response_timeout set response timeout in seconds
    15113. -
    15114. * @return mixed native PHP types.
    15115. -
    15116. * @access private
    15117. -
    15118. */
    15119. -
    15120. function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
    15121. -
    15122. $this->checkCookies();
    15123. -
    15124. // detect transport
    15125. -
    15126. switch(true){
    15127. -
    15128. // http(s)
    15129. -
    15130. case preg_match('/^http/',$this->endpoint):
    15131. -
    15132. $this->debug('transporting via HTTP');
    15133. -
    15134. if($this->persistentConnection == true && is_object($this->persistentConnection)){
    15135. -
    15136. $http =& $this->persistentConnection;
    15137. -
    15138. } else {
    15139. -
    15140. $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl);
    15141. -
    15142. if ($this->persistentConnection) {
    15143. -
    15144. $http->usePersistentConnection();
    15145. -
    15146. }
    15147. -
    15148. }
    15149. -
    15150. $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
    15151. -
    15152. $http->setSOAPAction($soapaction);
    15153. -
    15154. if($this->proxyhost && $this->proxyport){
    15155. -
    15156. $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
    15157. -
    15158. }
    15159. -
    15160. if($this->authtype != '') {
    15161. -
    15162. $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
    15163. -
    15164. }
    15165. -
    15166. if($this->http_encoding != ''){
    15167. -
    15168. $http->setEncoding($this->http_encoding);
    15169. -
    15170. }
    15171. -
    15172. $this->debug('sending message, length='.strlen($msg));
    15173. -
    15174. if(preg_match('/^http:/',$this->endpoint)){
    15175. -
    15176. //if(strpos($this->endpoint,'http:')){
    15177. -
    15178. $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
    15179. -
    15180. } elseif(preg_match('/^https/',$this->endpoint)){
    15181. -
    15182. //} elseif(strpos($this->endpoint,'https:')){
    15183. -
    15184. //if(phpversion() == '4.3.0-dev'){
    15185. -
    15186. //$response = $http->send($msg,$timeout,$response_timeout);
    15187. -
    15188. //$this->request = $http->outgoing_payload;
    15189. -
    15190. //$this->response = $http->incoming_payload;
    15191. -
    15192. //} else
    15193. -
    15194. $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
    15195. -
    15196. } else {
    15197. -
    15198. $this->setError('no http/s in endpoint url');
    15199. -
    15200. }
    15201. -
    15202. $this->request = $http->outgoing_payload;
    15203. -
    15204. $this->response = $http->incoming_payload;
    15205. -
    15206. $this->appendDebug($http->getDebug());
    15207. -
    15208. $this->UpdateCookies($http->incoming_cookies);
    15209. -
    15210.  
    15211. -
    15212. // save transport object if using persistent connections
    15213. -
    15214. if ($this->persistentConnection) {
    15215. -
    15216. $http->clearDebug();
    15217. -
    15218. if (!is_object($this->persistentConnection)) {
    15219. -
    15220. $this->persistentConnection = $http;
    15221. -
    15222. }
    15223. -
    15224. }
    15225. -
    15226. -
    15227. if($err = $http->getError()){
    15228. -
    15229. $this->setError('HTTP Error: '.$err);
    15230. -
    15231. return false;
    15232. -
    15233. } elseif($this->getError()){
    15234. -
    15235. return false;
    15236. -
    15237. } else {
    15238. -
    15239. $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']);
    15240. -
    15241. return $this->parseResponse($http->incoming_headers, $this->responseData);
    15242. -
    15243. }
    15244. -
    15245. break;
    15246. -
    15247. default:
    15248. -
    15249. $this->setError('no transport found, or selected transport is not yet supported!');
    15250. -
    15251. return false;
    15252. -
    15253. break;
    15254. -
    15255. }
    15256. -
    15257. }
    15258. -
    15259.  
    15260. -
    15261. /**
    15262. -
    15263. * processes SOAP message returned from server
    15264. -
    15265. *
    15266. -
    15267. * @param array $headers The HTTP headers
    15268. -
    15269. * @param string $data unprocessed response data from server
    15270. -
    15271. * @return mixed value of the message, decoded into a PHP type
    15272. -
    15273. * @access private
    15274. -
    15275. */
    15276. -
    15277. function parseResponse($headers, $data) {
    15278. -
    15279. $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:');
    15280. -
    15281. $this->appendDebug($this->varDump($headers));
    15282. -
    15283. if (!isset($headers['content-type'])) {
    15284. -
    15285. $this->setError('Response not of type text/xml (no content-type header)');
    15286. -
    15287. return false;
    15288. -
    15289. }
    15290. -
    15291. if (!strstr($headers['content-type'], 'text/xml')) {
    15292. -
    15293. $this->setError('Response not of type text/xml: ' . $headers['content-type']);
    15294. -
    15295. return false;
    15296. -
    15297. }
    15298. -
    15299. if (strpos($headers['content-type'], '=')) {
    15300. -
    15301. $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
    15302. -
    15303. $this->debug('Got response encoding: ' . $enc);
    15304. -
    15305. if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
    15306. -
    15307. $this->xml_encoding = strtoupper($enc);
    15308. -
    15309. } else {
    15310. -
    15311. $this->xml_encoding = 'US-ASCII';
    15312. -
    15313. }
    15314. -
    15315. } else {
    15316. -
    15317. // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
    15318. -
    15319. $this->xml_encoding = 'ISO-8859-1';
    15320. -
    15321. }
    15322. -
    15323. $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
    15324. -
    15325. $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
    15326. -
    15327. // add parser debug data to our debug
    15328. -
    15329. $this->appendDebug($parser->getDebug());
    15330. -
    15331. // if parse errors
    15332. -
    15333. if($errstr = $parser->getError()){
    15334. -
    15335. $this->setError( $errstr);
    15336. -
    15337. // destroy the parser object
    15338. -
    15339. unset($parser);
    15340. -
    15341. return false;
    15342. -
    15343. } else {
    15344. -
    15345. // get SOAP headers
    15346. -
    15347. $this->responseHeaders = $parser->getHeaders();
    15348. -
    15349. // get SOAP headers
    15350. -
    15351. $this->responseHeader = $parser->get_soapheader();
    15352. -
    15353. // get decoded message
    15354. -
    15355. $return = $parser->get_soapbody();
    15356. -
    15357. // add document for doclit support
    15358. -
    15359. $this->document = $parser->document;
    15360. -
    15361. // destroy the parser object
    15362. -
    15363. unset($parser);
    15364. -
    15365. // return decode message
    15366. -
    15367. return $return;
    15368. -
    15369. }
    15370. -
    15371. }
    15372. -
    15373.  
    15374. -
    15375. /**
    15376. -
    15377. * sets user-specified cURL options
    15378. -
    15379. *
    15380. -
    15381. * @param mixed $option The cURL option (always integer?)
    15382. -
    15383. * @param mixed $value The cURL option value
    15384. -
    15385. * @access public
    15386. -
    15387. */
    15388. -
    15389. function setCurlOption($option, $value) {
    15390. -
    15391. $this->debug("setCurlOption option=$option, value=");
    15392. -
    15393. $this->appendDebug($this->varDump($value));
    15394. -
    15395. $this->curl_options[$option] = $value;
    15396. -
    15397. }
    15398. -
    15399.  
    15400. -
    15401. /**
    15402. -
    15403. * sets the SOAP endpoint, which can override WSDL
    15404. -
    15405. *
    15406. -
    15407. * @param string $endpoint The endpoint URL to use, or empty string or false to prevent override
    15408. -
    15409. * @access public
    15410. -
    15411. */
    15412. -
    15413. function setEndpoint($endpoint) {
    15414. -
    15415. $this->debug("setEndpoint(\"$endpoint\")");
    15416. -
    15417. $this->forceEndpoint = $endpoint;
    15418. -
    15419. }
    15420. -
    15421.  
    15422. -
    15423. /**
    15424. -
    15425. * set the SOAP headers
    15426. -
    15427. *
    15428. -
    15429. * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers
    15430. -
    15431. * @access public
    15432. -
    15433. */
    15434. -
    15435. function setHeaders($headers){
    15436. -
    15437. $this->debug("setHeaders headers=");
    15438. -
    15439. $this->appendDebug($this->varDump($headers));
    15440. -
    15441. $this->requestHeaders = $headers;
    15442. -
    15443. }
    15444. -
    15445.  
    15446. -
    15447. /**
    15448. -
    15449. * get the SOAP response headers (namespace resolution incomplete)
    15450. -
    15451. *
    15452. -
    15453. * @return string
    15454. -
    15455. * @access public
    15456. -
    15457. */
    15458. -
    15459. function getHeaders(){
    15460. -
    15461. return $this->responseHeaders;
    15462. -
    15463. }
    15464. -
    15465.  
    15466. -
    15467. /**
    15468. -
    15469. * get the SOAP response Header (parsed)
    15470. -
    15471. *
    15472. -
    15473. * @return mixed
    15474. -
    15475. * @access public
    15476. -
    15477. */
    15478. -
    15479. function getHeader(){
    15480. -
    15481. return $this->responseHeader;
    15482. -
    15483. }
    15484. -
    15485.  
    15486. -
    15487. /**
    15488. -
    15489. * set proxy info here
    15490. -
    15491. *
    15492. -
    15493. * @param string $proxyhost
    15494. -
    15495. * @param string $proxyport
    15496. -
    15497. * @param string $proxyusername
    15498. -
    15499. * @param string $proxypassword
    15500. -
    15501. * @access public
    15502. -
    15503. */
    15504. -
    15505. function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
    15506. -
    15507. $this->proxyhost = $proxyhost;
    15508. -
    15509. $this->proxyport = $proxyport;
    15510. -
    15511. $this->proxyusername = $proxyusername;
    15512. -
    15513. $this->proxypassword = $proxypassword;
    15514. -
    15515. }
    15516. -
    15517.  
    15518. -
    15519. /**
    15520. -
    15521. * if authenticating, set user credentials here
    15522. -
    15523. *
    15524. -
    15525. * @param string $username
    15526. -
    15527. * @param string $password
    15528. -
    15529. * @param string $authtype (basic|digest|certificate|ntlm)
    15530. -
    15531. * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
    15532. -
    15533. * @access public
    15534. -
    15535. */
    15536. -
    15537. function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) {
    15538. -
    15539. $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
    15540. -
    15541. $this->appendDebug($this->varDump($certRequest));
    15542. -
    15543. $this->username = $username;
    15544. -
    15545. $this->password = $password;
    15546. -
    15547. $this->authtype = $authtype;
    15548. -
    15549. $this->certRequest = $certRequest;
    15550. -
    15551. }
    15552. -
    15553. -
    15554. /**
    15555. -
    15556. * use HTTP encoding
    15557. -
    15558. *
    15559. -
    15560. * @param string $enc HTTP encoding
    15561. -
    15562. * @access public
    15563. -
    15564. */
    15565. -
    15566. function setHTTPEncoding($enc='gzip, deflate'){
    15567. -
    15568. $this->debug("setHTTPEncoding(\"$enc\")");
    15569. -
    15570. $this->http_encoding = $enc;
    15571. -
    15572. }
    15573. -
    15574. -
    15575. /**
    15576. -
    15577. * Set whether to try to use cURL connections if possible
    15578. -
    15579. *
    15580. -
    15581. * @param boolean $use Whether to try to use cURL
    15582. -
    15583. * @access public
    15584. -
    15585. */
    15586. -
    15587. function setUseCURL($use) {
    15588. -
    15589. $this->debug("setUseCURL($use)");
    15590. -
    15591. $this->use_curl = $use;
    15592. -
    15593. }
    15594. -
    15595.  
    15596. -
    15597. /**
    15598. -
    15599. * use HTTP persistent connections if possible
    15600. -
    15601. *
    15602. -
    15603. * @access public
    15604. -
    15605. */
    15606. -
    15607. function useHTTPPersistentConnection(){
    15608. -
    15609. $this->debug("useHTTPPersistentConnection");
    15610. -
    15611. $this->persistentConnection = true;
    15612. -
    15613. }
    15614. -
    15615. -
    15616. /**
    15617. -
    15618. * gets the default RPC parameter setting.
    15619. -
    15620. * If true, default is that call params are like RPC even for document style.
    15621. -
    15622. * Each call() can override this value.
    15623. -
    15624. *
    15625. -
    15626. * This is no longer used.
    15627. -
    15628. *
    15629. -
    15630. * @return boolean
    15631. -
    15632. * @access public
    15633. -
    15634. * @deprecated
    15635. -
    15636. */
    15637. -
    15638. function getDefaultRpcParams() {
    15639. -
    15640. return $this->defaultRpcParams;
    15641. -
    15642. }
    15643. -
    15644.  
    15645. -
    15646. /**
    15647. -
    15648. * sets the default RPC parameter setting.
    15649. -
    15650. * If true, default is that call params are like RPC even for document style
    15651. -
    15652. * Each call() can override this value.
    15653. -
    15654. *
    15655. -
    15656. * This is no longer used.
    15657. -
    15658. *
    15659. -
    15660. * @param boolean $rpcParams
    15661. -
    15662. * @access public
    15663. -
    15664. * @deprecated
    15665. -
    15666. */
    15667. -
    15668. function setDefaultRpcParams($rpcParams) {
    15669. -
    15670. $this->defaultRpcParams = $rpcParams;
    15671. -
    15672. }
    15673. -
    15674. -
    15675. /**
    15676. -
    15677. * dynamically creates an instance of a proxy class,
    15678. -
    15679. * allowing user to directly call methods from wsdl
    15680. -
    15681. *
    15682. -
    15683. * @return object soap_proxy object
    15684. -
    15685. * @access public
    15686. -
    15687. */
    15688. -
    15689. function getProxy() {
    15690. -
    15691. $r = rand();
    15692. -
    15693. $evalStr = $this->_getProxyClassCode($r);
    15694. -
    15695. //$this->debug("proxy class: $evalStr");
    15696. -
    15697. if ($this->getError()) {
    15698. -
    15699. $this->debug("Error from _getProxyClassCode, so return NULL");
    15700. -
    15701. return null;
    15702. -
    15703. }
    15704. -
    15705. // eval the class
    15706. -
    15707. eval($evalStr);
    15708. -
    15709. // instantiate proxy object
    15710. -
    15711. eval("\$proxy = new nusoap_proxy_$r('');");
    15712. -
    15713. // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice
    15714. -
    15715. $proxy->endpointType = 'wsdl';
    15716. -
    15717. $proxy->wsdlFile = $this->wsdlFile;
    15718. -
    15719. $proxy->wsdl = $this->wsdl;
    15720. -
    15721. $proxy->operations = $this->operations;
    15722. -
    15723. $proxy->defaultRpcParams = $this->defaultRpcParams;
    15724. -
    15725. // transfer other state
    15726. -
    15727. $proxy->soap_defencoding = $this->soap_defencoding;
    15728. -
    15729. $proxy->username = $this->username;
    15730. -
    15731. $proxy->password = $this->password;
    15732. -
    15733. $proxy->authtype = $this->authtype;
    15734. -
    15735. $proxy->certRequest = $this->certRequest;
    15736. -
    15737. $proxy->requestHeaders = $this->requestHeaders;
    15738. -
    15739. $proxy->endpoint = $this->endpoint;
    15740. -
    15741. $proxy->forceEndpoint = $this->forceEndpoint;
    15742. -
    15743. $proxy->proxyhost = $this->proxyhost;
    15744. -
    15745. $proxy->proxyport = $this->proxyport;
    15746. -
    15747. $proxy->proxyusername = $this->proxyusername;
    15748. -
    15749. $proxy->proxypassword = $this->proxypassword;
    15750. -
    15751. $proxy->http_encoding = $this->http_encoding;
    15752. -
    15753. $proxy->timeout = $this->timeout;
    15754. -
    15755. $proxy->response_timeout = $this->response_timeout;
    15756. -
    15757. $proxy->persistentConnection = &$this->persistentConnection;
    15758. -
    15759. $proxy->decode_utf8 = $this->decode_utf8;
    15760. -
    15761. $proxy->curl_options = $this->curl_options;
    15762. -
    15763. $proxy->bindingType = $this->bindingType;
    15764. -
    15765. $proxy->use_curl = $this->use_curl;
    15766. -
    15767. return $proxy;
    15768. -
    15769. }
    15770. -
    15771.  
    15772. -
    15773. /**
    15774. -
    15775. * dynamically creates proxy class code
    15776. -
    15777. *
    15778. -
    15779. * @return string PHP/NuSOAP code for the proxy class
    15780. -
    15781. * @access private
    15782. -
    15783. */
    15784. -
    15785. function _getProxyClassCode($r) {
    15786. -
    15787. $this->debug("in getProxy endpointType=$this->endpointType");
    15788. -
    15789. $this->appendDebug("wsdl=" . $this->varDump($this->wsdl));
    15790. -
    15791. if ($this->endpointType != 'wsdl') {
    15792. -
    15793. $evalStr = 'A proxy can only be created for a WSDL client';
    15794. -
    15795. $this->setError($evalStr);
    15796. -
    15797. $evalStr = "echo \"$evalStr\";";
    15798. -
    15799. return $evalStr;
    15800. -
    15801. }
    15802. -
    15803. if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
    15804. -
    15805. $this->loadWSDL();
    15806. -
    15807. if ($this->getError()) {
    15808. -
    15809. return "echo \"" . $this->getError() . "\";";
    15810. -
    15811. }
    15812. -
    15813. }
    15814. -
    15815. $evalStr = '';
    15816. -
    15817. foreach ($this->operations as $operation => $opData) {
    15818. -
    15819. if ($operation != '') {
    15820. -
    15821. // create param string and param comment string
    15822. -
    15823. if (sizeof($opData['input']['parts']) > 0) {
    15824. -
    15825. $paramStr = '';
    15826. -
    15827. $paramArrayStr = '';
    15828. -
    15829. $paramCommentStr = '';
    15830. -
    15831. foreach ($opData['input']['parts'] as $name => $type) {
    15832. -
    15833. $paramStr .= "\$$name, ";
    15834. -
    15835. $paramArrayStr .= "'$name' => \$$name, ";
    15836. -
    15837. $paramCommentStr .= "$type \$$name, ";
    15838. -
    15839. }
    15840. -
    15841. $paramStr = substr($paramStr, 0, strlen($paramStr)-2);
    15842. -
    15843. $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2);
    15844. -
    15845. $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2);
    15846. -
    15847. } else {
    15848. -
    15849. $paramStr = '';
    15850. -
    15851. $paramArrayStr = '';
    15852. -
    15853. $paramCommentStr = 'void';
    15854. -
    15855. }
    15856. -
    15857. $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
    15858. -
    15859. $evalStr .= "// $paramCommentStr
    15860. -
    15861. function " . str_replace('.', '__', $operation) . "($paramStr) {
    15862. -
    15863. \$params = array($paramArrayStr);
    15864. -
    15865. return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."');
    15866. -
    15867. }
    15868. -
    15869. ";
    15870. -
    15871. unset($paramStr);
    15872. -
    15873. unset($paramCommentStr);
    15874. -
    15875. }
    15876. -
    15877. }
    15878. -
    15879. $evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client {
    15880. -
    15881. '.$evalStr.'
    15882. -
    15883. }';
    15884. -
    15885. return $evalStr;
    15886. -
    15887. }
    15888. -
    15889.  
    15890. -
    15891. /**
    15892. -
    15893. * dynamically creates proxy class code
    15894. -
    15895. *
    15896. -
    15897. * @return string PHP/NuSOAP code for the proxy class
    15898. -
    15899. * @access public
    15900. -
    15901. */
    15902. -
    15903. function getProxyClassCode() {
    15904. -
    15905. $r = rand();
    15906. -
    15907. return $this->_getProxyClassCode($r);
    15908. -
    15909. }
    15910. -
    15911.  
    15912. -
    15913. /**
    15914. -
    15915. * gets the HTTP body for the current request.
    15916. -
    15917. *
    15918. -
    15919. * @param string $soapmsg The SOAP payload
    15920. -
    15921. * @return string The HTTP body, which includes the SOAP payload
    15922. -
    15923. * @access private
    15924. -
    15925. */
    15926. -
    15927. function getHTTPBody($soapmsg) {
    15928. -
    15929. return $soapmsg;
    15930. -
    15931. }
    15932. -
    15933. -
    15934. /**
    15935. -
    15936. * gets the HTTP content type for the current request.
    15937. -
    15938. *
    15939. -
    15940. * Note: getHTTPBody must be called before this.
    15941. -
    15942. *
    15943. -
    15944. * @return string the HTTP content type for the current request.
    15945. -
    15946. * @access private
    15947. -
    15948. */
    15949. -
    15950. function getHTTPContentType() {
    15951. -
    15952. return 'text/xml';
    15953. -
    15954. }
    15955. -
    15956. -
    15957. /**
    15958. -
    15959. * gets the HTTP content type charset for the current request.
    15960. -
    15961. * returns false for non-text content types.
    15962. -
    15963. *
    15964. -
    15965. * Note: getHTTPBody must be called before this.
    15966. -
    15967. *
    15968. -
    15969. * @return string the HTTP content type charset for the current request.
    15970. -
    15971. * @access private
    15972. -
    15973. */
    15974. -
    15975. function getHTTPContentTypeCharset() {
    15976. -
    15977. return $this->soap_defencoding;
    15978. -
    15979. }
    15980. -
    15981.  
    15982. -
    15983. /*
    15984. -
    15985. * whether or not parser should decode utf8 element content
    15986. -
    15987. *
    15988. -
    15989. * @return always returns true
    15990. -
    15991. * @access public
    15992. -
    15993. */
    15994. -
    15995. function decodeUTF8($bool){
    15996. -
    15997. $this->decode_utf8 = $bool;
    15998. -
    15999. return true;
    16000. -
    16001. }
    16002. -
    16003.  
    16004. -
    16005. /**
    16006. -
    16007. * adds a new Cookie into $this->cookies array
    16008. -
    16009. *
    16010. -
    16011. * @param string $name Cookie Name
    16012. -
    16013. * @param string $value Cookie Value
    16014. -
    16015. * @return boolean if cookie-set was successful returns true, else false
    16016. -
    16017. * @access public
    16018. -
    16019. */
    16020. -
    16021. function setCookie($name, $value) {
    16022. -
    16023. if (strlen($name) == 0) {
    16024. -
    16025. return false;
    16026. -
    16027. }
    16028. -
    16029. $this->cookies[] = array('name' => $name, 'value' => $value);
    16030. -
    16031. return true;
    16032. -
    16033. }
    16034. -
    16035.  
    16036. -
    16037. /**
    16038. -
    16039. * gets all Cookies
    16040. -
    16041. *
    16042. -
    16043. * @return array with all internal cookies
    16044. -
    16045. * @access public
    16046. -
    16047. */
    16048. -
    16049. function getCookies() {
    16050. -
    16051. return $this->cookies;
    16052. -
    16053. }
    16054. -
    16055.  
    16056. -
    16057. /**
    16058. -
    16059. * checks all Cookies and delete those which are expired
    16060. -
    16061. *
    16062. -
    16063. * @return boolean always return true
    16064. -
    16065. * @access private
    16066. -
    16067. */
    16068. -
    16069. function checkCookies() {
    16070. -
    16071. if (sizeof($this->cookies) == 0) {
    16072. -
    16073. return true;
    16074. -
    16075. }
    16076. -
    16077. $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
    16078. -
    16079. $curr_cookies = $this->cookies;
    16080. -
    16081. $this->cookies = array();
    16082. -
    16083. foreach ($curr_cookies as $cookie) {
    16084. -
    16085. if (! is_array($cookie)) {
    16086. -
    16087. $this->debug('Remove cookie that is not an array');
    16088. -
    16089. continue;
    16090. -
    16091. }
    16092. -
    16093. if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
    16094. -
    16095. if (strtotime($cookie['expires']) > time()) {
    16096. -
    16097. $this->cookies[] = $cookie;
    16098. -
    16099. } else {
    16100. -
    16101. $this->debug('Remove expired cookie ' . $cookie['name']);
    16102. -
    16103. }
    16104. -
    16105. } else {
    16106. -
    16107. $this->cookies[] = $cookie;
    16108. -
    16109. }
    16110. -
    16111. }
    16112. -
    16113. $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array');
    16114. -
    16115. return true;
    16116. -
    16117. }
    16118. -
    16119.  
    16120. -
    16121. /**
    16122. -
    16123. * updates the current cookies with a new set
    16124. -
    16125. *
    16126. -
    16127. * @param array $cookies new cookies with which to update current ones
    16128. -
    16129. * @return boolean always return true
    16130. -
    16131. * @access private
    16132. -
    16133. */
    16134. -
    16135. function UpdateCookies($cookies) {
    16136. -
    16137. if (sizeof($this->cookies) == 0) {
    16138. -
    16139. // no existing cookies: take whatever is new
    16140. -
    16141. if (sizeof($cookies) > 0) {
    16142. -
    16143. $this->debug('Setting new cookie(s)');
    16144. -
    16145. $this->cookies = $cookies;
    16146. -
    16147. }
    16148. -
    16149. return true;
    16150. -
    16151. }
    16152. -
    16153. if (sizeof($cookies) == 0) {
    16154. -
    16155. // no new cookies: keep what we've got
    16156. -
    16157. return true;
    16158. -
    16159. }
    16160. -
    16161. // merge
    16162. -
    16163. foreach ($cookies as $newCookie) {
    16164. -
    16165. if (!is_array($newCookie)) {
    16166. -
    16167. continue;
    16168. -
    16169. }
    16170. -
    16171. if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
    16172. -
    16173. continue;
    16174. -
    16175. }
    16176. -
    16177. $newName = $newCookie['name'];
    16178. -
    16179.  
    16180. -
    16181. $found = false;
    16182. -
    16183. for ($i = 0; $i < count($this->cookies); $i++) {
    16184. -
    16185. $cookie = $this->cookies[$i];
    16186. -
    16187. if (!is_array($cookie)) {
    16188. -
    16189. continue;
    16190. -
    16191. }
    16192. -
    16193. if (!isset($cookie['name'])) {
    16194. -
    16195. continue;
    16196. -
    16197. }
    16198. -
    16199. if ($newName != $cookie['name']) {
    16200. -
    16201. continue;
    16202. -
    16203. }
    16204. -
    16205. $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
    16206. -
    16207. $domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
    16208. -
    16209. if ($newDomain != $domain) {
    16210. -
    16211. continue;
    16212. -
    16213. }
    16214. -
    16215. $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
    16216. -
    16217. $path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
    16218. -
    16219. if ($newPath != $path) {
    16220. -
    16221. continue;
    16222. -
    16223. }
    16224. -
    16225. $this->cookies[$i] = $newCookie;
    16226. -
    16227. $found = true;
    16228. -
    16229. $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
    16230. -
    16231. break;
    16232. -
    16233. }
    16234. -
    16235. if (! $found) {
    16236. -
    16237. $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
    16238. -
    16239. $this->cookies[] = $newCookie;
    16240. -
    16241. }
    16242. -
    16243. }
    16244. -
    16245. return true;
    16246. -
    16247. }
    16248. -
    16249. }
    16250. -
    16251.  
    16252. -
    16253. if (!extension_loaded('soap')) {
    16254. -
    16255. /**
    16256. -
    16257. * For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded.
    16258. -
    16259. */
    16260. -
    16261. class soapclient extends nusoap_client {
    16262. -
    16263. }
    16264. -
    16265. }
    16266. -
    16267. ?>
    16268. -
    -
    -

    - Documentation generated on Mon, 26 Apr 2010 16:17:01 -0400 by phpDocumentor 1.3.0RC3 -

    - - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/__filesource/fsource_nusoap__nusoapmime.php.html b/lib/nusoap/docs/docs/__filesource/fsource_nusoap__nusoapmime.php.html deleted file mode 100644 index bb3729a13..000000000 --- a/lib/nusoap/docs/docs/__filesource/fsource_nusoap__nusoapmime.php.html +++ /dev/null @@ -1,521 +0,0 @@ - - - - - - File Source for nusoapmime.php - - - - -

    Source for file nusoapmime.php

    -

    Documentation is available at nusoapmime.php

    -
    -
    1. <?php
    2. -
    3. /*
    4. -
    5. $Id: fsource_nusoap__nusoapmime.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    6. -
    7.  
    8. -
    9. NuSOAP - Web Services Toolkit for PHP
    10. -
    11.  
    12. -
    13. Copyright (c) 2002 NuSphere Corporation
    14. -
    15.  
    16. -
    17. This library is free software; you can redistribute it and/or
    18. -
    19. modify it under the terms of the GNU Lesser General Public
    20. -
    21. License as published by the Free Software Foundation; either
    22. -
    23. version 2.1 of the License, or (at your option) any later version.
    24. -
    25.  
    26. -
    27. This library is distributed in the hope that it will be useful,
    28. -
    29. but WITHOUT ANY WARRANTY; without even the implied warranty of
    30. -
    31. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    32. -
    33. Lesser General Public License for more details.
    34. -
    35.  
    36. -
    37. You should have received a copy of the GNU Lesser General Public
    38. -
    39. License along with this library; if not, write to the Free Software
    40. -
    41. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    42. -
    43.  
    44. -
    45. The NuSOAP project home is:
    46. -
    47. http://sourceforge.net/projects/nusoap/
    48. -
    49.  
    50. -
    51. The primary support for NuSOAP is the mailing list:
    52. -
    53. nusoap-general@lists.sourceforge.net
    54. -
    55.  
    56. -
    57. If you have any questions or comments, please email:
    58. -
    59.  
    60. -
    61. Dietrich Ayala
    62. -
    63. dietrich@ganx4.com
    64. -
    65. http://dietrich.ganx4.com/nusoap
    66. -
    67.  
    68. -
    69. NuSphere Corporation
    70. -
    71. http://www.nusphere.com
    72. -
    73.  
    74. -
    75. */
    76. -
    77.  
    78. -
    79. /*require_once('nusoap.php');*/
    80. -
    81. /* PEAR Mail_MIME library */
    82. -
    83. require_once('Mail/mimeDecode.php');
    84. -
    85. require_once('Mail/mimePart.php');
    86. -
    87.  
    88. -
    89. /**
    90. -
    91. * nusoap_client_mime client supporting MIME attachments defined at
    92. -
    93. * http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    94. -
    95. *
    96. -
    97. * @author Scott Nichol <snichol@users.sourceforge.net>
    98. -
    99. * @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
    100. -
    101. * @version $Id: fsource_nusoap__nusoapmime.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    102. -
    103. * @access public
    104. -
    105. */
    106. -
    107. class nusoap_client_mime extends nusoap_client {
    108. -
    109. /**
    110. -
    111. * @var array Each array element in the return is an associative array with keys
    112. -
    113. * data, filename, contenttype, cid
    114. -
    115. * @access private
    116. -
    117. */
    118. -
    119. var $requestAttachments = array();
    120. -
    121. /**
    122. -
    123. * @var array Each array element in the return is an associative array with keys
    124. -
    125. * data, filename, contenttype, cid
    126. -
    127. * @access private
    128. -
    129. */
    130. -
    131. var $responseAttachments;
    132. -
    133. /**
    134. -
    135. * @var string
    136. -
    137. * @access private
    138. -
    139. */
    140. -
    141. var $mimeContentType;
    142. -
    143. -
    144. /**
    145. -
    146. * adds a MIME attachment to the current request.
    147. -
    148. *
    149. -
    150. * If the $data parameter contains an empty string, this method will read
    151. -
    152. * the contents of the file named by the $filename parameter.
    153. -
    154. *
    155. -
    156. * If the $cid parameter is false, this method will generate the cid.
    157. -
    158. *
    159. -
    160. * @param string $data The data of the attachment
    161. -
    162. * @param string $filename The filename of the attachment (default is empty string)
    163. -
    164. * @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
    165. -
    166. * @param string $cid The content-id (cid) of the attachment (default is false)
    167. -
    168. * @return string The content-id (cid) of the attachment
    169. -
    170. * @access public
    171. -
    172. */
    173. -
    174. function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
    175. -
    176. if (! $cid) {
    177. -
    178. $cid = md5(uniqid(time()));
    179. -
    180. }
    181. -
    182.  
    183. -
    184. $info['data'] = $data;
    185. -
    186. $info['filename'] = $filename;
    187. -
    188. $info['contenttype'] = $contenttype;
    189. -
    190. $info['cid'] = $cid;
    191. -
    192. -
    193. $this->requestAttachments[] = $info;
    194. -
    195.  
    196. -
    197. return $cid;
    198. -
    199. }
    200. -
    201.  
    202. -
    203. /**
    204. -
    205. * clears the MIME attachments for the current request.
    206. -
    207. *
    208. -
    209. * @access public
    210. -
    211. */
    212. -
    213. function clearAttachments() {
    214. -
    215. $this->requestAttachments = array();
    216. -
    217. }
    218. -
    219.  
    220. -
    221. /**
    222. -
    223. * gets the MIME attachments from the current response.
    224. -
    225. *
    226. -
    227. * Each array element in the return is an associative array with keys
    228. -
    229. * data, filename, contenttype, cid. These keys correspond to the parameters
    230. -
    231. * for addAttachment.
    232. -
    233. *
    234. -
    235. * @return array The attachments.
    236. -
    237. * @access public
    238. -
    239. */
    240. -
    241. function getAttachments() {
    242. -
    243. return $this->responseAttachments;
    244. -
    245. }
    246. -
    247.  
    248. -
    249. /**
    250. -
    251. * gets the HTTP body for the current request.
    252. -
    253. *
    254. -
    255. * @param string $soapmsg The SOAP payload
    256. -
    257. * @return string The HTTP body, which includes the SOAP payload
    258. -
    259. * @access private
    260. -
    261. */
    262. -
    263. function getHTTPBody($soapmsg) {
    264. -
    265. if (count($this->requestAttachments) > 0) {
    266. -
    267. $params['content_type'] = 'multipart/related; type="text/xml"';
    268. -
    269. $mimeMessage = new Mail_mimePart('', $params);
    270. -
    271. unset($params);
    272. -
    273.  
    274. -
    275. $params['content_type'] = 'text/xml';
    276. -
    277. $params['encoding'] = '8bit';
    278. -
    279. $params['charset'] = $this->soap_defencoding;
    280. -
    281. $mimeMessage->addSubpart($soapmsg, $params);
    282. -
    283. -
    284. foreach ($this->requestAttachments as $att) {
    285. -
    286. unset($params);
    287. -
    288.  
    289. -
    290. $params['content_type'] = $att['contenttype'];
    291. -
    292. $params['encoding'] = 'base64';
    293. -
    294. $params['disposition'] = 'attachment';
    295. -
    296. $params['dfilename'] = $att['filename'];
    297. -
    298. $params['cid'] = $att['cid'];
    299. -
    300.  
    301. -
    302. if ($att['data'] == '' && $att['filename'] <> '') {
    303. -
    304. if ($fd = fopen($att['filename'], 'rb')) {
    305. -
    306. $data = fread($fd, filesize($att['filename']));
    307. -
    308. fclose($fd);
    309. -
    310. } else {
    311. -
    312. $data = '';
    313. -
    314. }
    315. -
    316. $mimeMessage->addSubpart($data, $params);
    317. -
    318. } else {
    319. -
    320. $mimeMessage->addSubpart($att['data'], $params);
    321. -
    322. }
    323. -
    324. }
    325. -
    326.  
    327. -
    328. $output = $mimeMessage->encode();
    329. -
    330. $mimeHeaders = $output['headers'];
    331. -
    332. -
    333. foreach ($mimeHeaders as $k => $v) {
    334. -
    335. $this->debug("MIME header $k: $v");
    336. -
    337. if (strtolower($k) == 'content-type') {
    338. -
    339. // PHP header() seems to strip leading whitespace starting
    340. -
    341. // the second line, so force everything to one line
    342. -
    343. $this->mimeContentType = str_replace("\r\n", " ", $v);
    344. -
    345. }
    346. -
    347. }
    348. -
    349. -
    350. return $output['body'];
    351. -
    352. }
    353. -
    354.  
    355. -
    356. return parent::getHTTPBody($soapmsg);
    357. -
    358. }
    359. -
    360. -
    361. /**
    362. -
    363. * gets the HTTP content type for the current request.
    364. -
    365. *
    366. -
    367. * Note: getHTTPBody must be called before this.
    368. -
    369. *
    370. -
    371. * @return string the HTTP content type for the current request.
    372. -
    373. * @access private
    374. -
    375. */
    376. -
    377. function getHTTPContentType() {
    378. -
    379. if (count($this->requestAttachments) > 0) {
    380. -
    381. return $this->mimeContentType;
    382. -
    383. }
    384. -
    385. return parent::getHTTPContentType();
    386. -
    387. }
    388. -
    389. -
    390. /**
    391. -
    392. * gets the HTTP content type charset for the current request.
    393. -
    394. * returns false for non-text content types.
    395. -
    396. *
    397. -
    398. * Note: getHTTPBody must be called before this.
    399. -
    400. *
    401. -
    402. * @return string the HTTP content type charset for the current request.
    403. -
    404. * @access private
    405. -
    406. */
    407. -
    408. function getHTTPContentTypeCharset() {
    409. -
    410. if (count($this->requestAttachments) > 0) {
    411. -
    412. return false;
    413. -
    414. }
    415. -
    416. return parent::getHTTPContentTypeCharset();
    417. -
    418. }
    419. -
    420.  
    421. -
    422. /**
    423. -
    424. * processes SOAP message returned from server
    425. -
    426. *
    427. -
    428. * @param array $headers The HTTP headers
    429. -
    430. * @param string $data unprocessed response data from server
    431. -
    432. * @return mixed value of the message, decoded into a PHP type
    433. -
    434. * @access private
    435. -
    436. */
    437. -
    438. function parseResponse($headers, $data) {
    439. -
    440. $this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
    441. -
    442. $this->responseAttachments = array();
    443. -
    444. if (strstr($headers['content-type'], 'multipart/related')) {
    445. -
    446. $this->debug('Decode multipart/related');
    447. -
    448. $input = '';
    449. -
    450. foreach ($headers as $k => $v) {
    451. -
    452. $input .= "$k: $v\r\n";
    453. -
    454. }
    455. -
    456. $params['input'] = $input . "\r\n" . $data;
    457. -
    458. $params['include_bodies'] = true;
    459. -
    460. $params['decode_bodies'] = true;
    461. -
    462. $params['decode_headers'] = true;
    463. -
    464. -
    465. $structure = Mail_mimeDecode::decode($params);
    466. -
    467.  
    468. -
    469. foreach ($structure->parts as $part) {
    470. -
    471. if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
    472. -
    473. $this->debug('Have root part of type ' . $part->headers['content-type']);
    474. -
    475. $root = $part->body;
    476. -
    477. $return = parent::parseResponse($part->headers, $part->body);
    478. -
    479. } else {
    480. -
    481. $this->debug('Have an attachment of type ' . $part->headers['content-type']);
    482. -
    483. $info['data'] = $part->body;
    484. -
    485. $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
    486. -
    487. $info['contenttype'] = $part->headers['content-type'];
    488. -
    489. $info['cid'] = $part->headers['content-id'];
    490. -
    491. $this->responseAttachments[] = $info;
    492. -
    493. }
    494. -
    495. }
    496. -
    497. -
    498. if (isset($return)) {
    499. -
    500. $this->responseData = $root;
    501. -
    502. return $return;
    503. -
    504. }
    505. -
    506. -
    507. $this->setError('No root part found in multipart/related content');
    508. -
    509. return '';
    510. -
    511. }
    512. -
    513. $this->debug('Not multipart/related');
    514. -
    515. return parent::parseResponse($headers, $data);
    516. -
    517. }
    518. -
    519. }
    520. -
    521.  
    522. -
    523. /*
    524. -
    525. * For backwards compatiblity, define soapclientmime unless the PHP SOAP extension is loaded.
    526. -
    527. */
    528. -
    529. if (!extension_loaded('soap')) {
    530. -
    531. class soapclientmime extends nusoap_client_mime {
    532. -
    533. }
    534. -
    535. }
    536. -
    537.  
    538. -
    539. /**
    540. -
    541. * nusoap_server_mime server supporting MIME attachments defined at
    542. -
    543. * http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    544. -
    545. *
    546. -
    547. * @author Scott Nichol <snichol@users.sourceforge.net>
    548. -
    549. * @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
    550. -
    551. * @version $Id: fsource_nusoap__nusoapmime.php.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    552. -
    553. * @access public
    554. -
    555. */
    556. -
    557. class nusoap_server_mime extends nusoap_server {
    558. -
    559. /**
    560. -
    561. * @var array Each array element in the return is an associative array with keys
    562. -
    563. * data, filename, contenttype, cid
    564. -
    565. * @access private
    566. -
    567. */
    568. -
    569. var $requestAttachments = array();
    570. -
    571. /**
    572. -
    573. * @var array Each array element in the return is an associative array with keys
    574. -
    575. * data, filename, contenttype, cid
    576. -
    577. * @access private
    578. -
    579. */
    580. -
    581. var $responseAttachments;
    582. -
    583. /**
    584. -
    585. * @var string
    586. -
    587. * @access private
    588. -
    589. */
    590. -
    591. var $mimeContentType;
    592. -
    593. -
    594. /**
    595. -
    596. * adds a MIME attachment to the current response.
    597. -
    598. *
    599. -
    600. * If the $data parameter contains an empty string, this method will read
    601. -
    602. * the contents of the file named by the $filename parameter.
    603. -
    604. *
    605. -
    606. * If the $cid parameter is false, this method will generate the cid.
    607. -
    608. *
    609. -
    610. * @param string $data The data of the attachment
    611. -
    612. * @param string $filename The filename of the attachment (default is empty string)
    613. -
    614. * @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
    615. -
    616. * @param string $cid The content-id (cid) of the attachment (default is false)
    617. -
    618. * @return string The content-id (cid) of the attachment
    619. -
    620. * @access public
    621. -
    622. */
    623. -
    624. function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
    625. -
    626. if (! $cid) {
    627. -
    628. $cid = md5(uniqid(time()));
    629. -
    630. }
    631. -
    632.  
    633. -
    634. $info['data'] = $data;
    635. -
    636. $info['filename'] = $filename;
    637. -
    638. $info['contenttype'] = $contenttype;
    639. -
    640. $info['cid'] = $cid;
    641. -
    642. -
    643. $this->responseAttachments[] = $info;
    644. -
    645.  
    646. -
    647. return $cid;
    648. -
    649. }
    650. -
    651.  
    652. -
    653. /**
    654. -
    655. * clears the MIME attachments for the current response.
    656. -
    657. *
    658. -
    659. * @access public
    660. -
    661. */
    662. -
    663. function clearAttachments() {
    664. -
    665. $this->responseAttachments = array();
    666. -
    667. }
    668. -
    669.  
    670. -
    671. /**
    672. -
    673. * gets the MIME attachments from the current request.
    674. -
    675. *
    676. -
    677. * Each array element in the return is an associative array with keys
    678. -
    679. * data, filename, contenttype, cid. These keys correspond to the parameters
    680. -
    681. * for addAttachment.
    682. -
    683. *
    684. -
    685. * @return array The attachments.
    686. -
    687. * @access public
    688. -
    689. */
    690. -
    691. function getAttachments() {
    692. -
    693. return $this->requestAttachments;
    694. -
    695. }
    696. -
    697.  
    698. -
    699. /**
    700. -
    701. * gets the HTTP body for the current response.
    702. -
    703. *
    704. -
    705. * @param string $soapmsg The SOAP payload
    706. -
    707. * @return string The HTTP body, which includes the SOAP payload
    708. -
    709. * @access private
    710. -
    711. */
    712. -
    713. function getHTTPBody($soapmsg) {
    714. -
    715. if (count($this->responseAttachments) > 0) {
    716. -
    717. $params['content_type'] = 'multipart/related; type="text/xml"';
    718. -
    719. $mimeMessage = new Mail_mimePart('', $params);
    720. -
    721. unset($params);
    722. -
    723.  
    724. -
    725. $params['content_type'] = 'text/xml';
    726. -
    727. $params['encoding'] = '8bit';
    728. -
    729. $params['charset'] = $this->soap_defencoding;
    730. -
    731. $mimeMessage->addSubpart($soapmsg, $params);
    732. -
    733. -
    734. foreach ($this->responseAttachments as $att) {
    735. -
    736. unset($params);
    737. -
    738.  
    739. -
    740. $params['content_type'] = $att['contenttype'];
    741. -
    742. $params['encoding'] = 'base64';
    743. -
    744. $params['disposition'] = 'attachment';
    745. -
    746. $params['dfilename'] = $att['filename'];
    747. -
    748. $params['cid'] = $att['cid'];
    749. -
    750.  
    751. -
    752. if ($att['data'] == '' && $att['filename'] <> '') {
    753. -
    754. if ($fd = fopen($att['filename'], 'rb')) {
    755. -
    756. $data = fread($fd, filesize($att['filename']));
    757. -
    758. fclose($fd);
    759. -
    760. } else {
    761. -
    762. $data = '';
    763. -
    764. }
    765. -
    766. $mimeMessage->addSubpart($data, $params);
    767. -
    768. } else {
    769. -
    770. $mimeMessage->addSubpart($att['data'], $params);
    771. -
    772. }
    773. -
    774. }
    775. -
    776.  
    777. -
    778. $output = $mimeMessage->encode();
    779. -
    780. $mimeHeaders = $output['headers'];
    781. -
    782. -
    783. foreach ($mimeHeaders as $k => $v) {
    784. -
    785. $this->debug("MIME header $k: $v");
    786. -
    787. if (strtolower($k) == 'content-type') {
    788. -
    789. // PHP header() seems to strip leading whitespace starting
    790. -
    791. // the second line, so force everything to one line
    792. -
    793. $this->mimeContentType = str_replace("\r\n", " ", $v);
    794. -
    795. }
    796. -
    797. }
    798. -
    799. -
    800. return $output['body'];
    801. -
    802. }
    803. -
    804.  
    805. -
    806. return parent::getHTTPBody($soapmsg);
    807. -
    808. }
    809. -
    810. -
    811. /**
    812. -
    813. * gets the HTTP content type for the current response.
    814. -
    815. *
    816. -
    817. * Note: getHTTPBody must be called before this.
    818. -
    819. *
    820. -
    821. * @return string the HTTP content type for the current response.
    822. -
    823. * @access private
    824. -
    825. */
    826. -
    827. function getHTTPContentType() {
    828. -
    829. if (count($this->responseAttachments) > 0) {
    830. -
    831. return $this->mimeContentType;
    832. -
    833. }
    834. -
    835. return parent::getHTTPContentType();
    836. -
    837. }
    838. -
    839. -
    840. /**
    841. -
    842. * gets the HTTP content type charset for the current response.
    843. -
    844. * returns false for non-text content types.
    845. -
    846. *
    847. -
    848. * Note: getHTTPBody must be called before this.
    849. -
    850. *
    851. -
    852. * @return string the HTTP content type charset for the current response.
    853. -
    854. * @access private
    855. -
    856. */
    857. -
    858. function getHTTPContentTypeCharset() {
    859. -
    860. if (count($this->responseAttachments) > 0) {
    861. -
    862. return false;
    863. -
    864. }
    865. -
    866. return parent::getHTTPContentTypeCharset();
    867. -
    868. }
    869. -
    870.  
    871. -
    872. /**
    873. -
    874. * processes SOAP message received from client
    875. -
    876. *
    877. -
    878. * @param array $headers The HTTP headers
    879. -
    880. * @param string $data unprocessed request data from client
    881. -
    882. * @return mixed value of the message, decoded into a PHP type
    883. -
    884. * @access private
    885. -
    886. */
    887. -
    888. function parseRequest($headers, $data) {
    889. -
    890. $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
    891. -
    892. $this->requestAttachments = array();
    893. -
    894. if (strstr($headers['content-type'], 'multipart/related')) {
    895. -
    896. $this->debug('Decode multipart/related');
    897. -
    898. $input = '';
    899. -
    900. foreach ($headers as $k => $v) {
    901. -
    902. $input .= "$k: $v\r\n";
    903. -
    904. }
    905. -
    906. $params['input'] = $input . "\r\n" . $data;
    907. -
    908. $params['include_bodies'] = true;
    909. -
    910. $params['decode_bodies'] = true;
    911. -
    912. $params['decode_headers'] = true;
    913. -
    914. -
    915. $structure = Mail_mimeDecode::decode($params);
    916. -
    917.  
    918. -
    919. foreach ($structure->parts as $part) {
    920. -
    921. if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
    922. -
    923. $this->debug('Have root part of type ' . $part->headers['content-type']);
    924. -
    925. $return = parent::parseRequest($part->headers, $part->body);
    926. -
    927. } else {
    928. -
    929. $this->debug('Have an attachment of type ' . $part->headers['content-type']);
    930. -
    931. $info['data'] = $part->body;
    932. -
    933. $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
    934. -
    935. $info['contenttype'] = $part->headers['content-type'];
    936. -
    937. $info['cid'] = $part->headers['content-id'];
    938. -
    939. $this->requestAttachments[] = $info;
    940. -
    941. }
    942. -
    943. }
    944. -
    945. -
    946. if (isset($return)) {
    947. -
    948. return $return;
    949. -
    950. }
    951. -
    952. -
    953. $this->setError('No root part found in multipart/related content');
    954. -
    955. return;
    956. -
    957. }
    958. -
    959. $this->debug('Not multipart/related');
    960. -
    961. return parent::parseRequest($headers, $data);
    962. -
    963. }
    964. -
    965. }
    966. -
    967.  
    968. -
    969. /*
    970. -
    971. * For backwards compatiblity
    972. -
    973. */
    974. -
    975. class nusoapservermime extends nusoap_server_mime {
    976. -
    977. }
    978. -
    979.  
    980. -
    981. ?>
    982. -
    -
    -

    - Documentation generated on Mon, 26 Apr 2010 16:17:09 -0400 by phpDocumentor 1.3.0RC3 -

    - - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/blank.html b/lib/nusoap/docs/docs/blank.html deleted file mode 100644 index d33898fc4..000000000 --- a/lib/nusoap/docs/docs/blank.html +++ /dev/null @@ -1,13 +0,0 @@ - - - phpDocumentor 1.3.0 Manual - - - - -

    phpDocumentor 1.3.0 Manual

    -Welcome to nusoap!
    -
    -This documentation was generated by phpDocumentor v1.3.0RC3
    - - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/classtrees_nusoap.html b/lib/nusoap/docs/docs/classtrees_nusoap.html deleted file mode 100644 index 34def4a56..000000000 --- a/lib/nusoap/docs/docs/classtrees_nusoap.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - -

    - -

    -

    Root class nusoap_base

    - - -

    Root class nusoap_wsdlcache

    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:16:48 -0400 by phpDocumentor 1.3.0RC3 -

    - - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/elementindex.html b/lib/nusoap/docs/docs/elementindex.html deleted file mode 100644 index 2b9eca66c..000000000 --- a/lib/nusoap/docs/docs/elementindex.html +++ /dev/null @@ -1,3290 +0,0 @@ - - - - - - - - - - - -

    Full index

    -

    Package indexes

    - -
    -
    - a - b - c - d - e - f - g - h - i - l - m - n - o - p - r - s - t - u - v - w - x - _ -
    - - -
    -
    a
    - -
    -
    -
    -
    - Variable - $attributes -
    -
    - -
    -
    - Variable - $attributes -
    -
    -
    soapval::$attributes in nusoap.php
    -
    The XML element attributes (array or false)
    -
    -
    - Variable - $authtype -
    -
    -
    wsdl::$authtype in nusoap.php
    -
    -
    - Variable - $authtype -
    -
    - -
    -
    - Variable - $authtype -
    -
    - -
    -
    - Method - addAttachment -
    -
    - -
    adds a MIME attachment to the current request.
    -
    -
    - Method - addAttachment -
    -
    - -
    adds a MIME attachment to the current response.
    -
    -
    - Method - addComplexType -
    -
    - -
    adds a complex type to the schema
    -
    -
    - Method - addComplexType -
    -
    - -
    adds an XML Schema complex type to the WSDL types
    -
    -
    - Method - addElement -
    -
    - -
    adds an element to the schema
    -
    -
    - Method - addElement -
    -
    -
    wsdl::addElement() in nusoap.php
    -
    adds an element to the WSDL types
    -
    -
    - Method - addOperation -
    -
    -
    wsdl::addOperation() in nusoap.php
    -
    register an operation with the server
    -
    -
    - Method - addSimpleType -
    -
    - -
    adds a simple type to the schema
    -
    -
    - Method - addSimpleType -
    -
    -
    wsdl::addSimpleType() in nusoap.php
    -
    adds an XML Schema simple type to the WSDL types
    -
    -
    - Method - add_to_map -
    -
    - -
    add a method to the dispatch map (this has been replaced by the register method)
    -
    -
    - Method - appendDebug -
    -
    - -
    adds debug data to the instance debug string without formatting
    -
    -
    - -
    -
    b
    - -
    -
    -
    -
    - Variable - $bindings -
    -
    -
    wsdl::$bindings in nusoap.php
    -
    -
    - Variable - $bindingType -
    -
    - -
    -
    - Variable - $body_position -
    -
    - -
    -
    - Method - buildPayload -
    -
    - -
    Writes the payload, including HTTP headers, to $this->outgoing_payload.
    -
    -
    - Method - buildVal -
    -
    - -
    builds response structures for compound values (arrays/structs) and scalars
    -
    -
    - -
    -
    c
    - -
    -
    -
    -
    - Variable - $cache_dir -
    -
    -
    nusoap_wsdlcache::$cache_dir in class.wsdlcache.php
    -
    -
    - Variable - $cache_lifetime -
    -
    -
    nusoap_wsdlcache::$cache_lifetime in class.wsdlcache.php
    -
    -
    - Variable - $certRequest -
    -
    - -
    -
    - Variable - $certRequest -
    -
    -
    wsdl::$certRequest in nusoap.php
    -
    -
    - Variable - $certRequest -
    -
    - -
    -
    - Variable - $ch -
    -
    - -
    -
    - Variable - $charencoding -
    -
    - -
    toggles automatic encoding of special characters as entities (should always be true, I think)
    -
    -
    - Variable - $ch_options -
    -
    - -
    -
    - Variable - $complexTypes -
    -
    - -
    -
    - Variable - $complexTypes -
    -
    -
    wsdl::$complexTypes in nusoap.php
    -
    -
    - Variable - $complexTypeStack -
    -
    - -
    -
    - Variable - $cookies -
    -
    - -
    -
    - Variable - $curl_options -
    -
    -
    wsdl::$curl_options in nusoap.php
    -
    -
    - Variable - $curl_options -
    -
    - -
    -
    - Variable - $currentBinding -
    -
    -
    wsdl::$currentBinding in nusoap.php
    -
    -
    - Variable - $currentComplexType -
    -
    - -
    -
    - Variable - $currentElement -
    -
    - -
    -
    - Variable - $currentMessage -
    -
    -
    wsdl::$currentMessage in nusoap.php
    -
    -
    - Variable - $currentOperation -
    -
    - -
    -
    - Variable - $currentPort -
    -
    -
    wsdl::$currentPort in nusoap.php
    -
    -
    - Variable - $currentPortType -
    -
    - -
    -
    - Variable - $currentSchema -
    -
    -
    wsdl::$currentSchema in nusoap.php
    -
    -
    - Variable - $currentSimpleType -
    -
    - -
    -
    - Method - call -
    -
    -
    nusoap_client::call() in nusoap.php
    -
    calls method, returns PHP native type
    -
    -
    - Method - character_data -
    -
    - -
    element content handler
    -
    -
    - Method - character_data -
    -
    - -
    element content handler
    -
    -
    - Method - checkCookies -
    -
    - -
    checks all Cookies and delete those which are expired
    -
    -
    - Method - checkWSDL -
    -
    - -
    check WSDL passed as an instance or pulled from an endpoint
    -
    -
    - Page - class.wsdlcache.php -
    -
    -
    class.wsdlcache.php in class.wsdlcache.php
    -
    -
    - Method - clearAttachments -
    -
    - -
    clears the MIME attachments for the current response.
    -
    -
    - Method - clearAttachments -
    -
    - -
    clears the MIME attachments for the current request.
    -
    -
    - Method - clearDebug -
    -
    - -
    clears the current debug data for this instance
    -
    -
    - Method - configureWSDL -
    -
    - -
    Sets up wsdl object.
    -
    -
    - Method - connect -
    -
    - -
    establish an HTTP connection
    -
    -
    - Method - contractQname -
    -
    - -
    contracts (changes namespace to prefix) a qualified name
    -
    -
    - Method - createFilename -
    -
    -
    nusoap_wsdlcache::createFilename() in class.wsdlcache.php
    -
    creates the filename used to cache a wsdl instance
    -
    -
    - Method - CreateTypeName -
    -
    - -
    gets a type name for an unnamed type
    -
    -
    - -
    -
    d
    - -
    -
    -
    -
    - Variable - $debugLevel -
    -
    - -
    the debug level for this instance
    -
    -
    - Variable - $debug_flag -
    -
    - -
    whether to append debug to response as XML comment
    -
    -
    - Variable - $debug_flag -
    -
    - -
    -
    - Variable - $debug_str -
    -
    - -
    Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
    -
    -
    - Variable - $debug_str -
    -
    -
    nusoap_wsdlcache::$debug_str in class.wsdlcache.php
    -
    -
    - Variable - $decode_utf8 -
    -
    - -
    toggles whether the parser decodes element content w/ utf8_decode()
    -
    -
    - Variable - $decode_utf8 -
    -
    - -
    -
    - Variable - $decode_utf8 -
    -
    - -
    -
    - Variable - $defaultNamespace -
    -
    - -
    -
    - Variable - $defaultRpcParams -
    -
    - -
    -
    - Variable - $default_namespace -
    -
    - -
    -
    - Variable - $depth -
    -
    -
    wsdl::$depth in nusoap.php
    -
    -
    - Variable - $depth -
    -
    - -
    -
    - Variable - $depth -
    -
    -
    nusoap_parser::$depth in nusoap.php
    -
    -
    - Variable - $depth_array -
    -
    - -
    -
    - Variable - $depth_array -
    -
    -
    wsdl::$depth_array in nusoap.php
    -
    -
    - Variable - $depth_array -
    -
    - -
    -
    - Variable - $digestRequest -
    -
    - -
    -
    - Variable - $digest_uri -
    -
    - -
    -
    - Variable - $document -
    -
    - -
    -
    - Variable - $document -
    -
    - -
    SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text)
    -
    -
    - Variable - $document -
    -
    - -
    -
    - Variable - $documentation -
    -
    -
    wsdl::$documentation in nusoap.php
    -
    -
    - Method - debug -
    -
    -
    nusoap_base::debug() in nusoap.php
    -
    adds debug data to the instance debug string with formatting
    -
    -
    - Method - debug -
    -
    -
    nusoap_wsdlcache::debug() in class.wsdlcache.php
    -
    adds debug data to the class level debug string
    -
    -
    - Method - decode -
    -
    -
    soapval::decode() in nusoap.php
    -
    decodes a soapval object into a PHP native type
    -
    -
    - Method - decodeChunked -
    -
    - -
    decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6
    -
    -
    - Method - decodeSimple -
    -
    - -
    decodes simple types into PHP variables
    -
    -
    - Method - decodeUTF8 -
    -
    - -
    -
    - -
    -
    e
    - -
    -
    -
    -
    - Variable - $elements -
    -
    - -
    -
    - Variable - $elementStack -
    -
    - -
    -
    - Variable - $element_ns -
    -
    -
    soapval::$element_ns in nusoap.php
    -
    The XML element namespace (string or false)
    -
    -
    - Variable - $enclosingNamespaces -
    -
    - -
    -
    - Variable - $encoding -
    -
    - -
    -
    - Variable - $endpoint -
    -
    - -
    -
    - Variable - $endpoint -
    -
    -
    wsdl::$endpoint in nusoap.php
    -
    -
    - Variable - $endpointType -
    -
    - -
    -
    - Variable - $error_str -
    -
    - -
    Current error string (manipulated by getError/setError)
    -
    -
    - Variable - $externalWSDLURL -
    -
    - -
    URL for WSDL (if one)
    -
    -
    - Method - end_element -
    -
    -
    wsdl::end_element() in nusoap.php
    -
    end-element handler
    -
    -
    - Method - end_element -
    -
    - -
    end-element handler
    -
    -
    - Method - expandEntities -
    -
    - -
    expands entities, e.g. changes '<' to '&lt;'.
    -
    -
    - Method - expandQname -
    -
    - -
    expands (changes prefix to namespace) a qualified name
    -
    -
    - -
    -
    f
    - -
    -
    -
    -
    - Variable - $fault -
    -
    -
    nusoap_parser::$fault in nusoap.php
    -
    -
    - Variable - $fault -
    -
    -
    nusoap_client::$fault in nusoap.php
    -
    -
    - Variable - $fault -
    -
    -
    nusoap_server::$fault in nusoap.php
    -
    SOAP fault for response (or false)
    -
    -
    - Variable - $faultactor -
    -
    - -
    The fault actor
    -
    -
    - Variable - $faultcode -
    -
    - -
    The fault code (client|server)
    -
    -
    - Variable - $faultcode -
    -
    - -
    -
    - Variable - $faultdetail -
    -
    - -
    The fault detail, typically a string or array of string
    -
    -
    - Variable - $faultdetail -
    -
    - -
    -
    - Variable - $faultstring -
    -
    - -
    The fault string, a description of the fault
    -
    -
    - Variable - $faultstring -
    -
    - -
    -
    - Variable - $fault_code -
    -
    - -
    -
    - Variable - $fault_detail -
    -
    - -
    -
    - Variable - $fault_str -
    -
    - -
    -
    - Variable - $forceEndpoint -
    -
    - -
    -
    - Variable - $fplock -
    -
    -
    nusoap_wsdlcache::$fplock in class.wsdlcache.php
    -
    -
    - Method - fault -
    -
    - -
    Specify a fault to be returned to the client.
    -
    -
    - Method - fetchWSDL -
    -
    -
    wsdl::fetchWSDL() in nusoap.php
    -
    fetches the WSDL document and parses it
    -
    -
    - Method - formatDump -
    -
    - -
    formats a string to be inserted into an HTML stream
    -
    -
    - -
    -
    g
    - -
    -
    -
    -
    - Method - get -
    -
    -
    nusoap_wsdlcache::get() in class.wsdlcache.php
    -
    gets a wsdl instance from the cache
    -
    -
    - Method - getAttachments -
    -
    - -
    gets the MIME attachments from the current response.
    -
    -
    - Method - getAttachments -
    -
    - -
    gets the MIME attachments from the current request.
    -
    -
    - Method - getBindingData -
    -
    - -
    -
    - Method - getCookies -
    -
    - -
    gets all Cookies
    -
    -
    - Method - getCookiesForRequest -
    -
    - -
    sort out cookies for the current request
    -
    -
    - Method - getDebug -
    -
    - -
    gets the current debug data for this instance
    -
    -
    - Method - getDebugAsXMLComment -
    -
    - -
    gets the current debug data for this instance as an XML comment this may change the contents of the debug data
    -
    -
    - Method - getDebugLevel -
    -
    - -
    gets the debug level for this instance
    -
    -
    - Method - getDefaultRpcParams -
    -
    - -
    gets the default RPC parameter setting.
    -
    -
    - Method - getError -
    -
    - -
    returns error string if present
    -
    -
    - Method - getGlobalDebugLevel -
    -
    - -
    gets the global debug level, which applies to future instances
    -
    -
    - Method - getHeader -
    -
    - -
    get the SOAP response Header (parsed)
    -
    -
    - Method - getHeaders -
    -
    - -
    get the SOAP response headers (namespace resolution incomplete)
    -
    -
    - Method - getHeaders -
    -
    - -
    get the unparsed SOAP Header
    -
    -
    - Method - getHTTPBody -
    -
    - -
    gets the HTTP body for the current response.
    -
    -
    - Method - getHTTPBody -
    -
    - -
    gets the HTTP body for the current response.
    -
    -
    - Method - getHTTPBody -
    -
    - -
    gets the HTTP body for the current request.
    -
    -
    - Method - getHTTPBody -
    -
    - -
    gets the HTTP body for the current request.
    -
    -
    - Method - getHTTPContentType -
    -
    - -
    gets the HTTP content type for the current response.
    -
    -
    - Method - getHTTPContentType -
    -
    - -
    gets the HTTP content type for the current request.
    -
    -
    - Method - getHTTPContentType -
    -
    - -
    gets the HTTP content type for the current response.
    -
    -
    - Method - getHTTPContentType -
    -
    - -
    gets the HTTP content type for the current request.
    -
    -
    - Method - getHTTPContentTypeCharset -
    -
    - -
    gets the HTTP content type charset for the current request.
    -
    -
    - Method - getHTTPContentTypeCharset -
    -
    - -
    gets the HTTP content type charset for the current response.
    -
    -
    - Method - getHTTPContentTypeCharset -
    -
    - -
    gets the HTTP content type charset for the current request.
    -
    -
    - Method - getHTTPContentTypeCharset -
    -
    - -
    gets the HTTP content type charset for the current response.
    -
    -
    - Method - getLocalPart -
    -
    - -
    returns the local part of a prefixed string returns the original string, if not prefixed
    -
    -
    - Method - getmicrotime -
    -
    - -
    returns the time in ODBC canonical form with microseconds
    -
    -
    - Method - getNamespaceFromPrefix -
    -
    - -
    pass it a prefix, it returns a namespace
    -
    -
    - Method - getOperationData -
    -
    - -
    returns an associative array of data necessary for calling an operation
    -
    -
    - Method - getOperationData -
    -
    - -
    get available data pertaining to an operation
    -
    -
    - Method - getOperationDataForSoapAction -
    -
    - -
    returns an associative array of data necessary for calling an operation
    -
    -
    - Method - getOperations -
    -
    -
    wsdl::getOperations() in nusoap.php
    -
    returns an assoc array of operation names => operation data
    -
    -
    - Method - getPHPType -
    -
    - -
    get the PHP type of a user defined type in the schema
    -
    -
    - Method - getPrefix -
    -
    - -
    returns the prefix part of a prefixed string returns false, if not prefixed
    -
    -
    - Method - getPrefixFromNamespace -
    -
    - -
    returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace
    -
    -
    - Method - getProxy -
    -
    - -
    dynamically creates an instance of a proxy class, allowing user to directly call methods from wsdl
    -
    -
    - Method - getProxyClassCode -
    -
    - -
    dynamically creates proxy class code
    -
    -
    - Method - getResponse -
    -
    - -
    gets the SOAP response via HTTP[S]
    -
    -
    - Method - getTypeDef -
    -
    - -
    returns an associative array of information about a given type returns false if no type exists by the given name
    -
    -
    - Method - getTypeDef -
    -
    -
    wsdl::getTypeDef() in nusoap.php
    -
    returns an array of information about a given type returns false if no type exists by the given name
    -
    -
    - Method - get_response -
    -
    - -
    get the parsed message (SOAP Body)
    -
    -
    - Method - get_soapbody -
    -
    - -
    get the parsed SOAP Body (NULL if there was none)
    -
    -
    - Method - get_soapheader -
    -
    - -
    get the parsed SOAP Header (NULL if there was none)
    -
    -
    - -
    -
    h
    - -
    -
    -
    -
    - Variable - $headers -
    -
    - -
    HTTP headers of request
    -
    -
    - Variable - $host -
    -
    - -
    -
    - Variable - $http_encoding -
    -
    - -
    -
    - -
    -
    i
    - -
    -
    -
    -
    - Variable - $ids -
    -
    -
    nusoap_parser::$ids in nusoap.php
    -
    -
    - Variable - $import -
    -
    -
    wsdl::$import in nusoap.php
    -
    -
    - Variable - $imports -
    -
    - -
    -
    - Variable - $incoming_cookies -
    -
    - -
    -
    - Variable - $incoming_headers -
    -
    - -
    -
    - Variable - $incoming_payload -
    -
    - -
    -
    - Method - invoke_method -
    -
    - -
    invokes a PHP function for the requested SOAP method
    -
    -
    - Method - io_method -
    -
    - -
    gets the I/O method to use
    -
    -
    - Method - isArraySimpleOrStruct -
    -
    - -
    detect if array is a simple array or a struct (associative array)
    -
    -
    - Function - iso8601_to_timestamp -
    -
    - -
    convert ISO 8601 compliant date string to unix timestamp
    -
    -
    - Method - isSkippableCurlHeader -
    -
    - -
    Test if the given string starts with a header that is to be skipped.
    -
    -
    - -
    -
    l
    - -
    -
    -
    -
    - Method - loadWSDL -
    -
    - -
    instantiate wsdl object and parse wsdl file
    -
    -
    - -
    -
    m
    - -
    -
    -
    -
    - Variable - $message -
    -
    - -
    -
    - Variable - $message -
    -
    -
    wsdl::$message in nusoap.php
    -
    -
    - Variable - $message -
    -
    - -
    -
    - Variable - $messages -
    -
    -
    wsdl::$messages in nusoap.php
    -
    -
    - Variable - $method -
    -
    - -
    -
    - Variable - $methodname -
    -
    - -
    name of method requested
    -
    -
    - Variable - $methodparams -
    -
    - -
    method parameters from request
    -
    -
    - Variable - $methodreturn -
    -
    - -
    method return value to place in response
    -
    -
    - Variable - $methodreturnisliteralxml -
    -
    - -
    whether $methodreturn is a string of literal XML
    -
    -
    - Variable - $methodURI -
    -
    - -
    requested method namespace URI
    -
    -
    - Variable - $mimeContentType -
    -
    - -
    -
    - Variable - $mimeContentType -
    -
    - -
    -
    - Variable - $multirefs -
    -
    - -
    -
    - -
    -
    n
    - -
    -
    -
    -
    - Variable - $name -
    -
    -
    soapval::$name in nusoap.php
    -
    The XML element name
    -
    -
    - Variable - $namespaces -
    -
    - -
    -
    - Variable - $namespaces -
    -
    - -
    namespaces in an array of prefix => uri
    -
    -
    - Page - nusoapmime.php -
    -
    -
    nusoapmime.php in nusoapmime.php
    -
    -
    - Class - nusoapservermime -
    -
    -
    nusoapservermime in nusoapmime.php
    -
    nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    -
    -
    - Method - nusoap_base -
    -
    - -
    constructor
    -
    -
    - Class - nusoap_base -
    -
    -
    nusoap_base in nusoap.php
    -
    nusoap_base
    -
    -
    - Class - nusoap_client -
    -
    -
    nusoap_client in nusoap.php
    -
    [nu]soapclient higher level class for easy usage.
    -
    -
    - Method - nusoap_client -
    -
    - -
    constructor
    -
    -
    - Class - nusoap_client_mime -
    -
    -
    nusoap_client_mime in nusoapmime.php
    -
    nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    -
    -
    - Class - nusoap_fault -
    -
    -
    nusoap_fault in nusoap.php
    -
    Contains information for a SOAP fault.
    -
    -
    - Method - nusoap_fault -
    -
    - -
    constructor
    -
    -
    - Class - nusoap_parser -
    -
    -
    nusoap_parser in nusoap.php
    -
    nusoap_parser class parses SOAP XML messages into native PHP values
    -
    -
    - Method - nusoap_parser -
    -
    - -
    constructor that actually does the parsing
    -
    -
    - Page - nusoap.php -
    -
    -
    nusoap.php in nusoap.php
    -
    -
    - Method - nusoap_server -
    -
    - -
    constructor the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
    -
    -
    - Class - nusoap_server -
    -
    -
    nusoap_server in nusoap.php
    -
    nusoap_server allows the user to create a SOAP server that is capable of receiving messages and returning responses
    -
    -
    - Class - nusoap_server_mime -
    -
    -
    nusoap_server_mime in nusoapmime.php
    -
    nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    -
    -
    - Class - nusoap_wsdlcache -
    -
    -
    nusoap_wsdlcache in class.wsdlcache.php
    -
    caches instances of the wsdl class
    -
    -
    - Method - nusoap_wsdlcache -
    -
    - -
    constructor
    -
    -
    - Class - nusoap_xmlschema -
    -
    -
    nusoap_xmlschema in nusoap.php
    -
    parses an XML Schema, allows access to it's data, other utility methods.
    -
    -
    - Method - nusoap_xmlschema -
    -
    - -
    constructor
    -
    -
    - -
    -
    o
    - -
    -
    -
    -
    - Variable - $opData -
    -
    -
    wsdl::$opData in nusoap.php
    -
    -
    - Variable - $operations -
    -
    - -
    assoc array of operations => opData; operations are added by the register()
    -
    -
    - Variable - $operations -
    -
    - -
    -
    - Variable - $outgoing_headers -
    -
    - -
    -
    - Variable - $outgoing_headers -
    -
    - -
    HTTP headers of response
    -
    -
    - Variable - $outgoing_payload -
    -
    - -
    -
    - Method - obtainMutex -
    -
    -
    nusoap_wsdlcache::obtainMutex() in class.wsdlcache.php
    -
    obtains the local mutex
    -
    -
    - -
    -
    p
    - -
    -
    -
    -
    - Variable - $parent -
    -
    - -
    -
    - Variable - $parser -
    -
    -
    wsdl::$parser in nusoap.php
    -
    -
    - Variable - $parser -
    -
    - -
    -
    - Variable - $password -
    -
    -
    wsdl::$password in nusoap.php
    -
    -
    - Variable - $password -
    -
    - -
    -
    - Variable - $password -
    -
    - -
    -
    - Variable - $path -
    -
    - -
    -
    - Variable - $persistentConnection -
    -
    - -
    -
    - Variable - $persistentConnection -
    -
    - -
    -
    - Variable - $port -
    -
    - -
    -
    - Variable - $portName -
    -
    - -
    -
    - Variable - $ports -
    -
    -
    wsdl::$ports in nusoap.php
    -
    -
    - Variable - $portTypes -
    -
    -
    wsdl::$portTypes in nusoap.php
    -
    -
    - Variable - $position -
    -
    - -
    -
    - Variable - $position -
    -
    - -
    -
    - Variable - $position -
    -
    -
    wsdl::$position in nusoap.php
    -
    -
    - Variable - $protocol_version -
    -
    - -
    -
    - Variable - $proxy -
    -
    - -
    -
    - Variable - $proxyhost -
    -
    -
    wsdl::$proxyhost in nusoap.php
    -
    -
    - Variable - $proxyhost -
    -
    - -
    -
    - Variable - $proxypassword -
    -
    - -
    -
    - Variable - $proxypassword -
    -
    -
    wsdl::$proxypassword in nusoap.php
    -
    -
    - Variable - $proxyport -
    -
    -
    wsdl::$proxyport in nusoap.php
    -
    -
    - Variable - $proxyport -
    -
    - -
    -
    - Variable - $proxyusername -
    -
    - -
    -
    - Variable - $proxyusername -
    -
    -
    wsdl::$proxyusername in nusoap.php
    -
    -
    - Method - parametersMatchWrapped -
    -
    - -
    determine whether a set of parameters are unwrapped when they are expect to be wrapped, Microsoft-style.
    -
    -
    - Method - parseCookie -
    -
    - -
    parse an incoming Cookie into it's parts
    -
    -
    - Method - parseFile -
    -
    - -
    parse an XML file
    -
    -
    - Method - parseRequest -
    -
    - -
    processes SOAP message received from client
    -
    -
    - Method - parseRequest -
    -
    - -
    processes SOAP message received from client
    -
    -
    - Method - parseResponse -
    -
    - -
    processes SOAP message returned from server
    -
    -
    - Method - parseResponse -
    -
    - -
    processes SOAP message returned from server
    -
    -
    - Method - parseString -
    -
    - -
    parse an XML string
    -
    -
    - Method - parseWSDL -
    -
    -
    wsdl::parseWSDL() in nusoap.php
    -
    parses the wsdl document
    -
    -
    - Method - parse_http_headers -
    -
    - -
    parses HTTP request headers.
    -
    -
    - Method - parse_request -
    -
    - -
    parses a request
    -
    -
    - Method - put -
    -
    -
    nusoap_wsdlcache::put() in class.wsdlcache.php
    -
    adds a wsdl instance to the cache
    -
    -
    - -
    -
    r
    - -
    -
    -
    -
    - Variable - $request -
    -
    - -
    HTTP request
    -
    -
    - Variable - $request -
    -
    - -
    -
    - Variable - $requestAttachments -
    -
    - -
    -
    - Variable - $requestAttachments -
    -
    - -
    -
    - Variable - $requestHeader -
    -
    - -
    SOAP Headers from request (parsed)
    -
    -
    - Variable - $requestHeaders -
    -
    - -
    SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text)
    -
    -
    - Variable - $requestHeaders -
    -
    - -
    -
    - Variable - $requestSOAP -
    -
    - -
    SOAP payload for request (text)
    -
    -
    - Variable - $request_method -
    -
    - -
    -
    - Variable - $response -
    -
    - -
    -
    - Variable - $response -
    -
    - -
    HTTP response
    -
    -
    - Variable - $responseAttachments -
    -
    - -
    -
    - Variable - $responseAttachments -
    -
    - -
    -
    - Variable - $responseData -
    -
    - -
    -
    - Variable - $responseHeader -
    -
    - -
    -
    - Variable - $responseHeaders -
    -
    - -
    -
    - Variable - $responseHeaders -
    -
    - -
    SOAP headers for response (text or array of soapval or associative array)
    -
    -
    - Variable - $responseHeaders -
    -
    - -
    -
    - Variable - $responseSOAP -
    -
    - -
    SOAP payload for response (text)
    -
    -
    - Variable - $response_status_line -
    -
    - -
    -
    - Variable - $response_timeout -
    -
    - -
    -
    - Variable - $response_timeout -
    -
    - -
    -
    - Variable - $result -
    -
    - -
    text indication of result (for debugging)
    -
    -
    - Variable - $revision -
    -
    - -
    CVS revision for HTTP headers.
    -
    -
    - Variable - $root_header -
    -
    - -
    -
    - Variable - $root_struct -
    -
    - -
    -
    - Variable - $root_struct_name -
    -
    - -
    -
    - Variable - $root_struct_namespace -
    -
    - -
    -
    - Method - register -
    -
    - -
    register a service function with the server
    -
    -
    - Method - releaseMutex -
    -
    -
    nusoap_wsdlcache::releaseMutex() in class.wsdlcache.php
    -
    releases the local mutex
    -
    -
    - Method - remove -
    -
    -
    nusoap_wsdlcache::remove() in class.wsdlcache.php
    -
    removes a wsdl instance from the cache
    -
    -
    - -
    -
    s
    - -
    -
    -
    -
    - Variable - $schema -
    -
    - -
    -
    - Variable - $schemaInfo -
    -
    - -
    -
    - Variable - $schemas -
    -
    -
    wsdl::$schemas in nusoap.php
    -
    -
    - Variable - $schemaTargetNamespace -
    -
    - -
    -
    - Variable - $scheme -
    -
    - -
    -
    - Variable - $simpleTypes -
    -
    - -
    -
    - Variable - $simpleTypeStack -
    -
    - -
    -
    - Variable - $SOAPAction -
    -
    - -
    SOAP Action from request
    -
    -
    - Variable - $soapheader -
    -
    - -
    -
    - Variable - $soapresponse -
    -
    - -
    -
    - Variable - $soap_defencoding -
    -
    - -
    charset encoding for outgoing messages
    -
    -
    - Variable - $status -
    -
    -
    wsdl::$status in nusoap.php
    -
    -
    - Variable - $status -
    -
    - -
    -
    - Method - schemaCharacterData -
    -
    - -
    element content handler
    -
    -
    - Method - schemaEndElement -
    -
    - -
    end-element handler
    -
    -
    - Method - schemaStartElement -
    -
    - -
    start-element handler
    -
    -
    - Method - send -
    -
    -
    nusoap_client::send() in nusoap.php
    -
    send the SOAP message
    -
    -
    - Method - send -
    -
    - -
    sends the SOAP request and gets the SOAP response via HTTP[S]
    -
    -
    - Method - sendHTTPS -
    -
    - -
    sends the SOAP request and gets the SOAP response via HTTPS using CURL
    -
    -
    - Method - sendRequest -
    -
    - -
    sends the SOAP request via HTTP[S]
    -
    -
    - Method - send_response -
    -
    - -
    sends an HTTP response
    -
    -
    - Method - serialize -
    -
    -
    soapval::serialize() in nusoap.php
    -
    return serialized value
    -
    -
    - Method - serialize -
    -
    - -
    serialize a fault
    -
    -
    - Method - serialize -
    -
    -
    wsdl::serialize() in nusoap.php
    -
    serialize the parsed wsdl
    -
    -
    - Method - serializeComplexTypeAttributes -
    -
    - -
    serializes the attributes for a complexType
    -
    -
    - Method - serializeComplexTypeElements -
    -
    - -
    serializes the elements for a complexType
    -
    -
    - Method - serializeEnvelope -
    -
    - -
    serializes a message
    -
    -
    - Method - serializeParameters -
    -
    - -
    serialize a PHP value according to a WSDL message definition
    -
    -
    - Method - serializeRPCParameters -
    -
    - -
    serialize PHP values according to a WSDL message definition contrary to the method name, this is not limited to RPC
    -
    -
    - Method - serializeSchema -
    -
    - -
    serialize the schema
    -
    -
    - Method - serializeType -
    -
    -
    wsdl::serializeType() in nusoap.php
    -
    serializes a PHP value according a given type definition
    -
    -
    - Method - serializeTypeDef -
    -
    - -
    returns a sample serialization of a given type, or false if no type by the given name
    -
    -
    - Method - serialize_return -
    -
    - -
    serializes the return value from a PHP function into a full SOAP Envelope
    -
    -
    - Method - serialize_val -
    -
    - -
    serializes PHP values in accordance w/ section 5. Type information is not serialized if $use == 'literal'.
    -
    -
    - Method - service -
    -
    - -
    processes request and returns response
    -
    -
    - Method - setContentType -
    -
    - -
    sets the content-type for the SOAP message to be sent
    -
    -
    - Method - setCookie -
    -
    - -
    adds a new Cookie into $this->cookies array
    -
    -
    - Method - setCredentials -
    -
    - -
    if authenticating, set user credentials here
    -
    -
    - Method - setCredentials -
    -
    - -
    if authenticating, set user credentials here
    -
    -
    - Method - setCredentials -
    -
    - -
    if authenticating, set user credentials here
    -
    -
    - Method - setCurlOption -
    -
    - -
    sets a cURL option
    -
    -
    - Method - setCurlOption -
    -
    - -
    sets user-specified cURL options
    -
    -
    - Method - setDebugLevel -
    -
    - -
    sets the debug level for this instance
    -
    -
    - Method - setDefaultRpcParams -
    -
    - -
    sets the default RPC parameter setting.
    -
    -
    - Method - setEncoding -
    -
    - -
    use http encoding
    -
    -
    - Method - setEndpoint -
    -
    - -
    sets the SOAP endpoint, which can override WSDL
    -
    -
    - Method - setError -
    -
    - -
    sets error string
    -
    -
    - Method - setGlobalDebugLevel -
    -
    - -
    sets the global debug level, which applies to future instances
    -
    -
    - Method - setHeader -
    -
    - -
    sets an HTTP header
    -
    -
    - Method - setHeaders -
    -
    - -
    set the SOAP headers
    -
    -
    - Method - setHTTPEncoding -
    -
    - -
    use HTTP encoding
    -
    -
    - Method - setHTTPProxy -
    -
    - -
    set proxy info here
    -
    -
    - Method - setProxy -
    -
    - -
    set proxy info here
    -
    -
    - Method - setSOAPAction -
    -
    - -
    set the soapaction value
    -
    -
    - Method - setURL -
    -
    - -
    sets the URL to which to connect
    -
    -
    - Method - setUseCURL -
    -
    - -
    Set whether to try to use cURL connections if possible
    -
    -
    - Class - soapclient -
    -
    -
    soapclient in nusoap.php
    -
    For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded.
    -
    -
    - Class - soapclientmime -
    -
    -
    soapclientmime in nusoapmime.php
    -
    nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    -
    -
    - Method - soapval -
    -
    -
    soapval::soapval() in nusoap.php
    -
    constructor
    -
    -
    - Class - soapval -
    -
    -
    soapval in nusoap.php
    -
    For creating serializable abstractions of native PHP types. This class
    -
    -
    - Class - soap_fault -
    -
    -
    soap_fault in nusoap.php
    -
    Backward compatibility
    -
    -
    - Class - soap_parser -
    -
    -
    soap_parser in nusoap.php
    -
    Backward compatibility
    -
    -
    - Class - soap_server -
    -
    -
    soap_server in nusoap.php
    -
    Backward compatibility
    -
    -
    - Method - soap_transport_http -
    -
    - -
    constructor
    -
    -
    - Class - soap_transport_http -
    -
    -
    soap_transport_http in nusoap.php
    -
    transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support
    -
    -
    - Method - start_element -
    -
    -
    wsdl::start_element() in nusoap.php
    -
    start-element handler
    -
    -
    - Method - start_element -
    -
    - -
    start-element handler
    -
    -
    - -
    -
    t
    - -
    -
    -
    -
    - Variable - $timeout -
    -
    -
    wsdl::$timeout in nusoap.php
    -
    -
    - Variable - $timeout -
    -
    - -
    -
    - Variable - $title -
    -
    -
    nusoap_base::$title in nusoap.php
    -
    Identification for HTTP headers.
    -
    -
    - Variable - $type -
    -
    -
    soapval::$type in nusoap.php
    -
    The XML type name (string or false)
    -
    -
    - Variable - $typemap -
    -
    -
    nusoap_base::$typemap in nusoap.php
    -
    XML Schema types in an array of uri => (array of xml type => php type) is this legacy yet? no, this is used by the nusoap_xmlschema class to verify type => namespace mappings.
    -
    -
    - Variable - $type_ns -
    -
    -
    soapval::$type_ns in nusoap.php
    -
    The XML type namespace (string or false)
    -
    -
    - Function - timestamp_to_iso8601 -
    -
    - -
    convert unix timestamp to ISO 8601 compliant date string
    -
    -
    - Method - typeToForm -
    -
    - -
    returns HTML form elements that allow a user to enter values for creating an instance of the given type.
    -
    -
    - -
    -
    u
    - -
    -
    -
    -
    - Variable - $uri -
    -
    - -
    -
    - Variable - $url -
    -
    - -
    -
    - Variable - $usedNamespaces -
    -
    - -
    namespaces used in the current context, e.g. during serialization
    -
    -
    - Variable - $username -
    -
    - -
    -
    - Variable - $username -
    -
    -
    wsdl::$username in nusoap.php
    -
    -
    - Variable - $username -
    -
    - -
    -
    - Variable - $useSOAPAction -
    -
    - -
    -
    - Variable - $use_curl -
    -
    - -
    -
    - Variable - $use_curl -
    -
    -
    wsdl::$use_curl in nusoap.php
    -
    -
    - Variable - $use_curl -
    -
    - -
    -
    - Method - unsetHeader -
    -
    - -
    unsets an HTTP header
    -
    -
    - Method - UpdateCookies -
    -
    - -
    updates the current cookies with a new set
    -
    -
    - Method - useHTTPPersistentConnection -
    -
    - -
    use HTTP persistent connections if possible
    -
    -
    - Method - usePersistentConnection -
    -
    - -
    specifies that an HTTP persistent connection should be used
    -
    -
    - Function - usleepWindows -
    -
    -
    usleepWindows() in nusoap.php
    -
    sleeps some number of microseconds
    -
    -
    - -
    -
    v
    - -
    -
    -
    -
    - Variable - $value -
    -
    -
    soapval::$value in nusoap.php
    -
    The PHP value
    -
    -
    - Variable - $version -
    -
    -
    nusoap_base::$version in nusoap.php
    -
    Version for HTTP headers.
    -
    -
    - Method - varDump -
    -
    - -
    Returns a string with the output of var_dump
    -
    -
    - Method - verify_method -
    -
    - -
    takes the value that was created by parsing the request and compares to the method's signature, if available.
    -
    -
    - -
    -
    w
    - -
    -
    -
    -
    - Variable - $wsdl -
    -
    -
    wsdl::$wsdl in nusoap.php
    -
    -
    - Variable - $wsdl -
    -
    -
    nusoap_server::$wsdl in nusoap.php
    -
    wsdl instance (if one)
    -
    -
    - Method - webDescription -
    -
    - -
    prints html description of services
    -
    -
    - Method - wsdl -
    -
    -
    wsdl::wsdl() in nusoap.php
    -
    constructor
    -
    -
    - Class - wsdl -
    -
    -
    wsdl in nusoap.php
    -
    parses a WSDL file, allows access to it's data, other utility methods.
    -
    -
    - Class - wsdlcache -
    -
    -
    wsdlcache in class.wsdlcache.php
    -
    For backward compatibility
    -
    -
    - -
    -
    x
    - -
    -
    -
    -
    - Variable - $xml -
    -
    -
    nusoap_parser::$xml in nusoap.php
    -
    -
    - Variable - $xml -
    -
    - -
    -
    - Variable - $xmlEntities -
    -
    - -
    XML entities to convert
    -
    -
    - Variable - $XMLSchemaVersion -
    -
    - -
    set schema version
    -
    -
    - Variable - $xml_encoding -
    -
    - -
    character set encoding of incoming (request) messages
    -
    -
    - Variable - $xml_encoding -
    -
    - -
    -
    - Variable - $xml_encoding -
    -
    - -
    -
    - Method - xdebug -
    -
    - -
    adds debug data to the clas level debug string
    -
    -
    - Class - XMLSchema -
    -
    -
    XMLSchema in nusoap.php
    -
    Backward compatibility
    -
    -
    - -
    -
    _
    - -
    -
    -
    -
    - Method - _getProxyClassCode -
    -
    - -
    dynamically creates proxy class code
    -
    -
    - Method - __toString -
    -
    - -
    represents the object as a string
    -
    -
    - -
    - a - b - c - d - e - f - g - h - i - l - m - n - o - p - r - s - t - u - v - w - x - _ -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/elementindex_nusoap.html b/lib/nusoap/docs/docs/elementindex_nusoap.html deleted file mode 100644 index 23c86d492..000000000 --- a/lib/nusoap/docs/docs/elementindex_nusoap.html +++ /dev/null @@ -1,3287 +0,0 @@ - - - - - - - - - - - -

    [nusoap] element index

    -All elements -
    -
    - a - b - c - d - e - f - g - h - i - l - m - n - o - p - r - s - t - u - v - w - x - _ -
    - - -
    -
    _
    - -
    -
    -
    -
    - Method - _getProxyClassCode -
    -
    - -
    dynamically creates proxy class code
    -
    -
    - Method - __toString -
    -
    - -
    represents the object as a string
    -
    -
    - -
    -
    a
    - -
    -
    -
    -
    - Variable - $attributes -
    -
    - -
    -
    - Variable - $attributes -
    -
    -
    soapval::$attributes in nusoap.php
    -
    The XML element attributes (array or false)
    -
    -
    - Variable - $authtype -
    -
    -
    wsdl::$authtype in nusoap.php
    -
    -
    - Variable - $authtype -
    -
    - -
    -
    - Variable - $authtype -
    -
    - -
    -
    - Method - addAttachment -
    -
    - -
    adds a MIME attachment to the current request.
    -
    -
    - Method - addAttachment -
    -
    - -
    adds a MIME attachment to the current response.
    -
    -
    - Method - addComplexType -
    -
    - -
    adds a complex type to the schema
    -
    -
    - Method - addComplexType -
    -
    - -
    adds an XML Schema complex type to the WSDL types
    -
    -
    - Method - addElement -
    -
    - -
    adds an element to the schema
    -
    -
    - Method - addElement -
    -
    -
    wsdl::addElement() in nusoap.php
    -
    adds an element to the WSDL types
    -
    -
    - Method - addOperation -
    -
    -
    wsdl::addOperation() in nusoap.php
    -
    register an operation with the server
    -
    -
    - Method - addSimpleType -
    -
    - -
    adds a simple type to the schema
    -
    -
    - Method - addSimpleType -
    -
    -
    wsdl::addSimpleType() in nusoap.php
    -
    adds an XML Schema simple type to the WSDL types
    -
    -
    - Method - add_to_map -
    -
    - -
    add a method to the dispatch map (this has been replaced by the register method)
    -
    -
    - Method - appendDebug -
    -
    - -
    adds debug data to the instance debug string without formatting
    -
    -
    - -
    -
    b
    - -
    -
    -
    -
    - Variable - $bindings -
    -
    -
    wsdl::$bindings in nusoap.php
    -
    -
    - Variable - $bindingType -
    -
    - -
    -
    - Variable - $body_position -
    -
    - -
    -
    - Method - buildPayload -
    -
    - -
    Writes the payload, including HTTP headers, to $this->outgoing_payload.
    -
    -
    - Method - buildVal -
    -
    - -
    builds response structures for compound values (arrays/structs) and scalars
    -
    -
    - -
    -
    c
    - -
    -
    -
    -
    - Variable - $cache_dir -
    -
    -
    nusoap_wsdlcache::$cache_dir in class.wsdlcache.php
    -
    -
    - Variable - $cache_lifetime -
    -
    -
    nusoap_wsdlcache::$cache_lifetime in class.wsdlcache.php
    -
    -
    - Variable - $certRequest -
    -
    - -
    -
    - Variable - $certRequest -
    -
    -
    wsdl::$certRequest in nusoap.php
    -
    -
    - Variable - $certRequest -
    -
    - -
    -
    - Variable - $ch -
    -
    - -
    -
    - Variable - $charencoding -
    -
    - -
    toggles automatic encoding of special characters as entities (should always be true, I think)
    -
    -
    - Variable - $ch_options -
    -
    - -
    -
    - Variable - $complexTypes -
    -
    - -
    -
    - Variable - $complexTypes -
    -
    -
    wsdl::$complexTypes in nusoap.php
    -
    -
    - Variable - $complexTypeStack -
    -
    - -
    -
    - Variable - $cookies -
    -
    - -
    -
    - Variable - $curl_options -
    -
    -
    wsdl::$curl_options in nusoap.php
    -
    -
    - Variable - $curl_options -
    -
    - -
    -
    - Variable - $currentBinding -
    -
    -
    wsdl::$currentBinding in nusoap.php
    -
    -
    - Variable - $currentComplexType -
    -
    - -
    -
    - Variable - $currentElement -
    -
    - -
    -
    - Variable - $currentMessage -
    -
    -
    wsdl::$currentMessage in nusoap.php
    -
    -
    - Variable - $currentOperation -
    -
    - -
    -
    - Variable - $currentPort -
    -
    -
    wsdl::$currentPort in nusoap.php
    -
    -
    - Variable - $currentPortType -
    -
    - -
    -
    - Variable - $currentSchema -
    -
    -
    wsdl::$currentSchema in nusoap.php
    -
    -
    - Variable - $currentSimpleType -
    -
    - -
    -
    - Method - call -
    -
    -
    nusoap_client::call() in nusoap.php
    -
    calls method, returns PHP native type
    -
    -
    - Method - character_data -
    -
    - -
    element content handler
    -
    -
    - Method - character_data -
    -
    - -
    element content handler
    -
    -
    - Method - checkCookies -
    -
    - -
    checks all Cookies and delete those which are expired
    -
    -
    - Method - checkWSDL -
    -
    - -
    check WSDL passed as an instance or pulled from an endpoint
    -
    -
    - Page - class.wsdlcache.php -
    -
    -
    class.wsdlcache.php in class.wsdlcache.php
    -
    -
    - Method - clearAttachments -
    -
    - -
    clears the MIME attachments for the current response.
    -
    -
    - Method - clearAttachments -
    -
    - -
    clears the MIME attachments for the current request.
    -
    -
    - Method - clearDebug -
    -
    - -
    clears the current debug data for this instance
    -
    -
    - Method - configureWSDL -
    -
    - -
    Sets up wsdl object.
    -
    -
    - Method - connect -
    -
    - -
    establish an HTTP connection
    -
    -
    - Method - contractQname -
    -
    - -
    contracts (changes namespace to prefix) a qualified name
    -
    -
    - Method - createFilename -
    -
    -
    nusoap_wsdlcache::createFilename() in class.wsdlcache.php
    -
    creates the filename used to cache a wsdl instance
    -
    -
    - Method - CreateTypeName -
    -
    - -
    gets a type name for an unnamed type
    -
    -
    - -
    -
    d
    - -
    -
    -
    -
    - Variable - $debugLevel -
    -
    - -
    the debug level for this instance
    -
    -
    - Variable - $debug_flag -
    -
    - -
    whether to append debug to response as XML comment
    -
    -
    - Variable - $debug_flag -
    -
    - -
    -
    - Variable - $debug_str -
    -
    - -
    Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
    -
    -
    - Variable - $debug_str -
    -
    -
    nusoap_wsdlcache::$debug_str in class.wsdlcache.php
    -
    -
    - Variable - $decode_utf8 -
    -
    - -
    toggles whether the parser decodes element content w/ utf8_decode()
    -
    -
    - Variable - $decode_utf8 -
    -
    - -
    -
    - Variable - $decode_utf8 -
    -
    - -
    -
    - Variable - $defaultNamespace -
    -
    - -
    -
    - Variable - $defaultRpcParams -
    -
    - -
    -
    - Variable - $default_namespace -
    -
    - -
    -
    - Variable - $depth -
    -
    -
    wsdl::$depth in nusoap.php
    -
    -
    - Variable - $depth -
    -
    - -
    -
    - Variable - $depth -
    -
    -
    nusoap_parser::$depth in nusoap.php
    -
    -
    - Variable - $depth_array -
    -
    - -
    -
    - Variable - $depth_array -
    -
    -
    wsdl::$depth_array in nusoap.php
    -
    -
    - Variable - $depth_array -
    -
    - -
    -
    - Variable - $digestRequest -
    -
    - -
    -
    - Variable - $digest_uri -
    -
    - -
    -
    - Variable - $document -
    -
    - -
    -
    - Variable - $document -
    -
    - -
    SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text)
    -
    -
    - Variable - $document -
    -
    - -
    -
    - Variable - $documentation -
    -
    -
    wsdl::$documentation in nusoap.php
    -
    -
    - Method - debug -
    -
    -
    nusoap_base::debug() in nusoap.php
    -
    adds debug data to the instance debug string with formatting
    -
    -
    - Method - debug -
    -
    -
    nusoap_wsdlcache::debug() in class.wsdlcache.php
    -
    adds debug data to the class level debug string
    -
    -
    - Method - decode -
    -
    -
    soapval::decode() in nusoap.php
    -
    decodes a soapval object into a PHP native type
    -
    -
    - Method - decodeChunked -
    -
    - -
    decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6
    -
    -
    - Method - decodeSimple -
    -
    - -
    decodes simple types into PHP variables
    -
    -
    - Method - decodeUTF8 -
    -
    - -
    -
    - -
    -
    e
    - -
    -
    -
    -
    - Variable - $elements -
    -
    - -
    -
    - Variable - $elementStack -
    -
    - -
    -
    - Variable - $element_ns -
    -
    -
    soapval::$element_ns in nusoap.php
    -
    The XML element namespace (string or false)
    -
    -
    - Variable - $enclosingNamespaces -
    -
    - -
    -
    - Variable - $encoding -
    -
    - -
    -
    - Variable - $endpoint -
    -
    - -
    -
    - Variable - $endpoint -
    -
    -
    wsdl::$endpoint in nusoap.php
    -
    -
    - Variable - $endpointType -
    -
    - -
    -
    - Variable - $error_str -
    -
    - -
    Current error string (manipulated by getError/setError)
    -
    -
    - Variable - $externalWSDLURL -
    -
    - -
    URL for WSDL (if one)
    -
    -
    - Method - end_element -
    -
    -
    wsdl::end_element() in nusoap.php
    -
    end-element handler
    -
    -
    - Method - end_element -
    -
    - -
    end-element handler
    -
    -
    - Method - expandEntities -
    -
    - -
    expands entities, e.g. changes '<' to '&lt;'.
    -
    -
    - Method - expandQname -
    -
    - -
    expands (changes prefix to namespace) a qualified name
    -
    -
    - -
    -
    f
    - -
    -
    -
    -
    - Variable - $fault -
    -
    -
    nusoap_parser::$fault in nusoap.php
    -
    -
    - Variable - $fault -
    -
    -
    nusoap_client::$fault in nusoap.php
    -
    -
    - Variable - $fault -
    -
    -
    nusoap_server::$fault in nusoap.php
    -
    SOAP fault for response (or false)
    -
    -
    - Variable - $faultactor -
    -
    - -
    The fault actor
    -
    -
    - Variable - $faultcode -
    -
    - -
    The fault code (client|server)
    -
    -
    - Variable - $faultcode -
    -
    - -
    -
    - Variable - $faultdetail -
    -
    - -
    The fault detail, typically a string or array of string
    -
    -
    - Variable - $faultdetail -
    -
    - -
    -
    - Variable - $faultstring -
    -
    - -
    The fault string, a description of the fault
    -
    -
    - Variable - $faultstring -
    -
    - -
    -
    - Variable - $fault_code -
    -
    - -
    -
    - Variable - $fault_detail -
    -
    - -
    -
    - Variable - $fault_str -
    -
    - -
    -
    - Variable - $forceEndpoint -
    -
    - -
    -
    - Variable - $fplock -
    -
    -
    nusoap_wsdlcache::$fplock in class.wsdlcache.php
    -
    -
    - Method - fault -
    -
    - -
    Specify a fault to be returned to the client.
    -
    -
    - Method - fetchWSDL -
    -
    -
    wsdl::fetchWSDL() in nusoap.php
    -
    fetches the WSDL document and parses it
    -
    -
    - Method - formatDump -
    -
    - -
    formats a string to be inserted into an HTML stream
    -
    -
    - -
    -
    g
    - -
    -
    -
    -
    - Method - get -
    -
    -
    nusoap_wsdlcache::get() in class.wsdlcache.php
    -
    gets a wsdl instance from the cache
    -
    -
    - Method - getAttachments -
    -
    - -
    gets the MIME attachments from the current response.
    -
    -
    - Method - getAttachments -
    -
    - -
    gets the MIME attachments from the current request.
    -
    -
    - Method - getBindingData -
    -
    - -
    -
    - Method - getCookies -
    -
    - -
    gets all Cookies
    -
    -
    - Method - getCookiesForRequest -
    -
    - -
    sort out cookies for the current request
    -
    -
    - Method - getDebug -
    -
    - -
    gets the current debug data for this instance
    -
    -
    - Method - getDebugAsXMLComment -
    -
    - -
    gets the current debug data for this instance as an XML comment this may change the contents of the debug data
    -
    -
    - Method - getDebugLevel -
    -
    - -
    gets the debug level for this instance
    -
    -
    - Method - getDefaultRpcParams -
    -
    - -
    gets the default RPC parameter setting.
    -
    -
    - Method - getError -
    -
    - -
    returns error string if present
    -
    -
    - Method - getGlobalDebugLevel -
    -
    - -
    gets the global debug level, which applies to future instances
    -
    -
    - Method - getHeader -
    -
    - -
    get the SOAP response Header (parsed)
    -
    -
    - Method - getHeaders -
    -
    - -
    get the SOAP response headers (namespace resolution incomplete)
    -
    -
    - Method - getHeaders -
    -
    - -
    get the unparsed SOAP Header
    -
    -
    - Method - getHTTPBody -
    -
    - -
    gets the HTTP body for the current response.
    -
    -
    - Method - getHTTPBody -
    -
    - -
    gets the HTTP body for the current response.
    -
    -
    - Method - getHTTPBody -
    -
    - -
    gets the HTTP body for the current request.
    -
    -
    - Method - getHTTPBody -
    -
    - -
    gets the HTTP body for the current request.
    -
    -
    - Method - getHTTPContentType -
    -
    - -
    gets the HTTP content type for the current response.
    -
    -
    - Method - getHTTPContentType -
    -
    - -
    gets the HTTP content type for the current request.
    -
    -
    - Method - getHTTPContentType -
    -
    - -
    gets the HTTP content type for the current response.
    -
    -
    - Method - getHTTPContentType -
    -
    - -
    gets the HTTP content type for the current request.
    -
    -
    - Method - getHTTPContentTypeCharset -
    -
    - -
    gets the HTTP content type charset for the current request.
    -
    -
    - Method - getHTTPContentTypeCharset -
    -
    - -
    gets the HTTP content type charset for the current response.
    -
    -
    - Method - getHTTPContentTypeCharset -
    -
    - -
    gets the HTTP content type charset for the current request.
    -
    -
    - Method - getHTTPContentTypeCharset -
    -
    - -
    gets the HTTP content type charset for the current response.
    -
    -
    - Method - getLocalPart -
    -
    - -
    returns the local part of a prefixed string returns the original string, if not prefixed
    -
    -
    - Method - getmicrotime -
    -
    - -
    returns the time in ODBC canonical form with microseconds
    -
    -
    - Method - getNamespaceFromPrefix -
    -
    - -
    pass it a prefix, it returns a namespace
    -
    -
    - Method - getOperationData -
    -
    - -
    returns an associative array of data necessary for calling an operation
    -
    -
    - Method - getOperationData -
    -
    - -
    get available data pertaining to an operation
    -
    -
    - Method - getOperationDataForSoapAction -
    -
    - -
    returns an associative array of data necessary for calling an operation
    -
    -
    - Method - getOperations -
    -
    -
    wsdl::getOperations() in nusoap.php
    -
    returns an assoc array of operation names => operation data
    -
    -
    - Method - getPHPType -
    -
    - -
    get the PHP type of a user defined type in the schema
    -
    -
    - Method - getPrefix -
    -
    - -
    returns the prefix part of a prefixed string returns false, if not prefixed
    -
    -
    - Method - getPrefixFromNamespace -
    -
    - -
    returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace
    -
    -
    - Method - getProxy -
    -
    - -
    dynamically creates an instance of a proxy class, allowing user to directly call methods from wsdl
    -
    -
    - Method - getProxyClassCode -
    -
    - -
    dynamically creates proxy class code
    -
    -
    - Method - getResponse -
    -
    - -
    gets the SOAP response via HTTP[S]
    -
    -
    - Method - getTypeDef -
    -
    - -
    returns an associative array of information about a given type returns false if no type exists by the given name
    -
    -
    - Method - getTypeDef -
    -
    -
    wsdl::getTypeDef() in nusoap.php
    -
    returns an array of information about a given type returns false if no type exists by the given name
    -
    -
    - Method - get_response -
    -
    - -
    get the parsed message (SOAP Body)
    -
    -
    - Method - get_soapbody -
    -
    - -
    get the parsed SOAP Body (NULL if there was none)
    -
    -
    - Method - get_soapheader -
    -
    - -
    get the parsed SOAP Header (NULL if there was none)
    -
    -
    - -
    -
    h
    - -
    -
    -
    -
    - Variable - $headers -
    -
    - -
    HTTP headers of request
    -
    -
    - Variable - $host -
    -
    - -
    -
    - Variable - $http_encoding -
    -
    - -
    -
    - -
    -
    i
    - -
    -
    -
    -
    - Variable - $ids -
    -
    -
    nusoap_parser::$ids in nusoap.php
    -
    -
    - Variable - $import -
    -
    -
    wsdl::$import in nusoap.php
    -
    -
    - Variable - $imports -
    -
    - -
    -
    - Variable - $incoming_cookies -
    -
    - -
    -
    - Variable - $incoming_headers -
    -
    - -
    -
    - Variable - $incoming_payload -
    -
    - -
    -
    - Method - invoke_method -
    -
    - -
    invokes a PHP function for the requested SOAP method
    -
    -
    - Method - io_method -
    -
    - -
    gets the I/O method to use
    -
    -
    - Method - isArraySimpleOrStruct -
    -
    - -
    detect if array is a simple array or a struct (associative array)
    -
    -
    - Function - iso8601_to_timestamp -
    -
    - -
    convert ISO 8601 compliant date string to unix timestamp
    -
    -
    - Method - isSkippableCurlHeader -
    -
    - -
    Test if the given string starts with a header that is to be skipped.
    -
    -
    - -
    -
    l
    - -
    -
    -
    -
    - Method - loadWSDL -
    -
    - -
    instantiate wsdl object and parse wsdl file
    -
    -
    - -
    -
    m
    - -
    -
    -
    -
    - Variable - $message -
    -
    - -
    -
    - Variable - $message -
    -
    -
    wsdl::$message in nusoap.php
    -
    -
    - Variable - $message -
    -
    - -
    -
    - Variable - $messages -
    -
    -
    wsdl::$messages in nusoap.php
    -
    -
    - Variable - $method -
    -
    - -
    -
    - Variable - $methodname -
    -
    - -
    name of method requested
    -
    -
    - Variable - $methodparams -
    -
    - -
    method parameters from request
    -
    -
    - Variable - $methodreturn -
    -
    - -
    method return value to place in response
    -
    -
    - Variable - $methodreturnisliteralxml -
    -
    - -
    whether $methodreturn is a string of literal XML
    -
    -
    - Variable - $methodURI -
    -
    - -
    requested method namespace URI
    -
    -
    - Variable - $mimeContentType -
    -
    - -
    -
    - Variable - $mimeContentType -
    -
    - -
    -
    - Variable - $multirefs -
    -
    - -
    -
    - -
    -
    n
    - -
    -
    -
    -
    - Variable - $name -
    -
    -
    soapval::$name in nusoap.php
    -
    The XML element name
    -
    -
    - Variable - $namespaces -
    -
    - -
    -
    - Variable - $namespaces -
    -
    - -
    namespaces in an array of prefix => uri
    -
    -
    - Page - nusoapmime.php -
    -
    -
    nusoapmime.php in nusoapmime.php
    -
    -
    - Class - nusoapservermime -
    -
    -
    nusoapservermime in nusoapmime.php
    -
    nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    -
    -
    - Method - nusoap_base -
    -
    - -
    constructor
    -
    -
    - Class - nusoap_base -
    -
    -
    nusoap_base in nusoap.php
    -
    nusoap_base
    -
    -
    - Class - nusoap_client -
    -
    -
    nusoap_client in nusoap.php
    -
    [nu]soapclient higher level class for easy usage.
    -
    -
    - Method - nusoap_client -
    -
    - -
    constructor
    -
    -
    - Class - nusoap_client_mime -
    -
    -
    nusoap_client_mime in nusoapmime.php
    -
    nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    -
    -
    - Class - nusoap_fault -
    -
    -
    nusoap_fault in nusoap.php
    -
    Contains information for a SOAP fault.
    -
    -
    - Method - nusoap_fault -
    -
    - -
    constructor
    -
    -
    - Class - nusoap_parser -
    -
    -
    nusoap_parser in nusoap.php
    -
    nusoap_parser class parses SOAP XML messages into native PHP values
    -
    -
    - Method - nusoap_parser -
    -
    - -
    constructor that actually does the parsing
    -
    -
    - Page - nusoap.php -
    -
    -
    nusoap.php in nusoap.php
    -
    -
    - Method - nusoap_server -
    -
    - -
    constructor the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
    -
    -
    - Class - nusoap_server -
    -
    -
    nusoap_server in nusoap.php
    -
    nusoap_server allows the user to create a SOAP server that is capable of receiving messages and returning responses
    -
    -
    - Class - nusoap_server_mime -
    -
    -
    nusoap_server_mime in nusoapmime.php
    -
    nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    -
    -
    - Class - nusoap_wsdlcache -
    -
    -
    nusoap_wsdlcache in class.wsdlcache.php
    -
    caches instances of the wsdl class
    -
    -
    - Method - nusoap_wsdlcache -
    -
    - -
    constructor
    -
    -
    - Class - nusoap_xmlschema -
    -
    -
    nusoap_xmlschema in nusoap.php
    -
    parses an XML Schema, allows access to it's data, other utility methods.
    -
    -
    - Method - nusoap_xmlschema -
    -
    - -
    constructor
    -
    -
    - -
    -
    o
    - -
    -
    -
    -
    - Variable - $opData -
    -
    -
    wsdl::$opData in nusoap.php
    -
    -
    - Variable - $operations -
    -
    - -
    assoc array of operations => opData; operations are added by the register()
    -
    -
    - Variable - $operations -
    -
    - -
    -
    - Variable - $outgoing_headers -
    -
    - -
    -
    - Variable - $outgoing_headers -
    -
    - -
    HTTP headers of response
    -
    -
    - Variable - $outgoing_payload -
    -
    - -
    -
    - Method - obtainMutex -
    -
    -
    nusoap_wsdlcache::obtainMutex() in class.wsdlcache.php
    -
    obtains the local mutex
    -
    -
    - -
    -
    p
    - -
    -
    -
    -
    - Variable - $parent -
    -
    - -
    -
    - Variable - $parser -
    -
    -
    wsdl::$parser in nusoap.php
    -
    -
    - Variable - $parser -
    -
    - -
    -
    - Variable - $password -
    -
    -
    wsdl::$password in nusoap.php
    -
    -
    - Variable - $password -
    -
    - -
    -
    - Variable - $password -
    -
    - -
    -
    - Variable - $path -
    -
    - -
    -
    - Variable - $persistentConnection -
    -
    - -
    -
    - Variable - $persistentConnection -
    -
    - -
    -
    - Variable - $port -
    -
    - -
    -
    - Variable - $portName -
    -
    - -
    -
    - Variable - $ports -
    -
    -
    wsdl::$ports in nusoap.php
    -
    -
    - Variable - $portTypes -
    -
    -
    wsdl::$portTypes in nusoap.php
    -
    -
    - Variable - $position -
    -
    - -
    -
    - Variable - $position -
    -
    - -
    -
    - Variable - $position -
    -
    -
    wsdl::$position in nusoap.php
    -
    -
    - Variable - $protocol_version -
    -
    - -
    -
    - Variable - $proxy -
    -
    - -
    -
    - Variable - $proxyhost -
    -
    -
    wsdl::$proxyhost in nusoap.php
    -
    -
    - Variable - $proxyhost -
    -
    - -
    -
    - Variable - $proxypassword -
    -
    - -
    -
    - Variable - $proxypassword -
    -
    -
    wsdl::$proxypassword in nusoap.php
    -
    -
    - Variable - $proxyport -
    -
    -
    wsdl::$proxyport in nusoap.php
    -
    -
    - Variable - $proxyport -
    -
    - -
    -
    - Variable - $proxyusername -
    -
    - -
    -
    - Variable - $proxyusername -
    -
    -
    wsdl::$proxyusername in nusoap.php
    -
    -
    - Method - parametersMatchWrapped -
    -
    - -
    determine whether a set of parameters are unwrapped when they are expect to be wrapped, Microsoft-style.
    -
    -
    - Method - parseCookie -
    -
    - -
    parse an incoming Cookie into it's parts
    -
    -
    - Method - parseFile -
    -
    - -
    parse an XML file
    -
    -
    - Method - parseRequest -
    -
    - -
    processes SOAP message received from client
    -
    -
    - Method - parseRequest -
    -
    - -
    processes SOAP message received from client
    -
    -
    - Method - parseResponse -
    -
    - -
    processes SOAP message returned from server
    -
    -
    - Method - parseResponse -
    -
    - -
    processes SOAP message returned from server
    -
    -
    - Method - parseString -
    -
    - -
    parse an XML string
    -
    -
    - Method - parseWSDL -
    -
    -
    wsdl::parseWSDL() in nusoap.php
    -
    parses the wsdl document
    -
    -
    - Method - parse_http_headers -
    -
    - -
    parses HTTP request headers.
    -
    -
    - Method - parse_request -
    -
    - -
    parses a request
    -
    -
    - Method - put -
    -
    -
    nusoap_wsdlcache::put() in class.wsdlcache.php
    -
    adds a wsdl instance to the cache
    -
    -
    - -
    -
    r
    - -
    -
    -
    -
    - Variable - $request -
    -
    - -
    HTTP request
    -
    -
    - Variable - $request -
    -
    - -
    -
    - Variable - $requestAttachments -
    -
    - -
    -
    - Variable - $requestAttachments -
    -
    - -
    -
    - Variable - $requestHeader -
    -
    - -
    SOAP Headers from request (parsed)
    -
    -
    - Variable - $requestHeaders -
    -
    - -
    SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text)
    -
    -
    - Variable - $requestHeaders -
    -
    - -
    -
    - Variable - $requestSOAP -
    -
    - -
    SOAP payload for request (text)
    -
    -
    - Variable - $request_method -
    -
    - -
    -
    - Variable - $response -
    -
    - -
    -
    - Variable - $response -
    -
    - -
    HTTP response
    -
    -
    - Variable - $responseAttachments -
    -
    - -
    -
    - Variable - $responseAttachments -
    -
    - -
    -
    - Variable - $responseData -
    -
    - -
    -
    - Variable - $responseHeader -
    -
    - -
    -
    - Variable - $responseHeaders -
    -
    - -
    -
    - Variable - $responseHeaders -
    -
    - -
    SOAP headers for response (text or array of soapval or associative array)
    -
    -
    - Variable - $responseHeaders -
    -
    - -
    -
    - Variable - $responseSOAP -
    -
    - -
    SOAP payload for response (text)
    -
    -
    - Variable - $response_status_line -
    -
    - -
    -
    - Variable - $response_timeout -
    -
    - -
    -
    - Variable - $response_timeout -
    -
    - -
    -
    - Variable - $result -
    -
    - -
    text indication of result (for debugging)
    -
    -
    - Variable - $revision -
    -
    - -
    CVS revision for HTTP headers.
    -
    -
    - Variable - $root_header -
    -
    - -
    -
    - Variable - $root_struct -
    -
    - -
    -
    - Variable - $root_struct_name -
    -
    - -
    -
    - Variable - $root_struct_namespace -
    -
    - -
    -
    - Method - register -
    -
    - -
    register a service function with the server
    -
    -
    - Method - releaseMutex -
    -
    -
    nusoap_wsdlcache::releaseMutex() in class.wsdlcache.php
    -
    releases the local mutex
    -
    -
    - Method - remove -
    -
    -
    nusoap_wsdlcache::remove() in class.wsdlcache.php
    -
    removes a wsdl instance from the cache
    -
    -
    - -
    -
    s
    - -
    -
    -
    -
    - Variable - $schema -
    -
    - -
    -
    - Variable - $schemaInfo -
    -
    - -
    -
    - Variable - $schemas -
    -
    -
    wsdl::$schemas in nusoap.php
    -
    -
    - Variable - $schemaTargetNamespace -
    -
    - -
    -
    - Variable - $scheme -
    -
    - -
    -
    - Variable - $simpleTypes -
    -
    - -
    -
    - Variable - $simpleTypeStack -
    -
    - -
    -
    - Variable - $SOAPAction -
    -
    - -
    SOAP Action from request
    -
    -
    - Variable - $soapheader -
    -
    - -
    -
    - Variable - $soapresponse -
    -
    - -
    -
    - Variable - $soap_defencoding -
    -
    - -
    charset encoding for outgoing messages
    -
    -
    - Variable - $status -
    -
    -
    wsdl::$status in nusoap.php
    -
    -
    - Variable - $status -
    -
    - -
    -
    - Method - schemaCharacterData -
    -
    - -
    element content handler
    -
    -
    - Method - schemaEndElement -
    -
    - -
    end-element handler
    -
    -
    - Method - schemaStartElement -
    -
    - -
    start-element handler
    -
    -
    - Method - send -
    -
    -
    nusoap_client::send() in nusoap.php
    -
    send the SOAP message
    -
    -
    - Method - send -
    -
    - -
    sends the SOAP request and gets the SOAP response via HTTP[S]
    -
    -
    - Method - sendHTTPS -
    -
    - -
    sends the SOAP request and gets the SOAP response via HTTPS using CURL
    -
    -
    - Method - sendRequest -
    -
    - -
    sends the SOAP request via HTTP[S]
    -
    -
    - Method - send_response -
    -
    - -
    sends an HTTP response
    -
    -
    - Method - serialize -
    -
    -
    soapval::serialize() in nusoap.php
    -
    return serialized value
    -
    -
    - Method - serialize -
    -
    - -
    serialize a fault
    -
    -
    - Method - serialize -
    -
    -
    wsdl::serialize() in nusoap.php
    -
    serialize the parsed wsdl
    -
    -
    - Method - serializeComplexTypeAttributes -
    -
    - -
    serializes the attributes for a complexType
    -
    -
    - Method - serializeComplexTypeElements -
    -
    - -
    serializes the elements for a complexType
    -
    -
    - Method - serializeEnvelope -
    -
    - -
    serializes a message
    -
    -
    - Method - serializeParameters -
    -
    - -
    serialize a PHP value according to a WSDL message definition
    -
    -
    - Method - serializeRPCParameters -
    -
    - -
    serialize PHP values according to a WSDL message definition contrary to the method name, this is not limited to RPC
    -
    -
    - Method - serializeSchema -
    -
    - -
    serialize the schema
    -
    -
    - Method - serializeType -
    -
    -
    wsdl::serializeType() in nusoap.php
    -
    serializes a PHP value according a given type definition
    -
    -
    - Method - serializeTypeDef -
    -
    - -
    returns a sample serialization of a given type, or false if no type by the given name
    -
    -
    - Method - serialize_return -
    -
    - -
    serializes the return value from a PHP function into a full SOAP Envelope
    -
    -
    - Method - serialize_val -
    -
    - -
    serializes PHP values in accordance w/ section 5. Type information is not serialized if $use == 'literal'.
    -
    -
    - Method - service -
    -
    - -
    processes request and returns response
    -
    -
    - Method - setContentType -
    -
    - -
    sets the content-type for the SOAP message to be sent
    -
    -
    - Method - setCookie -
    -
    - -
    adds a new Cookie into $this->cookies array
    -
    -
    - Method - setCredentials -
    -
    - -
    if authenticating, set user credentials here
    -
    -
    - Method - setCredentials -
    -
    - -
    if authenticating, set user credentials here
    -
    -
    - Method - setCredentials -
    -
    - -
    if authenticating, set user credentials here
    -
    -
    - Method - setCurlOption -
    -
    - -
    sets a cURL option
    -
    -
    - Method - setCurlOption -
    -
    - -
    sets user-specified cURL options
    -
    -
    - Method - setDebugLevel -
    -
    - -
    sets the debug level for this instance
    -
    -
    - Method - setDefaultRpcParams -
    -
    - -
    sets the default RPC parameter setting.
    -
    -
    - Method - setEncoding -
    -
    - -
    use http encoding
    -
    -
    - Method - setEndpoint -
    -
    - -
    sets the SOAP endpoint, which can override WSDL
    -
    -
    - Method - setError -
    -
    - -
    sets error string
    -
    -
    - Method - setGlobalDebugLevel -
    -
    - -
    sets the global debug level, which applies to future instances
    -
    -
    - Method - setHeader -
    -
    - -
    sets an HTTP header
    -
    -
    - Method - setHeaders -
    -
    - -
    set the SOAP headers
    -
    -
    - Method - setHTTPEncoding -
    -
    - -
    use HTTP encoding
    -
    -
    - Method - setHTTPProxy -
    -
    - -
    set proxy info here
    -
    -
    - Method - setProxy -
    -
    - -
    set proxy info here
    -
    -
    - Method - setSOAPAction -
    -
    - -
    set the soapaction value
    -
    -
    - Method - setURL -
    -
    - -
    sets the URL to which to connect
    -
    -
    - Method - setUseCURL -
    -
    - -
    Set whether to try to use cURL connections if possible
    -
    -
    - Class - soapclient -
    -
    -
    soapclient in nusoap.php
    -
    For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded.
    -
    -
    - Class - soapclientmime -
    -
    -
    soapclientmime in nusoapmime.php
    -
    nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
    -
    -
    - Method - soapval -
    -
    -
    soapval::soapval() in nusoap.php
    -
    constructor
    -
    -
    - Class - soapval -
    -
    -
    soapval in nusoap.php
    -
    For creating serializable abstractions of native PHP types. This class
    -
    -
    - Class - soap_fault -
    -
    -
    soap_fault in nusoap.php
    -
    Backward compatibility
    -
    -
    - Class - soap_parser -
    -
    -
    soap_parser in nusoap.php
    -
    Backward compatibility
    -
    -
    - Class - soap_server -
    -
    -
    soap_server in nusoap.php
    -
    Backward compatibility
    -
    -
    - Method - soap_transport_http -
    -
    - -
    constructor
    -
    -
    - Class - soap_transport_http -
    -
    -
    soap_transport_http in nusoap.php
    -
    transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support
    -
    -
    - Method - start_element -
    -
    -
    wsdl::start_element() in nusoap.php
    -
    start-element handler
    -
    -
    - Method - start_element -
    -
    - -
    start-element handler
    -
    -
    - -
    -
    t
    - -
    -
    -
    -
    - Variable - $timeout -
    -
    -
    wsdl::$timeout in nusoap.php
    -
    -
    - Variable - $timeout -
    -
    - -
    -
    - Variable - $title -
    -
    -
    nusoap_base::$title in nusoap.php
    -
    Identification for HTTP headers.
    -
    -
    - Variable - $type -
    -
    -
    soapval::$type in nusoap.php
    -
    The XML type name (string or false)
    -
    -
    - Variable - $typemap -
    -
    -
    nusoap_base::$typemap in nusoap.php
    -
    XML Schema types in an array of uri => (array of xml type => php type) is this legacy yet? no, this is used by the nusoap_xmlschema class to verify type => namespace mappings.
    -
    -
    - Variable - $type_ns -
    -
    -
    soapval::$type_ns in nusoap.php
    -
    The XML type namespace (string or false)
    -
    -
    - Function - timestamp_to_iso8601 -
    -
    - -
    convert unix timestamp to ISO 8601 compliant date string
    -
    -
    - Method - typeToForm -
    -
    - -
    returns HTML form elements that allow a user to enter values for creating an instance of the given type.
    -
    -
    - -
    -
    u
    - -
    -
    -
    -
    - Variable - $uri -
    -
    - -
    -
    - Variable - $url -
    -
    - -
    -
    - Variable - $usedNamespaces -
    -
    - -
    namespaces used in the current context, e.g. during serialization
    -
    -
    - Variable - $username -
    -
    - -
    -
    - Variable - $username -
    -
    -
    wsdl::$username in nusoap.php
    -
    -
    - Variable - $username -
    -
    - -
    -
    - Variable - $useSOAPAction -
    -
    - -
    -
    - Variable - $use_curl -
    -
    - -
    -
    - Variable - $use_curl -
    -
    -
    wsdl::$use_curl in nusoap.php
    -
    -
    - Variable - $use_curl -
    -
    - -
    -
    - Method - unsetHeader -
    -
    - -
    unsets an HTTP header
    -
    -
    - Method - UpdateCookies -
    -
    - -
    updates the current cookies with a new set
    -
    -
    - Method - useHTTPPersistentConnection -
    -
    - -
    use HTTP persistent connections if possible
    -
    -
    - Method - usePersistentConnection -
    -
    - -
    specifies that an HTTP persistent connection should be used
    -
    -
    - Function - usleepWindows -
    -
    -
    usleepWindows() in nusoap.php
    -
    sleeps some number of microseconds
    -
    -
    - -
    -
    v
    - -
    -
    -
    -
    - Variable - $value -
    -
    -
    soapval::$value in nusoap.php
    -
    The PHP value
    -
    -
    - Variable - $version -
    -
    -
    nusoap_base::$version in nusoap.php
    -
    Version for HTTP headers.
    -
    -
    - Method - varDump -
    -
    - -
    Returns a string with the output of var_dump
    -
    -
    - Method - verify_method -
    -
    - -
    takes the value that was created by parsing the request and compares to the method's signature, if available.
    -
    -
    - -
    -
    w
    - -
    -
    -
    -
    - Variable - $wsdl -
    -
    -
    wsdl::$wsdl in nusoap.php
    -
    -
    - Variable - $wsdl -
    -
    -
    nusoap_server::$wsdl in nusoap.php
    -
    wsdl instance (if one)
    -
    -
    - Method - webDescription -
    -
    - -
    prints html description of services
    -
    -
    - Method - wsdl -
    -
    -
    wsdl::wsdl() in nusoap.php
    -
    constructor
    -
    -
    - Class - wsdl -
    -
    -
    wsdl in nusoap.php
    -
    parses a WSDL file, allows access to it's data, other utility methods.
    -
    -
    - Class - wsdlcache -
    -
    -
    wsdlcache in class.wsdlcache.php
    -
    For backward compatibility
    -
    -
    - -
    -
    x
    - -
    -
    -
    -
    - Variable - $xml -
    -
    -
    nusoap_parser::$xml in nusoap.php
    -
    -
    - Variable - $xml -
    -
    - -
    -
    - Variable - $xmlEntities -
    -
    - -
    XML entities to convert
    -
    -
    - Variable - $XMLSchemaVersion -
    -
    - -
    set schema version
    -
    -
    - Variable - $xml_encoding -
    -
    - -
    character set encoding of incoming (request) messages
    -
    -
    - Variable - $xml_encoding -
    -
    - -
    -
    - Variable - $xml_encoding -
    -
    - -
    -
    - Method - xdebug -
    -
    - -
    adds debug data to the clas level debug string
    -
    -
    - Class - XMLSchema -
    -
    -
    XMLSchema in nusoap.php
    -
    Backward compatibility
    -
    -
    - -
    - a - b - c - d - e - f - g - h - i - l - m - n - o - p - r - s - t - u - v - w - x - _ -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/errors.html b/lib/nusoap/docs/docs/errors.html deleted file mode 100644 index 104e1de33..000000000 --- a/lib/nusoap/docs/docs/errors.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - phpDocumentor Parser Errors and Warnings - - - - - Post-parsing
    -nusoap.php
    -nusoapmime.php
    - -

    class.wsdlcache.php

    -

    Warnings:


    -Warning on line 17 - no @package tag was used in a DocBlock for class nusoap_wsdlcache
    -Warning on line 206 - no @package tag was used in a DocBlock for class wsdlcache
    -Warning on line 208 - File "C:\nusoap\lib\class.wsdlcache.php" has no page-level DocBlock, use @package in the first DocBlock to create one
    - -

    nusoap.php

    -

    Warnings:


    -Warning on line 84 - no @package tag was used in a DocBlock for class nusoap_base
    -Warning on line 1006 - no @package tag was used in a DocBlock for class nusoap_fault
    -Warning on line 1078 - no @package tag was used in a DocBlock for class soap_fault
    -Warning on line 1094 - no @package tag was used in a DocBlock for class nusoap_xmlschema
    -Warning on line 2047 - no @package tag was used in a DocBlock for class XMLSchema
    -Warning on line 2065 - no @package tag was used in a DocBlock for class soapval
    -Warning on line 2167 - no @package tag was used in a DocBlock for class soap_transport_http
    -Warning on line 3472 - no @package tag was used in a DocBlock for class nusoap_server
    -Warning on line 4579 - no @package tag was used in a DocBlock for class soap_server
    -Warning on line 4595 - no @package tag was used in a DocBlock for class wsdl
    -Warning on line 6445 - no @package tag was used in a DocBlock for class nusoap_parser
    -Warning on line 7069 - no @package tag was used in a DocBlock for class soap_parser
    -Warning on line 7096 - no @package tag was used in a DocBlock for class nusoap_client
    -Warning on line 8054 - no @package tag was used in a DocBlock for class soapclient
    -Warning on line 8057 - File "C:\nusoap\lib\nusoap.php" has no page-level DocBlock, use @package in the first DocBlock to create one
    - -

    nusoapmime.php

    -

    Warnings:


    -Warning on line 53 - no @package tag was used in a DocBlock for class nusoap_client_mime
    -Warning on line 270 - no @package tag was used in a DocBlock for class soapclientmime
    -Warning on line 283 - no @package tag was used in a DocBlock for class nusoap_server_mime
    -Warning on line 497 - no @package tag was used in a DocBlock for class nusoapservermime
    -Warning on line 500 - File "C:\nusoap\lib\nusoapmime.php" has no page-level DocBlock, use @package in the first DocBlock to create one
    -

    - Documentation generated on Mon, 26 Apr 2010 16:17:11 -0400 by phpDocumentor 1.3.0RC3 -

    - - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/index.html b/lib/nusoap/docs/docs/index.html deleted file mode 100644 index 90a860488..000000000 --- a/lib/nusoap/docs/docs/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - phpDocumentor 1.3.0 Manual - - - - - - - - - - - <H2>Frame Alert</H2> - <P>This document is designed to be viewed using the frames feature. - If you see this message, you are using a non-frame-capable web client.</P> - - - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/li_nusoap.html b/lib/nusoap/docs/docs/li_nusoap.html deleted file mode 100644 index 7cad615f6..000000000 --- a/lib/nusoap/docs/docs/li_nusoap.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - -
    nusoap
    - -

    phpDocumentor v 1.3.0RC3

    - - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/media/CVS/Entries b/lib/nusoap/docs/docs/media/CVS/Entries deleted file mode 100644 index e3935f8fe..000000000 --- a/lib/nusoap/docs/docs/media/CVS/Entries +++ /dev/null @@ -1,3 +0,0 @@ -D/images//// -/banner.css/1.1/Mon Apr 26 19:16:48 2010// -/stylesheet.css/1.1/Mon Apr 26 19:16:48 2010// diff --git a/lib/nusoap/docs/docs/media/CVS/Repository b/lib/nusoap/docs/docs/media/CVS/Repository deleted file mode 100644 index 63228ddc4..000000000 --- a/lib/nusoap/docs/docs/media/CVS/Repository +++ /dev/null @@ -1 +0,0 @@ -docs/media diff --git a/lib/nusoap/docs/docs/media/CVS/Root b/lib/nusoap/docs/docs/media/CVS/Root deleted file mode 100644 index 38e068369..000000000 --- a/lib/nusoap/docs/docs/media/CVS/Root +++ /dev/null @@ -1 +0,0 @@ -:ext:snichol@nusoap.cvs.sourceforge.net:/cvsroot/nusoap diff --git a/lib/nusoap/docs/docs/media/banner.css b/lib/nusoap/docs/docs/media/banner.css deleted file mode 100644 index 032b037f4..000000000 --- a/lib/nusoap/docs/docs/media/banner.css +++ /dev/null @@ -1,33 +0,0 @@ -body -{ - background-color: #EEEEEE; - margin: 0px; - padding: 0px; -} - -/* Banner (top bar) classes */ - -.banner { } - -.banner-menu -{ - text-align: right; - clear: both; - padding: .5em; - border-top: 2px solid #AAAAAA; -} - -.banner-title -{ - text-align: right; - font-size: 20pt; - font-weight: bold; - margin: .2em; -} - -.package-selector -{ - background-color: #DDDDDD; - border: 1px solid #AAAAAA; - color: #000090; -} diff --git a/lib/nusoap/docs/docs/media/images/AbstractClass.png b/lib/nusoap/docs/docs/media/images/AbstractClass.png deleted file mode 100644 index afa9d1d9261500c57ec37cff1de8cf43b31dbf25..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 620 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJbFq_W2nPqp?T7vkfZSaHJ|V9E z|NjRvPcK>oB;jC!uy7wgKahK+w)SFm^_jG^eUXv70s?k;dvAAg+Gb<3&cI-?g2GG& zh8_lnGzNx)iHU~;0{$Bt?{jhjD)_IizRSYmznt6_Lqnj-|B{khH8nS=tN#}e_{zt( zR#EXk2ggfJ&eakUK)aWTi~nF?_`tyMoPps!1H*L&hBwx{7GaqsHK2b=zCZk2F6c8jl1JVN5*@+%rr7PI}^11C*oaK4^xC05VCJK_3< zud|-<{@_}WT(>@P3->I)OHK!WY*;^8{ZU{D!{pbT`vks!nK+ee*>;`t+%u+Jea(8o vR5x-}=mldp!DT+b`?hi(nsMPiM;)`hf`a|hX9_^KGcb6%`njxgN@xNA_;dCz diff --git a/lib/nusoap/docs/docs/media/images/AbstractClass_logo.png b/lib/nusoap/docs/docs/media/images/AbstractClass_logo.png deleted file mode 100644 index 8f65c390e37b548578390c0bdbe4a4bc469c4d19..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1232 zcmb`F`%jZ+6vq#W@U{$S1TZXV4viCPx3q`=k`4L zo1#BJx0H}AAicqQU>vV%^^<9m|tWsIx<8LP>5;)!-8{5Ba8xawKa^8)JAwolYrP3xG ze;gi;N)W-psLCUuuq7;v;PILTf-XM)dx3ypvzvl~UU4|4;9xV4hpH34zB3F)V?aO$ zn|+nbCFt}9e}9{g&n%sOWyOknOy(?=N>C`M!zl`-mcbw}tb)O4@%Ek}kw)FzM%>+P z&dw7gQYD>^Hi$-;0kAkbTLCIOJjMZr0D1sUQ>kWvt0dArfEIuTfD>f$DGaLt_zu7T zPzaEN77pxLob%;x2CG}`xIIwL@5%qsVT}twSp0*)++a!sc%Q?K z`N@jCeTp+nwyR|s`Xqf{xt8ToY?#m#I3M+++}?TZyynf|!6(h%ZXB5YwRD&DpE->+ zQa?!d&ipfd^zwzIKtBJ~qLA$Mj4wHSb~mtdtP52mbBN=vTM#>mfmycxM}yu)6Bg^4@lw*?MFu3*Llv~ zTq;{9ldCeY*UL|oCB+&|W}C3XvTUffR~(q#WAaNg-nYFVl1oFwjfcGkWO1Lan7mWj zTHAk$B{{PsrhD+|_&Dv{Dq|lMERc7*{?yjm*&4fucG~As73P}JZF+xm+H<2#y7rxG zW9=q?%ZBwC`JJPAZS{(h+4A?WNris0W9rS3rW|*EzKH2={VP|ERZ$+~<|y91p2^}Q nm5>e}t(H)$%7m@A#{7td(X}C*54y81qwfI{akQvb7@z$w+j=f( diff --git a/lib/nusoap/docs/docs/media/images/AbstractMethod.png b/lib/nusoap/docs/docs/media/images/AbstractMethod.png deleted file mode 100644 index 605ccbe58e04d8f1462227f08369ef6d8e5d4fe0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 696 zcmV;p0!RIcP){TiMy!!e(Yf-7_V#G2iUr zLy?{{R5VTt!-qRXx-)@b&OX;WKp!2|aT>;Q#=c z001J6D>1||Q0X(T002sRN{?O-R{#J232;bRa{vGf5&!@T5&_cPe*6Fc02XvbSad^j zWnpw_Z*Cw|X>DZyFf=bPGA}SQ*^*j90000WbVXQnQ*UN;cVTj608L?Ia&K*AWNBd_ zMrm?ocW-iQb0AGvyOAm+0002PNklfMHT-Bv8QIEs=+ZPf$A`E>2c0)H#Sj$PWnk1p@>G(zLXgfTkY(YJ2o$Mf2{EX7&_@CL4Lsu zf=WupE-s;IY31eR9Y|p2?lbS+y#t0XRlwut?cae`au#?*7Bet#3xP1>rMq>1fPxAo zt`Q}{`DrEPiAAXlzKO|2`MIennTZN+nMJAP`9;~q3ceA$Cu*qx)rx`CIv1rTmSpDV zDTHL^rZO0q=o=X68yMf56y*d|@zK-8F{EOS?)lqMO%4*R4`(`@EDFELx7ssVZORd| zq%5HzwQYvlS2%cGPXFHD@~{05-~Gi~FPw_9ndsyAvUly>(4LD`8%wTUDBXMa-M%{6 zPZCGZ>%ZQD?T}l&!`s7tUKsOr`-?Wu<;}Q-LQ_10v>q37%ry4uIK**v&qDxa`a*R3vrciLZ8L}yD) oC>0QH(U@~sMxOVvCC6j?c~N@r8XNCh0zJ>*>FVdQ&MBb@0EQ=S+yDRo diff --git a/lib/nusoap/docs/docs/media/images/AbstractPrivateClass_logo.png b/lib/nusoap/docs/docs/media/images/AbstractPrivateClass_logo.png deleted file mode 100644 index 4e68f570dcb38ee67756ce2231bb5c38e77cce71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1615 zcmd5)X;Twc6n!ia!lFSW4Jkrc1`LPY$1sj(#lRGf?-K4OF)W1MOFm{ z#7YHOM1d45sY*y?RaT*Ff-H@QqJv;$S_hSqKJ6F#4|-7%db^6N%JBAT-(9*4o%q znVVM{8z&gwu}%jHt3R3eeo)zwv3Rdtk> zHkX%IR8+_c3#BLl`T3*C$>o`ujcI8r9xppPdr&AWJ9+Y=SiH#R_r%1&N)#a> zLp)xoP^jW?x*{TSg~HD8@MMu_J|N&;P>>Mv3@w(yNtt`_4MTNcqLq} z%GI^Y$LAr10vpK)47}svp&}CHWHOh_eLy0K*z8s^S%t^Hv9+Bb5@VQ58Hse=#f8OU z!IlG<%q?^C0ynn}bMx!Y&f#=AmrftS zz{0{8=0u^Owi_rERBYA2Al=^ngo6W*NbJU9H<8F%9BxBfdvV7O=!jBFYZ-~mv9x@x zsR@ORv9^X@%xG!71fbr~a2|np3MB<#5&&q>5CDxxWG?{FDLDW|y1G&TngOW$U}y!L z4IC~XfGhw62!t2_EEWrG`q&@}0J;|r4?^#yB9<>37+4Ughj_fi#GHz2*JLti8^rv7 zu=W9PsQxe5o@p5i8$iZ+2Ey)icfJp`vH6pmki>~-0U~xRPm~y%5D9!j!xLhUM@H~N zaUT4H$i&!$Xd%ugKz7d73jRgE|LdL*87kt(3UD0$@kl^$b|5%85QsCyT&R@#EjpFV zNxB$0{_dMGCPphR1jGN@&Te?$F)~u1_bJ2p$i%={-+*sD-;Or!G|aRk{(Pj}Kd}0H zUF|6ogUq)Y;t|lhxz(~t`eQ_RUoq1-eLFT?AP8E>XkA)fHggqi^htaeb*$=!t4&v9 zqXdHJ6|UE%Zb#CMmiE)kj0RV6b=%tA)%tp^#^=wTC2c+JUMy1oOuKh7@94hZJCoCG zXxaS2yJN@J#J33U`c+%lKU?M&7D~KdDwWEKxzE31HT2^+xj+0k>P|X8pxN^#{*0l; zJtxPg-}2sdI`*|*oC&-#etYRjR+M_H)cIG6TS0l{{gE&BmCtq~sCpA%t$SPejT1KZ zhgY7Xi)In=GWoXzL>tiaEgkbHwlbdGz1?uS;}g9r9hTrqerW-%FO1@shEpP|okxi= zPM5cWANffS>kbM9sa+||;ebojEN0yA9yek&f^IImjYjiE#g2W+w}g5r{lcI0tMbXg zn)g@NIfMqbGFiEQJ-TD7%ey9VJ;gYDC9Ao8C1ZwKf{tkXg^MxlZFwOFr^!}`w~YQU zd1uJz%3r<80}oBt)q-)m&*Rf}D)wh9&K|(^9IVw$da;MNxX>Y)R&c|pBRwc!j(BVG z1gV@=8A+_ZCz$E2gI1@w{L*m@r+H)9vC7|V^Qd`Hj&)~W1WkS8@5e~OE~BI%6gwn= zr*W1_Ms>6Hs`1daQJXsTMk+A3=fdt{i_4foPsd6$>Q%`uT3s3z34l|D0EF>7@e!`_b&3NDRW2J ly0$Y=SuS5{3YHYFR9bNnjKnZ6dJUX%K&SaqC6tg;{{UJF@sa=l diff --git a/lib/nusoap/docs/docs/media/images/AbstractPrivateMethod.png b/lib/nusoap/docs/docs/media/images/AbstractPrivateMethod.png deleted file mode 100644 index 41cc9f021734b6f99a723a687827190f2ae645e2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 874 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJbFq_W2nPqp?T7vk7#J8+1AIbU z|Ns9Flwsj#1(FdZp_~dll^g2aJA$}1LE7U51%YJBiZnqBFdculhYlSI zePQDH(Aed!@#@v9{V!U0T+*|>Vq|mPaK+-qHfL>(<z;@U}mwJ#*$v?ZZY|dku|t z>TYOnx7uW^y4kR+tIJ@Wf$1uBpzT)k?NpbUwl>yHs;P72AM0gsJN85x|f1nsNASyQ)C^V z5(o6cX?uI1gPQ_$zUt}*MFj!9qne@NAL##8Sy?4sMa%1B#506*U(#MpQkI2X< zc`N_t;!<)|IwT?j3`C$$JEf(8o_)r^aG!xeU0r=914Ae{#Jqy9S^>kcyd=mkm_blU z$=KK>G&D3VtsLmpnX6WvIdc~R-hlxyN~jN}hd;CiI)SsmBeIx*fm;ZK886+f`vVjd zD{+k|aV|AI6tkVJh3R1!8b9vC_gtf zB{NaMEwd=KJijQrSiv`9_e3ofpxV=(E{-7;bCLzbgr`rKFk#BGq?87R>nEOk>FJpx zR5!!H#V1TpU<$_pmPbOx#d~EhvfQbWT_nhq+3L!8?pK_VPC(<7l;G z*2$BHZrL7j2|sUR5%A_P)N-TQ+}Y|GrRdK zV81Pn)+>0zGnMUCiP|Spqc&^AG^y;y-0mPhgGJ5$HDs$bXTdY0@m-PJEq%`?TdG9A z`7w;w(EZ*psMAWc}ikt!qr000(rMObu0a%Ew3 zX>V>IRB3Hx05CK!FfuPNGue__LI3~&s7XXYRCt_C%4rvYKmdi|(V{3Sky0s2sVw0{ z3ns_0{QqBM)L8Df_c<4+W|ZRbuE?ptT;0z>z23f%IS}<{hVT1%ezB)pU1LBR7z?!4 zdf1$>0)?RM<32r|FI3$jzfkuMegO9fmRSW?+;gd{A6?vpl~i!EaT78927Y{aY)A+t zD;|Uj0{6%|rRRA`LWdbZAQrk%Pf@@U0ViwJZw&^h9P>Z*1$ZnRgm9bKlmGw#07*qo IM6N<$g0d3*MgRZ+ diff --git a/lib/nusoap/docs/docs/media/images/Class_logo.png b/lib/nusoap/docs/docs/media/images/Class_logo.png deleted file mode 100644 index 6f223c479a6c6fefab504deb84ab824d2e744713..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1600 zcmd5*`!|$%9DdQB9VXJcrO7tT6s8%5m)$T$<9->p85y@dE{&RXZA?TG%_2nB{k}w+ z>>y&K8JEf>)@4JEu#A%^x8$DGyKmbsyZ^yH=X@^b^L>8!JkR-jlN{|WrKJu_0RSLv zZDr;RS2P?)5fX5&yJ6f47l|;kH4TA4Ow2fl06^Tq(T-*gK@j``L!Zj}+HeO}zBX0; zizS_}vsy(-{E4`_@#vbdi+5fGm5%u5_tDdPtzuhX8qOmN&M4C`MSV{xS#?0cPBr16I(qS$$iDTJrh_s?O!p#8Hcm?#qi{w{Bl~rNTh%>k zux{n)ub}uDC~68~PeK9XP|o0n-x!qAyY4;;IgdbbU2Fb*kj)U}I`FAP@Yeb{ME(1wR2$S zCnkTzwDp5^%MQJH%Za}Qw(J@Sb}rN|#d2rO_**uOn}$u>PW5Z&eqR6^w@vF-EowJR z?ytf7pRC>Vy0c(Xy#ZElT5*>`i$x}PS71@3%2n|0Ix}zDrR23?#T;0%YIu7FmT6El z2Nu24DVZbXi)=HebP7bUa4>sWJ4d9GHAl=E1#c}<6Gn-tBHfgEozyY>%|Y;&c|yW4 zku#~q8L_(3kLUF3#=OE^@6x?8LyQ_DL=9+0x1A2}#zl7MT$&`ZUJ%&*xUeUhY#|}I zSN$R%Hj~6`#Raq+3+8G3+=%z@#4@=!KOxb#LH%4E&aW2hTXDiu02{99&efzpfNj@w zsn?)ZV`*i_sYO_)-;O(09;Z}d95XSL46I%8F`F_qo10kk0*qOr$PC`va_ndpbYvy|{2GJehB@IiF4o$aZ>K{XIGb8+#H_!n;6$gipr{DZ!g z{{X(k{~?NKvs$nq$xth|FaSV)_a(%J{)*XyhiJArolOn#XGi$37y!k`j};QcILGus zTQFISh!9pl7@9&C{EEZET*WV3Qx?OA%?t@f)0jaFfT*WU)YT?}FEiZ9@ONZdo1LLu zF7opRBrE~}wa)fRZUyglRb^$GxSn2Pg91AFWDunfuj18GhDIRNFt3KCaO!XG6XR&1 z28*aehm}!<>IiA_!AaB^KQ(Cz%0e>k6#30Eu? zFVRRBHaEw|$2T?#1h?9*(e0eWnYQm1Hr1B!cKi1WHPMl!yyD`-M9a|7P&O+nm`UBf zx#`hy(nM;f-efI&Ys=m~Cg$M5y1IM!ni-dtGv`C5w7MQkIj2kLO^;6v4}(M!NmW%J zqg~58a-sbR!Ac6xD=uAAR*p0`XIvs=o+nJC@!AI@u?L*fb6sg?her$|Pd^gJMy6kX zyY5=9aetfR0c3@|$s=BsOcoC~V2u4xFqbA7rlWwKMHLuT_IuR@E0N<;1(y5jqdklr zA18PT(&hJAnw&ypeXE(*jBty~<~W1~;xeKKN4`lJ4URwYtcit4vd9TpEPUi`Ko+~! znxf<=Hu;%f(yED6tR88cY6$)$k_sYx5+paB)@w47v$fpK_KbB9<-0uWWx$V$Y(nJvu4LwpP~GnArV?p7r+FCdX3sF>*+w zM8ps6Vm(S|1s-pS4xBiFG!w(f$;lxV0eSz9%%(EsBY==fcwRHDvGW Fe*-2SG_e2x diff --git a/lib/nusoap/docs/docs/media/images/Constant.png b/lib/nusoap/docs/docs/media/images/Constant.png deleted file mode 100644 index a9c6f28b3591824c0732239096324984401092e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 752 zcmVOeFFcbb@qHow`d0Y;LfV5s^(xaR!&Cux=r_h zK>yEkwuWTri~;WM?zB!GySux2ODz7(wV9cj|EC>kUsw2=N7!5`|NsB+nG)o;ng6pi z?6#AtQ5D^iW&g!kh=_>Y-QAyDGK@(hpKnk5)xQ6t5&Et%|AnnE%s?=+VL4bRGY=KmW3S?UXD3%7ojB4yZ&Sl06&8RVDFrLHC>x|F0|m!)5=D zWMNxY|E`aEUP|_}Os8!{fqZ!Ru{!;~Pu+z8ja4uIq=V{$Q2oE5_n8Xrj{yJCdF-7Z z_OC#eKOFz28iqL-|EnYarde7~M!IDR)?gv_vy8A<63$a7|GS6&yh+s0%m2(~=8gyd zoe2K4Iq#eo+=dGO)q%E8AK!Z)?wTmWSRMbM5&y4||I~k!LLndTsj>h7010qNS#tmY z3h)2`3h)6!tTdPa001C#MObuGZ)S9NVRB^vO<`klZ*65{X<;BnX>w(EZ*psMAWc}i zkt!qr000(rMObu0a%Ew3X>V>IRB3Hx05CK!FfuPNGue__LI3~&=1D|BRCt_YkcI#b zK`4U(M2Pz6Icht~3ql2S@>nhM`5YqHd=mvh0y@s|8GK1fN}j>Ix{QKA0Y9^hBqh%T z(^Rc&DK|!G1|1(GJ`i8dK0M7tpHq-QLoYCi2h10jNsn_^VK8(|g2;!4`U}LlFfznw zDp-HqkjkAq?C=KG<_Aoa(CHB9TlWKE$_z ijGSU(oWd#~?*ag}r7qqQ?+~c~0000;SsO~ttNgt@c?ITUy+H?~F1$qJv5 zrj%inz4BS|lBY2XpN7wU95Cg+N6)R&S-Wy3tx4&gXH|B=yx^o^#sQu9?QQ>K8~%sZ z{0}Jm@7e#puI6oK)~nE@m)?oj|A$=pANt%j?acp}v%f-5{aU(vY0a7Rz}r@CC;s>y z_~w2^f9i&*uDiZCoO5v6`rY`9vHRwCT`RgWmp`jpSqZe)c-0rXl`kw;yt7~a!fK~g z=)5OIi*oZ8r2!qIu*ouQW?EwBb;IdTOs3w|UZw3aUl-^?yPlho&DXT%Y3a3H_piCa zH_y(z`J!&~1--@#`u#SZWfuag168_I91G66);c&DuZkdK$q?W#UzIB6L*!=K%vvBTz%$TUpUjQPxsc+FV-7 zR7zY|e1`Pi6Tt84q|K9b~#>w5dpFQc%z_t$REF)G#$AI3{PO zi`#}?{&3@lPKQ}}C9A8dZ}IjAKfWk!a7giqTGl_Y+%GXPku##9bLwQK<5PFJZ+-_fA85GosxS7-Us$eq7dr0=(3bNhOU@OqP3*jGIQ@yq)Vq6&7M{#q z477Sr{(QThn~}}e&ZN!sueoC0eDO%k^aC-opNFK(Oq=OhcEPdW>{HKZz2YNN!Y4j; z3AV^N{LRk&iIdY~8yo$^9eXUQx0}^%F{pl^sd+`+YMoB)e`)Cta&kM>a@MPsK9Ml& z)7M|AkoTXLcaDa}VO>_ z%)r1c1j3A$?$-SQ3W}AuMwB=gr6!hS=I1GdWag$a7?|iA80i}r-<%ZX1XQ5_QW2b= zR#Ki=l*-_nm|T>fo0^iDsNj}alvYxA!qX>A zNlIy8vJMV5*3M3^SKHChH*MR#g{~aNJ_mfmqwk-%q}ar&_F&=i{FJ=+5=XdFicd7L z@bKuq?cMu$iKN7hJ&QyoB>wp5$i&=np1gX8$i&uZ%B&^(gI6I0} zGUVzNQK6O$8{S zC}qw=9fKWQ#zRcqIUjNk==S15ts}q2y)L~lP}(>_ogbmaoJrJ0AgwbXi6JhpDPFKT z9$x~a$ENK7000SaNLh0L01EH`01EH{Laa2H0000WbVXQnQ*UN;cVTj608L?Ia&K*A zWNBd_Mrm?ocW-iQb0AGvyOAm+0000MbVXQnLvm$dbZKvHAXI5>WdJZVFEBDMFf-Yb zT0#H-0HH}lK~#90W8iRC=0FAv99%)3!YBe-))JP&C<2Chw%iuNNCHkg-d5alQo;xU z8CL}X4_hHdm;k$sti6G8pr((nFjT%dS9ocX$5n$N$)Tp@>xCyk+k0?wOgH`Q@&JYcT)s zdE3HL%*@Q>)vf*e_W$H#w30>t^on|8F81N2s;a8ZvP6i8i1*uE-QC^)@Pqg0b?wn( z|JsUdXkPpC*^GEfs*66hqd1H2uT%f=o&W#;+=l<-g2$mxWdJZVFEBDMFf-YbT0#H- z0Od(UK~#90V{n52MNTM#0YtFI1j@(B2XI0KbfYa?T|L!(nVh{iK>~u&X4;-2GBUh+ zO#b|wKmqRrZ4q7|2-S~r3FdcW5R3`;1aU+4g;eeQ#5oya13hJAO+rKM?S)kNjI5;@ zxP3%G@<6_jL6VUZKZ6*X3`AZi%uqr{fsw(ANe{{o(+mk>VPxPm*V5M)0)jA)NMTb+ zeg-!Ib2&Lxsjy^C=6G9UE@=igP7RJkK126N2W6fJNk&ef)1_7Xj9k=&ZABS?e6Z)F u#ckM?93xmje28y3`Ng@o#2KYQ-UR?_sW14`Hh}s70000AMyVi9{#UaQ0r%7Fss&l*vy)E6e!K$>FVdQ&MBb@0CA5htN;K2 diff --git a/lib/nusoap/docs/docs/media/images/Index.png b/lib/nusoap/docs/docs/media/images/Index.png deleted file mode 100644 index 6558ec393a6e0b35fb7776a52b4ca9c10da0d5c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 584 zcmV-O0=NB%P)sGc1s$KlTB|5tUFl&jIZ$KRg6;GCqm5-wl6(B`4Q;1)J+i=@-=`2U5V zz0~Rd#@X$9lDq;jjf$eZgrL)or^gjMgq*e3yWRhls?|-6=3oE-010qNS#tmY3h)2` z3h)6!tTdPa001C#MObuGZ)S9NVRB^vO<`klZ*65{X<;BnX>w(EZ*psMAWc}ikt!qr z000(rMObu0a%Ew3X>V>IRB3Hx05CK!FfuPNGue__LI3~&s!2paRCt^{$?Fn3Gxg6&+v4+fftY`;pyTS tQgJK!NBsYWhyUvpj=8p5Ib^(%U@*zon(m*SoDEdN;OXk;vd$@?2>{+EE2IDb diff --git a/lib/nusoap/docs/docs/media/images/Lminus.png b/lib/nusoap/docs/docs/media/images/Lminus.png deleted file mode 100644 index f7c43c0aa3bebb499e86eb744b1e47b9a9445ba7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*!VDzYUPT51DfSXiUsv`EJiLsmQh${X`~(Vd z7I;J!Gca&{0AWU_H6}BFf(8LTA+A9B|NsBf`>KHqVn8Lk#c`lIrjj7P;QtIyw;Ol? zc?O;?jv*Ddk_A|pTm=*lC~zFVdQ&MBb@0OtiQr2qf` diff --git a/lib/nusoap/docs/docs/media/images/Lplus.png b/lib/nusoap/docs/docs/media/images/Lplus.png deleted file mode 100644 index 848ec2fc3bbaab6345864c303684ff8a86559cfb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*!VDzYUPT51DfSXiUsv`EJiLtR`ZJfMMF533 z3p^r=85p=efH0%e8j~47L4yFF5LY1m|NsB#ebqn)F`$y&;y6$pQ%R6t@PCG<+YP*c zJX22>$B>F!$pS1)t^$e&6gZd#)XV}^6#`leL>0XheB5$;*x1}$U0qr4a0#d>%paztiFSddoE z=FO+Zs9v~B@b&OYf=WY?JVJfcJk32QO)AOb$urFVKXE`Ry)jqsH71)XJB8YEt>{GE zGvwvuGqv|cy!A6?%sp|-T8&j?o?bnP-A{*1r^4t+dqpBkBPV|V>IRB3Hx05CK!FfuPNGue__LI3~& zAaq4obW?9;ba!ELWdKcKV{&h8Wn^h#AVz6&Wp{6KYjYq?Si6xbBme*ayGcYrRCt_Y z&;kMn2M1Xdeh6R)4Ab%Sw6|x9hYPq^SqVCeF?quTBwVb*o#mC81mFUy;m%?#?D`xC z0cWuYe|IAv4`YZxESp$_l#sZsh-s)UL?ALUMqSb?I@nP<)JGU7U}h%a#vI_K=%}q7 zq~RmZ$N<)8;N{4}qYx4zCu$87;NdY>VCC|)P=g6*o7-s0FmMCSfC?zsMKS0(@xufx vP5c-vI3ex;lft~dN-&p#Ny9iND4!ny)Wjn48}#yJ00000NkvXXu0mjf>`)kw diff --git a/lib/nusoap/docs/docs/media/images/Page.png b/lib/nusoap/docs/docs/media/images/Page.png deleted file mode 100644 index ffe7986ee2e78f7079d6de1a13ef29bff125f7a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 592 zcmV-W0wTQkb(FJYg{r&I=J@>oPidBsr@_|i|DM0#0xyTVySs>p zi0u&l@7S9O=i(&oFz-*}d|5-wk#ve_0k zZi}ST)an1e-~WcE$O18qgrL(EJcN#?$DzRBm8#XK#^imQz1B}9Gynhq32;bRa{vGe z@Bjb`@Bu=sG?)MY03dWlSaefwW^{L9a%BKbVPkS{ZDnL>VIW3na%FdKa%*!SO<22; zDkJ~^02XvbSad^jWnpw_Z*Cw|X>DZyFf=bPGA}SQ*^*j900025Nkl8X^a6$`;}MU&lC(fZYGN)*U*T&WTYe`t|6?P&^gvL>{}6e8nl zLI{`JKlCFG|LqoMkSE{iD56H;IN0Sraje`6bqbr=>+Ac4L(v&iSUtNMDLgY2KvhT^ eCV+sH1<((?kR=WgbuC-~0000)GO-L0AERF6v)dP%qbhFs5=j^@`6F?l_(@;?;SYFPR0 zI9jbQwZey3=y8ba9+c^JAk$@k`bNJ*XM8mL<6q0r!V+YD551g+rvHRYW=KB^jl71Q zyjUEXf%<=gv{N57&;Ray_CaNWG~<7$j7xBl@^MHtX718|yz^v1Gcq;sXrgWOL-%8| zeAujcX!zyfo16VFq#9G>J(EnWtL=RyR-0NB6V)oy zRmEie9Z=A1gd35_HMMe(FE?E78WVI3@nv91+wgViUAV!rpFqJ)Wl_to!seceCS_?; zZ;4o$E4k0B*A>>Q@@^>L31o}zmDNbO)e5c<%)AP+E5P*1yXjXRr0_e>m1)_fP3L*4 zq>@`n#eK};ri8-Yv`eDs;=aU7t-G*r(;{fc=?O5OKSe$`R3j_d*nP9?x%J(%fQEH%67mU3Hek2mE8BI_V-TD<8{d?o6-ef!PG`p%c&+4{j^aUgcH zPg_HSd3If0jjtfvXN7{Bm9@0` z{!FFF(*y6@p7PEXiOALIn)UNaUZG?FMfe@usLHF4iAJOOeEx9SoR_ols++f6a=J|s z5ggQNwU#-2UgKh&U;x$U?l6kKlg`fF$Kh~T&%}(*P&e;MzM$e1iDYH5)s7SzdNQ)O zW|LFc9?jNAIaVEr_>4^{Y;|6Zw5lrHumeb(iS9?J(ExtAVJMHD8w=kA5FA7#v<61y F{sZ~k(bNC{ diff --git a/lib/nusoap/docs/docs/media/images/PrivateClass.png b/lib/nusoap/docs/docs/media/images/PrivateClass.png deleted file mode 100644 index 470e6d5684f29e52abb36ee6036a4d0b717f92e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 790 zcmV+x1L^#UP)WmEhNm^6>N2zOCt|Fuvb2MPgIr%?-{0R%gxJKy#3oLoEQio1TB$RW z>}rOS@9*z3X3RRU*Z=?jNYVd(pWkzHbE2lGGqCn7nbbf>Stx6=M8@%WtGpvWd{9$d zW@ctxl-^f`)gwrPNl|4eO^Yjd!Y3yuC{eAu(Bd|2#VxYmFkYoDiPgf`>UMyN)z#HS z%>A{^=P{-CPSgKgi`geqs99WJM7{YbYtFRD+-aQPBu9}dn9Ep?+$&_jF0SJ+!SP*W zX)~JcM@?QQa<)}jTP=IfF8)Ib00009a7bBm000XT000XT0n*)m`~Uy|Aaq4obW?9; zba!ELWdKcKV{&h8Wn^h#AVz6&Wp{6KYjYq?Si6xbBme*a7IZ~ebVG7wVRUJ4ZXi@? zZDjy3G%qkRFEBINl3GFl008buL_t(|oMUj)Q(}VxtyFm#HwHbAypTdL(6@<=mvd%N zQkP73cXv}CPB4cExH8Hr zR9dNMl-WZB*f~Ua3V1C`?H#MY0*R^toKm_>URD+2h7KTs7*P=&Pi7Gj&r(CfOje+P zFt?7JoTp{7PL{MZM8L#S&O(+`PDicC$POfs3ly+qPy-6^M{5QG1%xD+<>aCiZ7tPU z^H~Lf0(?n|mdsYno>sEH;pIUBhYhhT*-1^kj&-m>@4F3035e9 Ui&^Ep{Qv*}07*qoM6N<$f)e~=1ONa4 diff --git a/lib/nusoap/docs/docs/media/images/PrivateClass_logo.png b/lib/nusoap/docs/docs/media/images/PrivateClass_logo.png deleted file mode 100644 index 590e00640baeca2f541347cc1c5067c255030bba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1836 zcmdT^`&Sa!7N)T^!|2#(lU~J2d<$xV*reb%if{uGAB2xcCr~6EBoS~N3`R%8oA1Z9 zjI?x2^HGvbVw2{xv>MSY!8DVxe2kTOO|w!{=Jd;~yVm^+?p|x3z1KPWoOQnaedlBa z1?)G}hv`Eg5JNJFKm!r}(V==^BvfbjfuJYElj%?>bo^=HBn0wFeULw$sMG1d%HLKu zxBzkwfr3JzfTUsI<@w&3l8(u&mT`$j!bTAk>Lj{8{G)6;Xhe<^xY#~9JI zx3?b|Ud!owO;hVQDqYy%2IZmdeCu=a(B{wGi%O+3M75INIh1s3f~0znAN+9Y`W*B2 zYFSHH*zMJT-gTef-zyY~$j*1CuC)_;*9A8gz*V^|uYx-Nq_)2&cB}^f_O_;`#Wz=Dmm0WGd_5vmZPn;Z@Y$?s-xl010-LVn-j7_WpUmV?gQ z#@BnsDCw;D-Mk{e0y63*g(>ik5-}JIM`rWR*c|KVbAjP(z>W_i1`*!8_i(%|;{uGC z=1*tRXf#K<;z00WJ9@QwgxE5?z#+KKmR3oohFArc09Du>_{D}=45RaiWSTAcoE0S( z@N0$7w#FA*`D6m3Ej=?Wu_-VQ{;qw(T^K2l4WQn_MPTm22Kq5Uga8S_V6a;oN&P@u zQzBZxL5Q(6h7b}0@Ff42os>5;w6y`Ds8kaR|6@St|4;V1Z*vQP`#GOQZH!5*#rSH(*E!w%R>-W{9c69(j2#gn5S*Pqeeq^v zzkL7CbksY8FY>ZH_y6!U8jYr2bRG(APR1>F*_YGqtw{Yg0`Hk*&pV0b&!3yS)ld!| zn-f5urNP6I+p~<`D6nDn7fewiT>32o*H`kl6t(#{?$F=*N%E5432(0YCHDnRmtM{%F+ZC$WQDv++M6`c7mUI8vfQsyf=ACU$>$DI+n##uKp{O$Xh-}+|U_|mnTX|Q;*F+<{u+T@*V3jZ|K z&~S*U?dR?=dYp2%b8#zklwvgU3(HA5ZJ*GQU#Pd#ydxV9O*j5)xBk^zxanB&!TRJbl+-sIOMSY7+S!-!q6vOvO6U|hJ<$tucw(e2>IopzU zf2Q#2*c**a=_FsApXeEHs+lu9>UQWW!OhK72-@dJnVPY@2A%?hObj3>@XYkT0K34m Aj{pDw diff --git a/lib/nusoap/docs/docs/media/images/PrivateMethod.png b/lib/nusoap/docs/docs/media/images/PrivateMethod.png deleted file mode 100644 index d01f2b314b973da7318cdb98a71a326f383e5864..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 918 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJbFq_W2nPqp?T7vk7#J8E0(?ST z|NsBrx}lMUpA{(2slZdYq28zK9FXna5yY)2U{iVAD08bu#A0RNsVOVc1TDmPHTipb zdQ55!GnYS0Uh*_%;nVQBj{~OMck8;@+}kAODC6$#?$PP#(BP7mmKGHirRd(Fy|8-qYX6HC z9+&iNuNW;|w!-GTq4$nAHfL?^c7FHT`aNmOeB(356Bn%kIv{R`xBWrwnKNf)W>PYjD}zLwkAT3uZo(G~1G(Z;{#vR6}oNlA%PpSD}U zF^_6j=PGB;3=*#Y$WwN}P*Q6H7Al^Atid zb5j`%O!N(m^bL$}PKt5@s!#x_2+mI{DNig)W$;Z*F3QhMP037DaLX)8Ezd8?E>`f3 z*ga881*rD2r;B4q#hhdTK`}8wQQ_$c$qh{j*4F9e`#W^>b~G%TwQJr~Z#{D#1vl?l z|LazJX0WSGSg|%ebAsU9Bi!N!<-8wzw);;`Y~fl`b(`(zvrGw95l%-IFCTC1&!2ls zzwGV0^wWWiW15+nU*5!-t};9e3k&TQp8P2% zX10&@>Zv(AJSVl5iLPpE{gyxy^(5I^ sFWFixmIS`k36rN!*Izp!t?eTtSH52M{Yh~%f!<^AboFyt=akR{02;ETy8r+H diff --git a/lib/nusoap/docs/docs/media/images/PrivateVariable.png b/lib/nusoap/docs/docs/media/images/PrivateVariable.png deleted file mode 100644 index d76b21d4e9e8656a68989f007945ab14507ae23c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 772 zcmV+f1N;1mP)%f|KD9dx9b1xbjG4eNtEH2jam85a{u&(X=GITZxLbNk_B|L=MK=xa7(sn)kg@8o`zfK1-9S*@a5ux7 zfmfd7&Z|n=(z?t5000SaNLh0L01EH`01EH{Laa2H0000WbVXQnQ*UN;cVTj608L?I za&K*AWNBd_Mrm?ocW-iQb0AGvyOAm+0000MbVXQnLvm$dbZKvHAXI5>WdJZVFEBDM zFf-YbT0#H-0Od(UK~#90W8e{Sh>wpK_v7H<0s#g#e~U6rcWa$YHYh)|I4&;C+*d}O z2f|lomMalTR8dirW#a+!op`m(q>74+J*{+kKztWlvm~$d^mHFbLpC7aKvFO=TL8$- z(9YH4VPIntQ#1*-Nlnd2bB@(uW8hJbF68FUi^)(>aJDaCV_;(~R6mrqkrNJ-9N zW6+HbC{^VT@L*JM&I(uJVNf@UHVOzZ($7!fbQ1-dZx^5&WvUzCEm6)Q&B_DjGcf1| zBm@>j=z`qG8lcY2t!~7v&IWNmtEDgym~unB%LM?}VJts-{;Z7v0000H> zJR*x37`Q%wFr(8NlNmrkwg8_H*Xe!L|Ns9N51QZs6k#d}@(cdY@N~O@7mz3J>Eakt raVz;p{QriB|LYZwxwcz9n9R-~pRXx?mgVYJpb`d8S3j3^P6#nkpi;(?AirP+hi5m^fE-m% z7srr_TgeFwOpI(f46|1#2yiGY`Di?KiU>FVdQ I&MBb@06e2A@c;k- diff --git a/lib/nusoap/docs/docs/media/images/Tplus.png b/lib/nusoap/docs/docs/media/images/Tplus.png deleted file mode 100644 index 2c8d8f4fd38259b2ef70fc63fad505fb0a0f55a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*!VDzYUPT51DfSXiUsv`EJiLtRLI=-jc>;wv z3p^r=85p=efH0%e8j~47L4yFF5LY1m|NsB#ebqn)F`$y&;y6$pQ%R6t@PCG<+YP*c zJY!E6$B>F!$pS1)t^$e&6gZd#)XV}^6#`leL>0XheB5$;*x1}$U0qr4a0#d>%86hy4NT6+w`tp00i_>zopr0L}p{>Hq)$ diff --git a/lib/nusoap/docs/docs/media/images/Variable.png b/lib/nusoap/docs/docs/media/images/Variable.png deleted file mode 100644 index 8e820193cf930c4147eba542a1b50626933d1f42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 688 zcmV;h0#E&kP)ugtEVnh;=iW%reFK|K(=fyleQ_jJUz6HFV9ct*geON>7>N>(GgmfJ|kL+1=gU z^~Y`c%U_K>y!eySuyp^oG^8 zOJ%3#Pt*VAzglvk(fQzS|Kx&gliM$y+%{plJI?=wq~ZVfjLxV|_|0oEwD7g7kJ`IY z``=&x-kSgDYyawSp@vA;vQq!uhw#*m-@tNLp5*`PleCyn|MHYq)&I_`O8L%mFH&Tq z00009a7bBm000W`000W`0Ya=am;e9(Aaq4obW?9;ba!ELWdKcKV{&h8Wn^h#AVz6& zWp{6KYjYq?Si6xbBme*a7IZ~ebVG7wVRUJ4ZXi@?ZDjy3G%qkRFEBINl3GFl007WQ zL_t(|oMT{NQ!(J+;Bd9(Wn%#W1{OIVrx+F&;*6wS&87O>I`iFMG>&~Wn?kpl^s3aTqPC~9aZgzBhqu>l3V zEJEUe@?l}Z!7lo83@mJN_9niTy1Jpl!gdkiKmisO)({&oUzpiX1}q>a${hye3fnpI z39x|#*m&f1fLvyFNkfn=ASHU{Ea4lA_OTmCm4hW!rK?49w W#UB-s5zQI^0000(x0NIF%{nuT>i_6Z|J+03z&LVrQvdj0nPvbd zPMvIEmeZ?!4s&x# z#i%Uo#W*vP>T-Bh-n}vA&qc6+7`mT2TL1t632;bRa{vGe@Bjb`@Bu=sG?)MY03dWl zSaefwW^{L9a%BKbVPkS{ZDnL>VIW3na%FdKa%*!SO<22;DkJ~^02XvbSad^jWnpw_ zZ*Cw|X>DZyFf=bPGA}SQ*^*j90002ANklU5Ub z)J&2>v72qTTu7E`nx@t2xdQKkZtdZYg4lY+yP)e911YGU#WzGE3Im~vZA6xzk`9>4 zNL8_RMr5ZhnC39*aq{=8RR=h(7tdcVhw%9H0)imQWkC?GbCM*z2n^6y_rKc*n=K%t TSg55|Cs*qzIWRJ6ld^s^>bP0l+XkKHvAUX diff --git a/lib/nusoap/docs/docs/media/images/file.png b/lib/nusoap/docs/docs/media/images/file.png deleted file mode 100644 index 0bb2427f8afe94b50835b0a6fb2f7fc4b6624bb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 462 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+o!2~3GGZMc6DV-A6h!W?b)Wnj^{5*w_%-mFl zkkV8IBTEIZ#5@Hf0|O%FdgViBVQqh^b}u-UUD* z&H|6fVg?4j!ywFfJby(BP>?0v(btiIVPik{pF~y$21Zp+7srr_TgiX^|F>tp*udH$ zEiL_V#ftUo-3uDh%uP)G{Qt|SZB_7q!9$E~2FI`q8Re^|Ns4w54;**JyG{r3reJX3bz{Zf3vmrZqg`n}6P+S5*tz>i^H* z#2~u%W)Z8#mr%xxhMwd+SvmjaL%%Odb!ew<(5(2Ban^6jjOpAT8-5&KS>(Rw-29d% zNdZfFap?uEMT+k<(v+DOT$Z%I^ZS1lw?N{?lj=*DIus0-A5UO#>EQ|b(2vWFmuh=~9H|IVo^qIey?Dz1hsy_{P4Pvu|$000SaNLh0L01EH`01EH{Laa2H0000W zbVXQnQ*UN;cVTj608L?Ia&K*AWNBd_Mrm?ocW-iQb0AGvyOAm+0000MbVXQnLvm$d zbZKvHAXI5>WdJZVFEBDMFf-YbT0#H-0F6mRK~#90WyotAfiM_=;n!)RO))lyYKg9G zDu)jI|9{59Wq7{b4-9^S|1r5?yt?|k_gEL_vSjsQJ~o|}aLiJr)OMPgdUXK!BBdrI ziX117J(mLBNUinDT$y2+3p0|WwfAs4W|lcJ!*ci>ABPQvf>`e66oz{@WlRWx5Nh&6 i1*3pkRRDgc|J5D1CKP}NM>^*K0000|Jy16 diff --git a/lib/nusoap/docs/docs/media/images/function_folder.png b/lib/nusoap/docs/docs/media/images/function_folder.png deleted file mode 100644 index 8b3d6e3b12902fd6de044496082464dbc7639d42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 605 zcmV-j0;2tiP)|{;@VQH zutK?#8|2oVPNX5otuVc-H2>T~`qMo_z!(4RRPW0<*~LTu^jkBj5P!Tt|K&_$wm39v z5ILL=BqI z!r&0NoVJJLDxgp-+TMLq>XzlVuBikpI}FsMP+>!akcx{yaKxWv;lIWQI-(jqRCU$Q00000NkvXXu0mjfHW&%O diff --git a/lib/nusoap/docs/docs/media/images/next_button.png b/lib/nusoap/docs/docs/media/images/next_button.png deleted file mode 100644 index cdbc615d994890b8d3b5ebe89d442ea1d0bdcf33..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 657 zcmV;C0&e|@P)>%!0InVFe0X3Tk++2-cv|NsBJy}eg}(|db+t*x!g)adv3 z_j7Y|rn=z0$>ZMM-tX`4KW@&Ajg7^{#b#z^wY9a6sobTdrOeFC+TiVjgM-%A*0aLm zTwGj+qT6qh*h+WM*WK!7W@ee0nXJF&WQx{%o7>so?BwU}l&#?3;^@xa?}MP(t-ap6 zEIdd6000SaNLh0L01m?d01m?e$8V@)0000MbVXQnLvm$dbZKvHAXI5>WdJZVFEKJN zFf-)xbMgQH03dWlSaefwW^{L9a%BKbVPkS{ZDnL>VIW3na%FdKa%*!SO<22;DkJ~^ z0ZK_kK~#90g_GNIgCGzd~1b@PXAis>##hF-Lcwks_T5{Gt1=G+~a%dFwQCnQZU3J+k?=iHfkBIVqw%X0=b%mMM4MWsfC|3Za zJLI<3MRLMm2C;EFN?uzwL|DX3a6V)!kcPBr r4(}qx0<9ZuvwaL3$t_-E{1p8KSMoIIFM}#&00000NkvXXu0mjfmFG8p diff --git a/lib/nusoap/docs/docs/media/images/next_button_disabled.png b/lib/nusoap/docs/docs/media/images/next_button_disabled.png deleted file mode 100644 index 4a11780fc0ec50dd27cdb6a52f863c511e32b61a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 543 zcmV+)0^t3LP)D z03dWlSaefwW^{L9a%BKbVPkS{ZDnL>VIW3na%FdKa%*!SO<22;DkJ~^02XvbSad^j zWnpw_Z*Cw|X>DZyFf=bQGA}SQTlLsPeLfOt#LNVQ}_yWVA&J!XM&=yzgAag0bSrwNq7QKuW}AeCmE|^Nojv;1W49t( zJ^R_7npd}q|9AEYBEEOSPL(b=(wtUnF~5x!^#c9rjMvp>dVHd>fI6h^x!+-x^4?w{ zA}`WpEJtxdM>gE74H3rQb1zDxCZhMp#IYTl92jdPHrzr4kKJTmn+Eji>=$zWWK{du hHd63A_=WQ``UAH88gT1vi|haZ002ovPDHLkV1oT`@4^58 diff --git a/lib/nusoap/docs/docs/media/images/package.png b/lib/nusoap/docs/docs/media/images/package.png deleted file mode 100644 index b04cf566d4ac41fa95f87664cf65325cc51e8a64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmV;N0%QG&P)t@djQ|x-^8(p z?4%BxbRnvSIo8(J;;cKFW&rs3_^P0a=H}+Wz`&@4HsP26zocrIZ4l3l0QR&iRXPBo zdnn+jGIdY@nPvdLr+C=OsEk?wl583Es}SUx0Hl8}w3Siws0*g0p<_e<_q#u(c^k{N zhsBHlt8)OYia^7{zq@__-VIW3na%FdKa%*!SO<22;DkJ~^02XvbSad^jWnpw_ zZ*Cw|X>DZyFf=bPGA}SQ*^*j90002jNklc}6)3g8( z2ru$H580mZyrWAbSccU12f~7K5mUsGBX6FN7o9)y4In#v$>W9q0000@uL8oa~j{sfyu2e|KUjW+DCy{0JN1+^UXT2cmT$oA=$Mq|M6Jhn+c_M3;+0E zbx;8R*gvs`8movsnPvdrmjLt9Kjg6{xsNKVeGbg7FZ<$8{qAY-)kDUkCzNLg*TZiA z)ja?7TfLMa+qE&-lK}C{I^?=9yq74~zG|$36Zh6a^rZm*+(ZBWW~z4x;hqqmcOiRJ z0IiEc|K?4LUIG8;Po#Y-wvr&V>IRB3Hx05CK!FfuPNGue__LI3~&Aaq4obW?9;ba!ELWdKcKV{&h8 zWn^h#AVz6&Wp{6KYjYq?Si6xbBme*aqDe$SRCt_K&07n zYC8yeE(c9}CP^I;-Xj?!ixGY5~lHzpft}vlT9I`brT10000%q?FnVFe0X3Vv2q^)rKP2vv)}0J@jq_P*4*ihjg4kzX1%?=#l^*vtlzDzt>WeD%*@Qz*49dQ&}@*_ zgM)*ny5P~$Sz@EU>hb z00009a7bBm000id000id0mpBsWB>pF7IZ~ebVG7wVRUJ4ZXi@?ZDjy3G%qnSFEBIY z@^kV4001C#MObuGZ)S9NVRB^vO<`klZ*65{X<;BnX>w(EZ*psMAWc}ikt!qr00BTr zL_t(|oOP4!R>L3+K%uvC@aN(<}}S| z_cY8cJz7aQY#zo&M2jq~x36itf~8liMJ`!c@Asvy$I6;i&)Dnru()HiB+edazpMKd zEoJN8-)<(BGm@V>Kss~sJD&cma7A&3Rf z-i?ioW@cust*yny#e;)`TwGjcW@ee0nN!N#@Bjb+32;bRa{vGi!vFvd!vV){sAK>D z03dWlSaefwW^{L9a%BKbVPkS{ZDnL>VIW3na%FdKa%*!SO<22;DkJ~^02XvbSad^j zWnpw_Z*Cw|X>DZyFf=bQGA}SQx z*6k)+-YhrkG_XnH4KgoalbW`Y#C%zLMG(A8#WIe0Sdy)s;aR#>iI`s&ukbi9->Bn; zl^kv0>?j`lHcTk$X~oOxj`mj&)#BNTkGP5zKdfml{jyB_s;gQ~-J%yw(;cg&WqD+e z@4Tv&%scxQ+Swu0bZj8*=8QhlX_YI61C}V0RhrpeSIKn$X;_d%y$~5a%u?9ODEgSKg~J500000NkvXXu0mjffsXN< diff --git a/lib/nusoap/docs/docs/media/images/private_class_logo.png b/lib/nusoap/docs/docs/media/images/private_class_logo.png deleted file mode 100644 index 590e00640baeca2f541347cc1c5067c255030bba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1836 zcmdT^`&Sa!7N)T^!|2#(lU~J2d<$xV*reb%if{uGAB2xcCr~6EBoS~N3`R%8oA1Z9 zjI?x2^HGvbVw2{xv>MSY!8DVxe2kTOO|w!{=Jd;~yVm^+?p|x3z1KPWoOQnaedlBa z1?)G}hv`Eg5JNJFKm!r}(V==^BvfbjfuJYElj%?>bo^=HBn0wFeULw$sMG1d%HLKu zxBzkwfr3JzfTUsI<@w&3l8(u&mT`$j!bTAk>Lj{8{G)6;Xhe<^xY#~9JI zx3?b|Ud!owO;hVQDqYy%2IZmdeCu=a(B{wGi%O+3M75INIh1s3f~0znAN+9Y`W*B2 zYFSHH*zMJT-gTef-zyY~$j*1CuC)_;*9A8gz*V^|uYx-Nq_)2&cB}^f_O_;`#Wz=Dmm0WGd_5vmZPn;Z@Y$?s-xl010-LVn-j7_WpUmV?gQ z#@BnsDCw;D-Mk{e0y63*g(>ik5-}JIM`rWR*c|KVbAjP(z>W_i1`*!8_i(%|;{uGC z=1*tRXf#K<;z00WJ9@QwgxE5?z#+KKmR3oohFArc09Du>_{D}=45RaiWSTAcoE0S( z@N0$7w#FA*`D6m3Ej=?Wu_-VQ{;qw(T^K2l4WQn_MPTm22Kq5Uga8S_V6a;oN&P@u zQzBZxL5Q(6h7b}0@Ff42os>5;w6y`Ds8kaR|6@St|4;V1Z*vQP`#GOQZH!5*#rSH(*E!w%R>-W{9c69(j2#gn5S*Pqeeq^v zzkL7CbksY8FY>ZH_y6!U8jYr2bRG(APR1>F*_YGqtw{Yg0`Hk*&pV0b&!3yS)ld!| zn-f5urNP6I+p~<`D6nDn7fewiT>32o*H`kl6t(#{?$F=*N%E5432(0YCHDnRmtM{%F+ZC$WQDv++M6`c7mUI8vfQsyf=ACU$>$DI+n##uKp{O$Xh-}+|U_|mnTX|Q;*F+<{u+T@*V3jZ|K z&~S*U?dR?=dYp2%b8#zklwvgU3(HA5ZJ*GQU#Pd#ydxV9O*j5)xBk^zxanB&!TRJbl+-sIOMSY7+S!-!q6vOvO6U|hJ<$tucw(e2>IopzU zf2Q#2*c**a=_FsApXeEHs+lu9>UQWW!OhK72-@dJnVPY@2A%?hObj3>@XYkT0K34m Aj{pDw diff --git a/lib/nusoap/docs/docs/media/images/tutorial.png b/lib/nusoap/docs/docs/media/images/tutorial.png deleted file mode 100644 index bc19737521daf3fdf8ba84693a6c1db275587a5c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 431 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJbFq_W2nPqp?T7vkfZXr^pAgre zprHL{KJDGRx2LCv!T8Mo|NkA*ZeG25wYa$W-Me?omMzQgdGzervomMTq@|^;S+i#5 z%$Y4ME$=`5xp(j0`I}#l9z7Zv8M$@qR-kNkbv01-`}gk!y^mPGos9)r!CBxDS#iRWF{)OWfrBD=NDxcEBHq2o~We) zR4WEj>s*wYSdy8arx22vo62BdqHkafM2UK~>Od6>JzX3_D(1wVzsPr3frB+*)nX0d z)r+?ozWcww_=ZWek(`gs#BPRvqA|;NeJ*kO*ruqfcq}a9c#C3L?KpBF@G1}eAg_> R{R!w;22WQ%mvv4FO#oMzwKo6& diff --git a/lib/nusoap/docs/docs/media/images/tutorial_folder.png b/lib/nusoap/docs/docs/media/images/tutorial_folder.png deleted file mode 100644 index 2a468b2a06fa3424ba94773373637d424f91f7e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 572 zcmV-C0>k}@P)>~W@cuiqoe=KGyn8k-rnBK%*_ATKmXxKdU|^Q=uf|NmyHcL<7#inXPLp`VEqaE{#o000SaNLh0L01FZT01FZU z(%pXi0000MbVXQnLvm$dbZKvHAXI5>WdJZVFEBDMFf-YbT0#H-03dWlSaefwW^{L9 za%BKbVPkS{ZDnL>VIW3na%FdKa%*!SO<22;DkJ~^0HH}lK~#90Rm|HGfj|I&;Z-?S zTE~>lvDmU9)2vA$a-s45?_+lx7yird;s>}vSUUa%B5*H?0lB_-jxz$}S+Eu>Tci^} zf*_zRSBAc7nwO;j`bo#VVd?HJ70@Hv7$8pt&R;?fo08O0cTlDBo5&$ zS2)D&L_ip-Xv-c3iad`)mSr0V%M{(b3i`Z5_cW1MYXWTY*ZT`cP91=4{NC>X0000< KMNUMnLSTaQ$PWMj diff --git a/lib/nusoap/docs/docs/media/images/up_button.png b/lib/nusoap/docs/docs/media/images/up_button.png deleted file mode 100644 index ff36c59356d1d67cf8c4d12cef7b5aff7bf4dbc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmV;N0%QG&P)%Pk4nVFe0X3Tq=+TY{p|NsA1fYZIby?c9mt*x!i*Xj57 z_j7Y|p0wcB-0AP{?>}zNjg5_FW@fduwWXz{lda&z#l@+-;@;%(Zjsl_%*=y>gJX); zOLx%L*4A8HT!y3E-rnA{#N%dWW|^6pp||AZ=k2Gu;O6G$tG?unrQUFp*;j$nOL)=N z-H!7B000SaNLh0L01m?d01m?e$8V@)0000WbVXQnQ*UN;cVTj608L?Ia&K*AWNBd_ zMrm?ocW-iQb0AGvyOAm+0000MbVXQnLvm$dbZKvHAXI5>WdJZVFEKJNFf-)xbMgQH z0aZyvK~#90eUl4s!XOZUanyCl+N~BSZdg%F=FV*U|Nm|WGzj(aC4Hp#g}ZVbsUwYZ z&Rzjil!QBIZEnCM*G;mFfhMO*Sgs&ijd4EZ4F>=mqdHh2`yC0Klf6aD**dot!!VqZ z1kM^tYtrbhSZY~S)mve)l_6jX>4Z|XyI6o$PsyzG!CTd_u;_}+68;72Gqbc*E#XaG z{1KHkUhfaBA749OLuPS0vpzyLTx|WwI-s@b{QWyw?8=I(yrMOhmdva(hL@P@CDfl= z3@+A)(FIx?d>#r*+a&qgfBjDR2CScBhYVBOmN=QV;cFbnb7;T&7X-qIrqsl*m$}d$CKcW835(Ow@m?{E zuz;N49J94VK$ - - - - - Docs For Class XMLSchema - - - - -
    -

     Class XMLSchema

    - - -
    -
    Description
    - -
    - -

    Backward compatibility

    - -

    - Located in /nusoap.php (line 2048) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_xmlschema
    -      |
    -      --XMLSchema
    - -
    -
    - - - - - - - - - -
    -
    Methods
    - -
    - -

    Inherited Methods

    - - -

    Inherited From nusoap_xmlschema

    -
    -  - nusoap_xmlschema::nusoap_xmlschema()
    -  - nusoap_xmlschema::addComplexType()
    -  - nusoap_xmlschema::addElement()
    -  - nusoap_xmlschema::addSimpleType()
    -  - nusoap_xmlschema::CreateTypeName()
    -  - nusoap_xmlschema::getPHPType()
    -  - nusoap_xmlschema::getTypeDef()
    -  - nusoap_xmlschema::parseFile()
    -  - nusoap_xmlschema::parseString()
    -  - nusoap_xmlschema::schemaCharacterData()
    -  - nusoap_xmlschema::schemaEndElement()
    -  - nusoap_xmlschema::schemaStartElement()
    -  - nusoap_xmlschema::serializeSchema()
    -  - nusoap_xmlschema::serializeTypeDef()
    -  - nusoap_xmlschema::typeToForm()
    -  - nusoap_xmlschema::xdebug()
    -
    - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:08 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/_class_wsdlcache_php.html b/lib/nusoap/docs/docs/nusoap/_class_wsdlcache_php.html deleted file mode 100644 index 51c544e72..000000000 --- a/lib/nusoap/docs/docs/nusoap/_class_wsdlcache_php.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - Docs for page class.wsdlcache.php - - - - -
    -

    File/class.wsdlcache.php

    - - -
    -
    Description
    - -
    - - - -
    -
    - - -
    -
    Classes
    - -
    - - - - - - - - - - - - - -
    ClassDescription
    -  class - nusoap_wsdlcache - - caches instances of the wsdl class -
    -  class - wsdlcache - - For backward compatibility -
    -
    -
    - - - - - -

    - Documentation generated on Mon, 26 Apr 2010 16:16:48 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/_nusoap_php.html b/lib/nusoap/docs/docs/nusoap/_nusoap_php.html deleted file mode 100644 index d8e463594..000000000 --- a/lib/nusoap/docs/docs/nusoap/_nusoap_php.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - Docs for page nusoap.php - - - - -
    -

    File/nusoap.php

    - - -
    -
    Description
    - -
    - - - -
    -
    - - -
    -
    Classes
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ClassDescription
    -  class - nusoap_base - - nusoap_base -
    -  class - nusoap_fault - - Contains information for a SOAP fault. -
    -  class - soap_fault - - Backward compatibility -
    -  class - nusoap_xmlschema - - parses an XML Schema, allows access to it's data, other utility methods. -
    -  class - XMLSchema - - Backward compatibility -
    -  class - soapval - - For creating serializable abstractions of native PHP types. This class -
    -  class - soap_transport_http - - transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support -
    -  class - nusoap_server - - nusoap_server allows the user to create a SOAP server that is capable of receiving messages and returning responses -
    -  class - soap_server - - Backward compatibility -
    -  class - wsdl - - parses a WSDL file, allows access to it's data, other utility methods. -
    -  class - nusoap_parser - - nusoap_parser class parses SOAP XML messages into native PHP values -
    -  class - soap_parser - - Backward compatibility -
    -  class - nusoap_client - - [nu]soapclient higher level class for easy usage. -
    -  class - soapclient - - For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded. -
    -
    -
    - - - - - -
    -
    Functions
    - -
    - -
    - -
    - - iso8601_to_timestamp (line 943) -
    - - -

    convert ISO 8601 compliant date string to unix timestamp

    -
      -
    • return: Unix timestamp (int) or false
    • -
    • access: public
    • -
    -
    - mixed - - iso8601_to_timestamp - - (string $datestr) -
    - -
      -
    • - string - $datestr: ISO 8601 compliant date string
    • -
    - - -
    - -
    - -
    - - timestamp_to_iso8601 (line 904) -
    - - -

    convert unix timestamp to ISO 8601 compliant date string

    -
      -
    • return: ISO 8601 date string or false
    • -
    • access: public
    • -
    -
    - mixed - - timestamp_to_iso8601 - - (int $timestamp, [boolean $utc = true]) -
    - -
      -
    • - int - $timestamp: Unix time stamp
    • -
    • - boolean - $utc: Whether the time stamp is UTC or local
    • -
    - - -
    - -
    - -
    - - usleepWindows (line 982) -
    - - -

    sleeps some number of microseconds

    -
      -
    • deprecated:
    • -
    • access: public
    • -
    -
    - void - - usleepWindows - - (string $usec) -
    - -
      -
    • - string - $usec: the number of microseconds to sleep
    • -
    - - -
    -
    -
    - -

    - Documentation generated on Mon, 26 Apr 2010 16:16:49 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/_nusoapmime_php.html b/lib/nusoap/docs/docs/nusoap/_nusoapmime_php.html deleted file mode 100644 index a9bd74165..000000000 --- a/lib/nusoap/docs/docs/nusoap/_nusoapmime_php.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - Docs for page nusoapmime.php - - - - -
    -

    File/nusoapmime.php

    - - -
    -
    Description
    - -
    - - - -
    -
    - - -
    -
    Classes
    - -
    - - - - - - - - - - - - - - - - - - - - - -
    ClassDescription
    -  class - nusoap_client_mime - - nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -
    -  class - soapclientmime - - nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -
    -  class - nusoap_server_mime - - nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -
    -  class - nusoapservermime - - nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -
    -
    -
    - - -
    -
    Includes
    - -
    - -
    - -
    -  - - require_once - ('Mail/mimeDecode.php') - (line 42) - -
    - - - -
    - -
    - -
    -  - - require_once - ('Mail/mimePart.php') - (line 43) - -
    - - - -
    -
    -
    - - - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:09 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_base.html b/lib/nusoap/docs/docs/nusoap/nusoap_base.html deleted file mode 100644 index f32fcb2d6..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_base.html +++ /dev/null @@ -1,1577 +0,0 @@ - - - - - - Docs For Class nusoap_base - - - - -
    -

     Class nusoap_base

    - - -
    -
    Description
    - -
    - -

    nusoap_base

    - -

    - Located in /nusoap.php (line 85) -

    - - -
    
    -	
    -			
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ClassDescription
    -  class - nusoap_fault - - Contains information for a SOAP fault. -
    -  class - nusoap_xmlschema - - parses an XML Schema, allows access to it's data, other utility methods. -
    -  class - soapval - - For creating serializable abstractions of native PHP types. This class -
    -  class - soap_transport_http - - transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support -
    -  class - nusoap_server - - nusoap_server allows the user to create a SOAP server that is capable of receiving messages and returning responses -
    -  class - wsdl - - parses a WSDL file, allows access to it's data, other utility methods. -
    -  class - nusoap_parser - - nusoap_parser class parses SOAP XML messages into native PHP values -
    -  class - nusoap_client - - [nu]soapclient higher level class for easy usage. -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - boolean - $charencoding -
    -
    -  - integer - $debugLevel -
    -
    -  - string - $debug_str -
    -
    -  - string - $error_str -
    -
    -  - array - $namespaces -
    -
    -  - string - $revision -
    -
    -  - string - $soap_defencoding -
    -
    -  - string - $title -
    -
    -  - array - $typemap -
    -
    -  - array - $usedNamespaces -
    -
    -  - string - $version -
    -
    -  - array - $xmlEntities -
    -
    -  - string - $XMLSchemaVersion -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - nusoap_base - nusoap_base - () -
    - -
    -  - void - appendDebug - (string $string) -
    - -
    -  - void - clearDebug - () -
    - -
    -  - string - contractQname - (string $qname) -
    - -
    -  - void - debug - (string $string) -
    - -
    -  - void - expandEntities - (string $val) -
    - -
    -  - string - expandQname - (string $qname) -
    - -
    -  - string - formatDump - (string $str) -
    - -
    -  - debug - &getDebug - () -
    - -
    -  - debug - &getDebugAsXMLComment - () -
    - -
    -  - int - getDebugLevel - () -
    - -
    -  - mixed - getError - () -
    - -
    -  - integer - getGlobalDebugLevel - () -
    - -
    -  - string - getLocalPart - (string $str) -
    - -
    -  - string - getmicrotime - () -
    - -
    -  - mixed - getNamespaceFromPrefix - (string $prefix) -
    - -
    -  - mixed - getPrefix - (string $str) -
    - -
    -  - mixed - getPrefixFromNamespace - (string $ns) -
    - -
    -  - string - isArraySimpleOrStruct - (mixed $val) -
    - -
    -  - string - serializeEnvelope - (string $body, [mixed $headers = false], [array $namespaces = array()], [string $style = 'rpc'], [string $use = 'encoded'], [string $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/']) -
    - -
    -  - string - serialize_val - (mixed $val, [string $name = false], [string $type = false], [string $name_ns = false], [string $type_ns = false], [array $attributes = false], [string $use = 'encoded'], [boolean $soapval = false]) -
    - -
    -  - void - setDebugLevel - (int $level) -
    - -
    -  - boolean - setError - (mixed $str) -
    - -
    -  - void - setGlobalDebugLevel - (int $level) -
    - -
    -  - string - varDump - (mixed $data) -
    - -
    -  - string - __toString - () -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - boolean - $charencoding - = true (line 128) - -
    - - -

    toggles automatic encoding of special characters as entities (should always be true, I think)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - integer - $debugLevel - (line 135) - -
    - - -

    the debug level for this instance

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $debug_str - = '' (line 120) - -
    - - -

    Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $error_str - = '' (line 113) - -
    - - -

    Current error string (manipulated by getError/setError)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $namespaces - = array(
    'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
    'xsd' => 'http://www.w3.org/2001/XMLSchema',
    'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
    'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
    )
    (line 162) -
    -
    - - -

    namespaces in an array of prefix => uri

    -

    this is "seeded" by a set of constants, but it may be altered by code

    -
      -
    • access: public
    • -
    - - - -
    -
    Redefined in descendants as:
    - - - -
    - -
    - -
    - - - string - $revision - = '$Revision: 1.2 $' (line 106) - -
    - - -

    CVS revision for HTTP headers.

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $soap_defencoding - = 'ISO-8859-1' (line 151) - -
    - - -

    charset encoding for outgoing messages

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - string - $title - = 'NuSOAP' (line 92) - -
    - - -

    Identification for HTTP headers.

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $typemap - = array(
    'http://www.w3.org/2001/XMLSchema' => array(
    'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
    'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
    'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
    // abstract "any" types
    'anyType'=>'string','anySimpleType'=>'string',
    // derived datatypes
    'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
    'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
    'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
    'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),'http://www.w3.org/2000/10/XMLSchema'=>array('i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double','float'=>'double','dateTime'=>'string','timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),'http://www.w3.org/1999/XMLSchema'=>array('i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double','float'=>'double','dateTime'=>'string','timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),'http://soapinterop.org/xsd'=>array('SOAPStruct'=>'struct'),'http://schemas.xmlsoap.org/soap/encoding/'=>array('base64'=>'string','array'=>'array','Array'=>'array'),'http://xml.apache.org/xml-soap'=>array('Map'))
    (line 184) -
    -
    - - -

    XML Schema types in an array of uri => (array of xml type => php type) is this legacy yet? no, this is used by the nusoap_xmlschema class to verify type => namespace mappings.

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - array - $usedNamespaces - = array() (line 175) - -
    - - -

    namespaces used in the current context, e.g. during serialization

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $version - = '0.9.5' (line 99) - -
    - - -

    Version for HTTP headers.

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $xmlEntities - = array('quot' => '"','amp' => '&',
    'lt' => '<','gt' => '>','apos' => "'")
    (line 217) -
    -
    - - -

    XML entities to convert

    - - - - - - -
    - -
    - -
    - - - string - $XMLSchemaVersion - = 'http://www.w3.org/2001/XMLSchema' (line 143) - -
    - - -

    set schema version

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor nusoap_base (line 225) -
    - - -

    constructor

    -
      -
    • access: public
    • -
    - -
    - nusoap_base - - nusoap_base - - () -
    - - - -
    - -
    - -
    - - appendDebug (line 287) -
    - - -

    adds debug data to the instance debug string without formatting

    -
      -
    • access: public
    • -
    - -
    - void - - appendDebug - - (string $string) -
    - -
      -
    • - string - $string: debug data
    • -
    - - -
    - -
    - -
    - - clearDebug (line 300) -
    - - -

    clears the current debug data for this instance

    -
      -
    • access: public
    • -
    - -
    - void - - clearDebug - - () -
    - - - -
    - -
    - -
    - - contractQname (line 740) -
    - - -

    contracts (changes namespace to prefix) a qualified name

    -
      -
    • return: contracted qname
    • -
    • access: private
    • -
    - -
    - string - - contractQname - - (string $qname) -
    - -
      -
    • - string - $qname: qname
    • -
    - - -
    - -
    - -
    - - debug (line 275) -
    - - -

    adds debug data to the instance debug string with formatting

    -
      -
    • access: private
    • -
    - -
    - void - - debug - - (string $string) -
    - -
      -
    • - string - $string: debug data
    • -
    - - -
    - -
    - -
    - - expandEntities (line 341) -
    - - -

    expands entities, e.g. changes '<' to '&lt;'.

    -
      -
    • access: private
    • -
    - -
    - void - - expandEntities - - (string $val) -
    - -
      -
    • - string - $val: The string in which to expand entities.
    • -
    - - -
    - -
    - -
    - - expandQname (line 765) -
    - - -

    expands (changes prefix to namespace) a qualified name

    -
      -
    • return: expanded qname
    • -
    • access: private
    • -
    - -
    - string - - expandQname - - (string $qname) -
    - -
      -
    • - string - $qname: qname
    • -
    - - -
    - -
    - -
    - - formatDump (line 728) -
    - - -

    formats a string to be inserted into an HTML stream

    -
      -
    • return: The formatted string
    • -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - string - - formatDump - - (string $str) -
    - -
      -
    • - string - $str: The string to format
    • -
    - - -
    - -
    - -
    - - getDebug (line 312) -
    - - -

    gets the current debug data for this instance

    -
      -
    • return: data
    • -
    • access: public
    • -
    - -
    - debug - - &getDebug - - () -
    - - - -
    - -
    - -
    - - getDebugAsXMLComment (line 325) -
    - - -

    gets the current debug data for this instance as an XML comment this may change the contents of the debug data

    -
      -
    • return: data as an XML comment
    • -
    • access: public
    • -
    - -
    - debug - - &getDebugAsXMLComment - - () -
    - - - -
    - -
    - -
    - - getDebugLevel (line 255) -
    - - -

    gets the debug level for this instance

    -
      -
    • return: Debug level 0-9, where 0 turns off
    • -
    • access: public
    • -
    - -
    - int - - getDebugLevel - - () -
    - - - -
    - -
    - -
    - - getError (line 358) -
    - - -

    returns error string if present

    -
      -
    • return: error string or false
    • -
    • access: public
    • -
    - -
    - mixed - - getError - - () -
    - - - -
    - -
    - -
    - - getGlobalDebugLevel (line 235) -
    - - -

    gets the global debug level, which applies to future instances

    -
      -
    • return: Debug level 0-9, where 0 turns off
    • -
    • access: public
    • -
    - -
    - integer - - getGlobalDebugLevel - - () -
    - - - -
    - -
    - -
    - - getLocalPart (line 790) -
    - - -

    returns the local part of a prefixed string returns the original string, if not prefixed

    -
      -
    • return: The local part
    • -
    • access: public
    • -
    - -
    - string - - getLocalPart - - (string $str) -
    - -
      -
    • - string - $str: The prefixed string
    • -
    - - -
    - -
    - -
    - - getmicrotime (line 854) -
    - - -

    returns the time in ODBC canonical form with microseconds

    -
      -
    • return: The time in ODBC canonical form with microseconds
    • -
    • access: public
    • -
    - -
    - string - - getmicrotime - - () -
    - - - -
    - -
    - -
    - - getNamespaceFromPrefix (line 822) -
    - - -

    pass it a prefix, it returns a namespace

    -
      -
    • return: The namespace, false if no namespace has the specified prefix
    • -
    • access: public
    • -
    - -
    - mixed - - getNamespaceFromPrefix - - (string $prefix) -
    - -
      -
    • - string - $prefix: The prefix
    • -
    - - -
    - -
    - -
    - - getPrefix (line 807) -
    - - -

    returns the prefix part of a prefixed string returns false, if not prefixed

    -
      -
    • return: The prefix or false if there is no prefix
    • -
    • access: public
    • -
    - -
    - mixed - - getPrefix - - (string $str) -
    - -
      -
    • - string - $str: The prefixed string
    • -
    - - -
    - -
    - -
    - - getPrefixFromNamespace (line 838) -
    - - -

    returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace

    -
      -
    • return: The prefix, false if the namespace has no prefixes
    • -
    • access: public
    • -
    - -
    - mixed - - getPrefixFromNamespace - - (string $ns) -
    - -
      -
    • - string - $ns: The namespace
    • -
    - - -
    - -
    - -
    - - isArraySimpleOrStruct (line 382) -
    - - -

    detect if array is a simple array or a struct (associative array)

    -
      -
    • return: (arraySimple|arrayStruct)
    • -
    • access: private
    • -
    - -
    - string - - isArraySimpleOrStruct - - (mixed $val) -
    - -
      -
    • - mixed - $val: The PHP array
    • -
    - - -
    - -
    - -
    - - serializeEnvelope (line 673) -
    - - -

    serializes a message

    -
      -
    • return: the message
    • -
    • access: public
    • -
    - -
    - string - - serializeEnvelope - - (string $body, [mixed $headers = false], [array $namespaces = array()], [string $style = 'rpc'], [string $use = 'encoded'], [string $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/']) -
    - -
      -
    • - string - $body: the XML of the SOAP body
    • -
    • - mixed - $headers: optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array
    • -
    • - array - $namespaces: optional the namespaces used in generating the body and headers
    • -
    • - string - $style: optional (rpc|document)
    • -
    • - string - $use: optional (encoded|literal)
    • -
    • - string - $encodingStyle: optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
    • -
    - - -
    - -
    - -
    - - serialize_val (line 407) -
    - - -

    serializes PHP values in accordance w/ section 5. Type information is not serialized if $use == 'literal'.

    -
      -
    • return: The serialized element, possibly with child elements
    • -
    • access: public
    • -
    - -
    - string - - serialize_val - - (mixed $val, [string $name = false], [string $type = false], [string $name_ns = false], [string $type_ns = false], [array $attributes = false], [string $use = 'encoded'], [boolean $soapval = false]) -
    - -
      -
    • - mixed - $val: The value to serialize
    • -
    • - string - $name: The name (local part) of the XML element
    • -
    • - string - $type: The XML schema type (local part) for the element
    • -
    • - string - $name_ns: The namespace for the name of the XML element
    • -
    • - string - $type_ns: The namespace for the type of the element
    • -
    • - array - $attributes: The attributes to serialize as name=>value pairs
    • -
    • - string - $use: The WSDL "use" (encoded|literal)
    • -
    • - boolean - $soapval: Whether this is called from soapval.
    • -
    - - -
    - -
    - -
    - - setDebugLevel (line 265) -
    - - -

    sets the debug level for this instance

    -
      -
    • access: public
    • -
    - -
    - void - - setDebugLevel - - (int $level) -
    - -
      -
    • - int - $level: Debug level 0-9, where 0 turns off
    • -
    - - -
    - -
    - -
    - - setError (line 371) -
    - - -

    sets error string

    -
      -
    • return: error string
    • -
    • access: private
    • -
    - -
    - boolean - - setError - - (mixed $str) -
    - - - -
    - -
    - -
    - - setGlobalDebugLevel (line 245) -
    - - -

    sets the global debug level, which applies to future instances

    -
      -
    • access: public
    • -
    - -
    - void - - setGlobalDebugLevel - - (int $level) -
    - -
      -
    • - int - $level: Debug level 0-9, where 0 turns off
    • -
    - - -
    - -
    - -
    - - varDump (line 873) -
    - - -

    Returns a string with the output of var_dump

    -
      -
    • return: The output of var_dump
    • -
    • access: public
    • -
    - -
    - string - - varDump - - (mixed $data) -
    - -
      -
    • - mixed - $data: The variable to var_dump
    • -
    - - -
    - -
    - -
    - - __toString (line 887) -
    - - -

    represents the object as a string

    -
      -
    • access: public
    • -
    - -
    - string - - __toString - - () -
    - - - -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:01 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_client.html b/lib/nusoap/docs/docs/nusoap/nusoap_client.html deleted file mode 100644 index 3cd176e0e..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_client.html +++ /dev/null @@ -1,2304 +0,0 @@ - - - - - - Docs For Class nusoap_client - - - - -
    -

     Class nusoap_client

    - - -
    -
    Description
    - -
    - -

    [nu]soapclient higher level class for easy usage.

    -

    usage:

    // instantiate client with server info $soapclient = new nusoap_client( string path [ ,mixed wsdl] );

    // call method, get results echo $soapclient->call( string methodname [ ,array parameters] );

    // bye bye client unset($soapclient);

    - -

    - Located in /nusoap.php (line 7097) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_client
    - -
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - - - - - -
    ClassDescription
    -  class - soapclient - - For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded. -
    -  class - nusoap_client_mime - - nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - mixed - $authtype -
    -
    -  - mixed - $bindingType -
    -
    -  - mixed - $certRequest -
    -
    -  - mixed - $cookies -
    -
    -  - mixed - $curl_options -
    -
    -  - mixed - $decode_utf8 -
    -
    -  - mixed - $defaultRpcParams -
    -
    -  - mixed - $document -
    -
    -  - mixed - $endpoint -
    -
    -  - mixed - $endpointType -
    -
    -  - fault - $fault -
    -
    -  - faultcode - $faultcode -
    -
    -  - faultdetail - $faultdetail -
    -
    -  - faultstring - $faultstring -
    -
    -  - mixed - $forceEndpoint -
    -
    -  - mixed - $http_encoding -
    -
    -  - mixed - $operations -
    -
    -  - mixed - $password -
    -
    -  - mixed - $persistentConnection -
    -
    -  - mixed - $portName -
    -
    -  - mixed - $proxyhost -
    -
    -  - mixed - $proxypassword -
    -
    -  - mixed - $proxyport -
    -
    -  - mixed - $proxyusername -
    -
    -  - mixed - $request -
    -
    -  - mixed - $requestHeaders -
    -
    -  - mixed - $response -
    -
    -  - mixed - $responseData -
    -
    -  - mixed - $responseHeader -
    -
    -  - mixed - $responseHeaders -
    -
    -  - mixed - $response_timeout -
    -
    -  - mixed - $timeout -
    -
    -  - mixed - $username -
    -
    -  - mixed - $use_curl -
    -
    -  - mixed - $xml_encoding -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - nusoap_client - nusoap_client - (mixed $endpoint, [mixed $wsdl = false], [string $proxyhost = false], [string $proxyport = false], [string $proxyusername = false], [string $proxypassword = false], integer $timeout, [integer $response_timeout = 30], [string $portName = '']) -
    - -
    -  - mixed - call - (string $operation, [mixed $params = array()], [string $namespace = 'http://tempuri.org'], [string $soapAction = ''], [mixed $headers = false], [boolean $rpcParams = null], [string $style = 'rpc'], [string $use = 'encoded']) -
    - -
    -  - boolean - checkCookies - () -
    - -
    -  - void - checkWSDL - () -
    - -
    -  - void - decodeUTF8 - (mixed $bool) -
    - -
    -  - array - getCookies - () -
    - -
    -  - boolean - getDefaultRpcParams - () -
    - -
    -  - mixed - getHeader - () -
    - -
    -  - string - getHeaders - () -
    - -
    -  - string - getHTTPBody - (string $soapmsg) -
    - -
    -  - string - getHTTPContentType - () -
    - -
    -  - string - getHTTPContentTypeCharset - () -
    - -
    -  - array - getOperationData - (string $operation) -
    - -
    -  - object soap_proxy - getProxy - () -
    - -
    -  - string - getProxyClassCode - () -
    - -
    -  - void - loadWSDL - () -
    - -
    -  - mixed - parseResponse - (array $headers, string $data) -
    - -
    -  - mixed - send - (string $msg, [string $soapaction = ''], integer $timeout, [integer $response_timeout = 30]) -
    - -
    -  - boolean - setCookie - (string $name, string $value) -
    - -
    -  - void - setCredentials - (string $username, string $password, [string $authtype = 'basic'], [array $certRequest = array()]) -
    - -
    -  - void - setCurlOption - (mixed $option, mixed $value) -
    - -
    -  - void - setDefaultRpcParams - (boolean $rpcParams) -
    - -
    -  - void - setEndpoint - (string $endpoint) -
    - -
    -  - void - setHeaders - (mixed $headers) -
    - -
    -  - void - setHTTPEncoding - ([string $enc = 'gzip, deflate']) -
    - -
    -  - void - setHTTPProxy - (string $proxyhost, string $proxyport, [string $proxyusername = ''], [string $proxypassword = '']) -
    - -
    -  - void - setUseCURL - (boolean $use) -
    - -
    -  - boolean - UpdateCookies - (array $cookies) -
    - -
    -  - void - useHTTPPersistentConnection - () -
    - -
    -  - string - _getProxyClassCode - (mixed $r) -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - mixed - $authtype - = '' (line 7101) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $bindingType - = '' (line 7128) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $certRequest - = array() (line 7102) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $cookies - = array() (line 7124) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $curl_options - = array() (line 7127) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $decode_utf8 - = true (line 7125) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $defaultRpcParams - = false (line 7120) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $document - = '' (line 7106) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $endpoint - (line 7107) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $endpointType - = '' (line 7118) - -
    - - - - - - - -
    - -
    - -
    - - - fault - $fault - (line 7138) - -
    - - -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - faultcode - $faultcode - (line 7143) - -
    - - -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - faultdetail - $faultdetail - (line 7153) - -
    - - -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - faultstring - $faultstring - (line 7148) - -
    - - -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $forceEndpoint - = '' (line 7108) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $http_encoding - = false (line 7115) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $operations - = array() (line 7126) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $password - = '' (line 7100) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $persistentConnection - = false (line 7119) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $portName - = '' (line 7113) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxyhost - = '' (line 7109) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxypassword - = '' (line 7112) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxyport - = '' (line 7110) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxyusername - = '' (line 7111) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $request - = '' (line 7121) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $requestHeaders - = false (line 7103) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $response - = '' (line 7122) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $responseData - = '' (line 7123) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $responseHeader - = NULL (line 7105) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $responseHeaders - = '' (line 7104) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $response_timeout - = 30 (line 7117) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $timeout - = 0 (line 7116) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $username - = '' (line 7099) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $use_curl - = false (line 7129) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $xml_encoding - = '' (line 7114) - -
    - - - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor nusoap_client (line 7169) -
    - - -

    constructor

    -
      -
    • access: public
    • -
    - -
    - nusoap_client - - nusoap_client - - (mixed $endpoint, [mixed $wsdl = false], [string $proxyhost = false], [string $proxyport = false], [string $proxyusername = false], [string $proxypassword = false], integer $timeout, [integer $response_timeout = 30], [string $portName = '']) -
    - -
      -
    • - mixed - $endpoint: SOAP server or WSDL URL (string), or wsdl instance (object)
    • -
    • - mixed - $wsdl: optional, set to 'wsdl' or true if using WSDL
    • -
    • - string - $proxyhost: optional
    • -
    • - string - $proxyport: optional
    • -
    • - string - $proxyusername: optional
    • -
    • - string - $proxypassword: optional
    • -
    • - integer - $timeout: set the connection timeout
    • -
    • - integer - $response_timeout: set the response timeout
    • -
    • - string - $portName: optional portName in WSDL document
    • -
    - - -
    - -
    - -
    - - call (line 7228) -
    - - -

    calls method, returns PHP native type

    -
      -
    • return: response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors
    • -
    • access: public
    • -
    - -
    - mixed - - call - - (string $operation, [mixed $params = array()], [string $namespace = 'http://tempuri.org'], [string $soapAction = ''], [mixed $headers = false], [boolean $rpcParams = null], [string $style = 'rpc'], [string $use = 'encoded']) -
    - -
      -
    • - string - $operation: SOAP server URL or path
    • -
    • - mixed - $params: An array, associative or simple, of the parameters for the method call, or a string that is the XML for the call. For rpc style, this call will wrap the XML in a tag named after the method, as well as the SOAP Envelope and Body. For document style, this will only wrap with the Envelope and Body. IMPORTANT: when using an array with document style, in which case there is really one parameter, the root of the fragment used in the call, which encloses what programmers normally think of parameters. A parameter array *must* include the wrapper.
    • -
    • - string - $namespace: optional method namespace (WSDL can override)
    • -
    • - string - $soapAction: optional SOAPAction value (WSDL can override)
    • -
    • - mixed - $headers: optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array
    • -
    • - boolean - $rpcParams: optional (no longer used)
    • -
    • - string - $style: optional (rpc|document) the style to use when serializing parameters (WSDL can override)
    • -
    • - string - $use: optional (encoded|literal) the use when serializing parameters (WSDL can override)
    • -
    - - -
    - -
    - -
    - - checkCookies (line 7959) -
    - - -

    checks all Cookies and delete those which are expired

    -
      -
    • return: always return true
    • -
    • access: private
    • -
    - -
    - boolean - - checkCookies - - () -
    - - - -
    - -
    - -
    - - checkWSDL (line 7410) -
    - - -

    check WSDL passed as an instance or pulled from an endpoint

    -
      -
    • access: private
    • -
    - -
    - void - - checkWSDL - - () -
    - - - -
    - -
    - -
    - - decodeUTF8 (line 7922) -
    - - - -
    - void - - decodeUTF8 - - (mixed $bool) -
    - - - -
    - -
    - -
    - - getCookies (line 7949) -
    - - -

    gets all Cookies

    -
      -
    • return: with all internal cookies
    • -
    • access: public
    • -
    - -
    - array - - getCookies - - () -
    - - - -
    - -
    - -
    - - getDefaultRpcParams (line 7746) -
    - - -

    gets the default RPC parameter setting.

    -

    If true, default is that call params are like RPC even for document style. Each call() can override this value.

    This is no longer used.

    -
      -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - boolean - - getDefaultRpcParams - - () -
    - - - -
    - -
    - -
    - - getHeader (line 7665) -
    - - -

    get the SOAP response Header (parsed)

    -
      -
    • access: public
    • -
    - -
    - mixed - - getHeader - - () -
    - - - -
    - -
    - -
    - - getHeaders (line 7655) -
    - - -

    get the SOAP response headers (namespace resolution incomplete)

    -
      -
    • access: public
    • -
    - -
    - string - - getHeaders - - () -
    - - - -
    - -
    - -
    - - getHTTPBody (line 7887) -
    - - -

    gets the HTTP body for the current request.

    -
      -
    • return: The HTTP body, which includes the SOAP payload
    • -
    • access: private
    • -
    - -
    - string - - getHTTPBody - - (string $soapmsg) -
    - -
      -
    • - string - $soapmsg: The SOAP payload
    • -
    - - -
    -
    Redefined in descendants as:
    - -
    - -
    - -
    - - getHTTPContentType (line 7899) -
    - - -

    gets the HTTP content type for the current request.

    -

    Note: getHTTPBody must be called before this.

    -
      -
    • return: the HTTP content type for the current request.
    • -
    • access: private
    • -
    - -
    - string - - getHTTPContentType - - () -
    - - - -
    -
    Redefined in descendants as:
    - -
    - -
    - -
    - - getHTTPContentTypeCharset (line 7912) -
    - - -

    gets the HTTP content type charset for the current request.

    -

    returns false for non-text content types.

    Note: getHTTPBody must be called before this.

    -
      -
    • return: the HTTP content type charset for the current request.
    • -
    • access: private
    • -
    - -
    - string - - getHTTPContentTypeCharset - - () -
    - - - -
    -
    Redefined in descendants as:
    - -
    - -
    - -
    - - getOperationData (line 7459) -
    - - -

    get available data pertaining to an operation

    -
      -
    • return: array of data pertaining to the operation
    • -
    • access: public
    • -
    - -
    - array - - getOperationData - - (string $operation) -
    - -
      -
    • - string - $operation: operation name
    • -
    - - -
    - -
    - -
    - - getProxy (line 7772) -
    - - -

    dynamically creates an instance of a proxy class, allowing user to directly call methods from wsdl

    -
      -
    • return: object
    • -
    • access: public
    • -
    - -
    - object soap_proxy - - getProxy - - () -
    - - - -
    - -
    - -
    - - getProxyClassCode (line 7875) -
    - - -

    dynamically creates proxy class code

    -
      -
    • return: PHP/NuSOAP code for the proxy class
    • -
    • access: public
    • -
    - -
    - string - - getProxyClassCode - - () -
    - - - -
    - -
    - -
    - - loadWSDL (line 7444) -
    - - -

    instantiate wsdl object and parse wsdl file

    -
      -
    • access: public
    • -
    - -
    - void - - loadWSDL - - () -
    - - - -
    - -
    - -
    - - parseResponse (line 7564) -
    - - -

    processes SOAP message returned from server

    -
      -
    • return: value of the message, decoded into a PHP type
    • -
    • access: private
    • -
    - -
    - mixed - - parseResponse - - (array $headers, string $data) -
    - -
      -
    • - array - $headers: The HTTP headers
    • -
    • - string - $data: unprocessed response data from server
    • -
    - - -
    -
    Redefined in descendants as:
    - -
    - -
    - -
    - - send (line 7485) -
    - - -

    send the SOAP message

    -

    Note: if the operation has multiple return values the return value of this method will be an array of those values.

    -
      -
    • return: native PHP types.
    • -
    • access: private
    • -
    - -
    - mixed - - send - - (string $msg, [string $soapaction = ''], integer $timeout, [integer $response_timeout = 30]) -
    - -
      -
    • - string - $msg: a SOAPx4 soapmsg object
    • -
    • - string - $soapaction: SOAPAction value
    • -
    • - integer - $timeout: set connection timeout in seconds
    • -
    • - integer - $response_timeout: set response timeout in seconds
    • -
    - - -
    - -
    - -
    - - setCookie (line 7935) -
    - - -

    adds a new Cookie into $this->cookies array

    -
      -
    • return: if cookie-set was successful returns true, else false
    • -
    • access: public
    • -
    - -
    - boolean - - setCookie - - (string $name, string $value) -
    - -
      -
    • - string - $name: Cookie Name
    • -
    • - string - $value: Cookie Value
    • -
    - - -
    - -
    - -
    - - setCredentials (line 7694) -
    - - -

    if authenticating, set user credentials here

    -
      -
    • access: public
    • -
    - -
    - void - - setCredentials - - (string $username, string $password, [string $authtype = 'basic'], [array $certRequest = array()]) -
    - -
      -
    • - string - $username
    • -
    • - string - $password
    • -
    • - string - $authtype: (basic|digest|certificate|ntlm)
    • -
    • - array - $certRequest: (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
    • -
    - - -
    - -
    - -
    - - setCurlOption (line 7620) -
    - - -

    sets user-specified cURL options

    -
      -
    • access: public
    • -
    - -
    - void - - setCurlOption - - (mixed $option, mixed $value) -
    - -
      -
    • - mixed - $option: The cURL option (always integer?)
    • -
    • - mixed - $value: The cURL option value
    • -
    - - -
    - -
    - -
    - - setDefaultRpcParams (line 7761) -
    - - -

    sets the default RPC parameter setting.

    -

    If true, default is that call params are like RPC even for document style Each call() can override this value.

    This is no longer used.

    -
      -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - void - - setDefaultRpcParams - - (boolean $rpcParams) -
    - -
      -
    • - boolean - $rpcParams
    • -
    - - -
    - -
    - -
    - - setEndpoint (line 7632) -
    - - -

    sets the SOAP endpoint, which can override WSDL

    -
      -
    • access: public
    • -
    - -
    - void - - setEndpoint - - (string $endpoint) -
    - -
      -
    • - string - $endpoint: The endpoint URL to use, or empty string or false to prevent override
    • -
    - - -
    - -
    - -
    - - setHeaders (line 7643) -
    - - -

    set the SOAP headers

    -
      -
    • access: public
    • -
    - -
    - void - - setHeaders - - (mixed $headers) -
    - -
      -
    • - mixed - $headers: String of XML with SOAP header content, or array of soapval objects for SOAP headers
    • -
    - - -
    - -
    - -
    - - setHTTPEncoding (line 7709) -
    - - -

    use HTTP encoding

    -
      -
    • access: public
    • -
    - -
    - void - - setHTTPEncoding - - ([string $enc = 'gzip, deflate']) -
    - -
      -
    • - string - $enc: HTTP encoding
    • -
    - - -
    - -
    - -
    - - setHTTPProxy (line 7678) -
    - - -

    set proxy info here

    -
      -
    • access: public
    • -
    - -
    - void - - setHTTPProxy - - (string $proxyhost, string $proxyport, [string $proxyusername = ''], [string $proxypassword = '']) -
    - -
      -
    • - string - $proxyhost
    • -
    • - string - $proxyport
    • -
    • - string - $proxyusername
    • -
    • - string - $proxypassword
    • -
    - - -
    - -
    - -
    - - setUseCURL (line 7720) -
    - - -

    Set whether to try to use cURL connections if possible

    -
      -
    • access: public
    • -
    - -
    - void - - setUseCURL - - (boolean $use) -
    - -
      -
    • - boolean - $use: Whether to try to use cURL
    • -
    - - -
    - -
    - -
    - - UpdateCookies (line 7992) -
    - - -

    updates the current cookies with a new set

    -
      -
    • return: always return true
    • -
    • access: private
    • -
    - -
    - boolean - - UpdateCookies - - (array $cookies) -
    - -
      -
    • - array - $cookies: new cookies with which to update current ones
    • -
    - - -
    - -
    - -
    - - useHTTPPersistentConnection (line 7730) -
    - - -

    use HTTP persistent connections if possible

    -
      -
    • access: public
    • -
    - -
    - void - - useHTTPPersistentConnection - - () -
    - - - -
    - -
    - -
    - - _getProxyClassCode (line 7820) -
    - - -

    dynamically creates proxy class code

    -
      -
    • return: PHP/NuSOAP code for the proxy class
    • -
    • access: private
    • -
    - -
    - string - - _getProxyClassCode - - (mixed $r) -
    - - - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:02 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_client_mime.html b/lib/nusoap/docs/docs/nusoap/nusoap_client_mime.html deleted file mode 100644 index ba9ca88ba..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_client_mime.html +++ /dev/null @@ -1,846 +0,0 @@ - - - - - - Docs For Class nusoap_client_mime - - - - -
    -

     Class nusoap_client_mime

    - - -
    -
    Description
    - -
    - -

    nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.

    -
      -
    • access: public
    • -
    • version: $Id: nusoapmime.php,v 1.13 2010/04/26 20:15:08 snichol Exp $
    • -
    • author: Scott Nichol <snichol@users.sourceforge.net>
    • -
    • author: Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
    • -
    -

    - Located in /nusoapmime.php (line 54) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_client
    -      |
    -      --nusoap_client_mime
    - -
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - -
    ClassDescription
    -  class - soapclientmime - - nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - string - $mimeContentType -
    -
    -  - array - $requestAttachments -
    -
    -  - array - $responseAttachments -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - string - addAttachment - (string $data, [string $filename = ''], [string $contenttype = 'application/octet-stream'], [string $cid = false]) -
    - -
    -  - void - clearAttachments - () -
    - -
    -  - array - getAttachments - () -
    - -
    -  - string - getHTTPBody - (string $soapmsg) -
    - -
    -  - string - getHTTPContentType - () -
    - -
    -  - string - getHTTPContentTypeCharset - () -
    - -
    -  - mixed - parseResponse - (array $headers, string $data) -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - string - $mimeContentType - (line 71) - -
    - - -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $requestAttachments - = array() (line 60) - -
    - - -
      -
    • var: Each array element in the return is an associative array with keys data, filename, contenttype, cid
    • -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $responseAttachments - (line 66) - -
    - - -
      -
    • var: Each array element in the return is an associative array with keys data, filename, contenttype, cid
    • -
    • access: private
    • -
    - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_client

    -
    - - - nusoap_client::$authtype
    -
    - - - nusoap_client::$bindingType
    -
    - - - nusoap_client::$certRequest
    -
    - - - nusoap_client::$cookies
    -
    - - - nusoap_client::$curl_options
    -
    - - - nusoap_client::$decode_utf8
    -
    - - - nusoap_client::$defaultRpcParams
    -
    - - - nusoap_client::$document
    -
    - - - nusoap_client::$endpoint
    -
    - - - nusoap_client::$endpointType
    -
    - - - nusoap_client::$fault
    -
    - - - nusoap_client::$faultcode
    -
    - - - nusoap_client::$faultdetail
    -
    - - - nusoap_client::$faultstring
    -
    - - - nusoap_client::$forceEndpoint
    -
    - - - nusoap_client::$http_encoding
    -
    - - - nusoap_client::$operations
    -
    - - - nusoap_client::$password
    -
    - - - nusoap_client::$persistentConnection
    -
    - - - nusoap_client::$portName
    -
    - - - nusoap_client::$proxyhost
    -
    - - - nusoap_client::$proxypassword
    -
    - - - nusoap_client::$proxyport
    -
    - - - nusoap_client::$proxyusername
    -
    - - - nusoap_client::$request
    -
    - - - nusoap_client::$requestHeaders
    -
    - - - nusoap_client::$response
    -
    - - - nusoap_client::$responseData
    -
    - - - nusoap_client::$responseHeader
    -
    - - - nusoap_client::$responseHeaders
    -
    - - - nusoap_client::$response_timeout
    -
    - - - nusoap_client::$timeout
    -
    - - - nusoap_client::$username
    -
    - - - nusoap_client::$use_curl
    -
    - - - nusoap_client::$xml_encoding
    -
    -
    -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - addAttachment (line 88) -
    - - -

    adds a MIME attachment to the current request.

    -

    If the $data parameter contains an empty string, this method will read the contents of the file named by the $filename parameter.

    If the $cid parameter is false, this method will generate the cid.

    -
      -
    • return: The content-id (cid) of the attachment
    • -
    • access: public
    • -
    - -
    - string - - addAttachment - - (string $data, [string $filename = ''], [string $contenttype = 'application/octet-stream'], [string $cid = false]) -
    - -
      -
    • - string - $data: The data of the attachment
    • -
    • - string - $filename: The filename of the attachment (default is empty string)
    • -
    • - string - $contenttype: The MIME Content-Type of the attachment (default is application/octet-stream)
    • -
    • - string - $cid: The content-id (cid) of the attachment (default is false)
    • -
    - - -
    - -
    - -
    - - clearAttachments (line 108) -
    - - -

    clears the MIME attachments for the current request.

    -
      -
    • access: public
    • -
    - -
    - void - - clearAttachments - - () -
    - - - -
    - -
    - -
    - - getAttachments (line 122) -
    - - -

    gets the MIME attachments from the current response.

    -

    Each array element in the return is an associative array with keys data, filename, contenttype, cid. These keys correspond to the parameters for addAttachment.

    -
      -
    • return: The attachments.
    • -
    • access: public
    • -
    - -
    - array - - getAttachments - - () -
    - - - -
    - -
    - -
    - - getHTTPBody (line 133) -
    - - -

    gets the HTTP body for the current request.

    -
      -
    • return: The HTTP body, which includes the SOAP payload
    • -
    • access: private
    • -
    - -
    - string - - getHTTPBody - - (string $soapmsg) -
    - -
      -
    • - string - $soapmsg: The SOAP payload
    • -
    - -
    -
    Redefinition of:
    -
    -
    nusoap_client::getHTTPBody()
    -
    gets the HTTP body for the current request.
    -
    - -
    - -
    - -
    - - getHTTPContentType (line 192) -
    - - -

    gets the HTTP content type for the current request.

    -

    Note: getHTTPBody must be called before this.

    -
      -
    • return: the HTTP content type for the current request.
    • -
    • access: private
    • -
    - -
    - string - - getHTTPContentType - - () -
    - - -
    -
    Redefinition of:
    -
    -
    nusoap_client::getHTTPContentType()
    -
    gets the HTTP content type for the current request.
    -
    - -
    - -
    - -
    - - getHTTPContentTypeCharset (line 208) -
    - - -

    gets the HTTP content type charset for the current request.

    -

    returns false for non-text content types.

    Note: getHTTPBody must be called before this.

    -
      -
    • return: the HTTP content type charset for the current request.
    • -
    • access: private
    • -
    - -
    - string - - getHTTPContentTypeCharset - - () -
    - - -
    -
    Redefinition of:
    -
    -
    nusoap_client::getHTTPContentTypeCharset()
    -
    gets the HTTP content type charset for the current request.
    -
    - -
    - -
    - -
    - - parseResponse (line 223) -
    - - -

    processes SOAP message returned from server

    -
      -
    • return: value of the message, decoded into a PHP type
    • -
    • access: private
    • -
    - -
    - mixed - - parseResponse - - (array $headers, string $data) -
    - -
      -
    • - array - $headers: The HTTP headers
    • -
    • - string - $data: unprocessed response data from server
    • -
    - -
    -
    Redefinition of:
    -
    -
    nusoap_client::parseResponse()
    -
    processes SOAP message returned from server
    -
    - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_client

    -
    -  - nusoap_client::nusoap_client()
    -  - nusoap_client::call()
    -  - nusoap_client::checkCookies()
    -  - nusoap_client::checkWSDL()
    -  - nusoap_client::decodeUTF8()
    -  - nusoap_client::getCookies()
    -  - nusoap_client::getDefaultRpcParams()
    -  - nusoap_client::getHeader()
    -  - nusoap_client::getHeaders()
    -  - nusoap_client::getHTTPBody()
    -  - nusoap_client::getHTTPContentType()
    -  - nusoap_client::getHTTPContentTypeCharset()
    -  - nusoap_client::getOperationData()
    -  - nusoap_client::getProxy()
    -  - nusoap_client::getProxyClassCode()
    -  - nusoap_client::loadWSDL()
    -  - nusoap_client::parseResponse()
    -  - nusoap_client::send()
    -  - nusoap_client::setCookie()
    -  - nusoap_client::setCredentials()
    -  - nusoap_client::setCurlOption()
    -  - nusoap_client::setDefaultRpcParams()
    -  - nusoap_client::setEndpoint()
    -  - nusoap_client::setHeaders()
    -  - nusoap_client::setHTTPEncoding()
    -  - nusoap_client::setHTTPProxy()
    -  - nusoap_client::setUseCURL()
    -  - nusoap_client::UpdateCookies()
    -  - nusoap_client::useHTTPPersistentConnection()
    -  - nusoap_client::_getProxyClassCode()
    -
    - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:10 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_fault.html b/lib/nusoap/docs/docs/nusoap/nusoap_fault.html deleted file mode 100644 index e87dfc133..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_fault.html +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - Docs For Class nusoap_fault - - - - -
    -

     Class nusoap_fault

    - - -
    -
    Description
    - -
    - -

    Contains information for a SOAP fault.

    -

    Mainly used for returning faults from deployed functions in a server instance.

    -
      -
    • access: public
    • -
    • version: $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
    • -
    • author: Dietrich Ayala <dietrich@ganx4.com>
    • -
    -

    - Located in /nusoap.php (line 1007) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_fault
    - -
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - -
    ClassDescription
    -  class - soap_fault - - Backward compatibility -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - string - $faultactor -
    -
    -  - string - $faultcode -
    -
    -  - mixed - $faultdetail -
    -
    -  - string - $faultstring -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - nusoap_fault - nusoap_fault - (string $faultcode, [string $faultactor = ''], [string $faultstring = ''], [mixed $faultdetail = '']) -
    - -
    -  - string - serialize - () -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - string - $faultactor - (line 1019) - -
    - - -

    The fault actor

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $faultcode - (line 1013) - -
    - - -

    The fault code (client|server)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $faultdetail - (line 1031) - -
    - - -

    The fault detail, typically a string or array of string

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $faultstring - (line 1025) - -
    - - -

    The fault string, a description of the fault

    -
      -
    • access: private
    • -
    - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor nusoap_fault (line 1041) -
    - - -

    constructor

    - -
    - nusoap_fault - - nusoap_fault - - (string $faultcode, [string $faultactor = ''], [string $faultstring = ''], [mixed $faultdetail = '']) -
    - -
      -
    • - string - $faultcode: (SOAP-ENV:Client | SOAP-ENV:Server)
    • -
    • - string - $faultactor: only used when msg routed between multiple actors
    • -
    • - string - $faultstring: human readable error message
    • -
    • - mixed - $faultdetail: detail, typically a string or array of string
    • -
    - - -
    - -
    - -
    - - serialize (line 1055) -
    - - -

    serialize a fault

    -
      -
    • return: The serialization of the fault instance.
    • -
    • access: public
    • -
    - -
    - string - - serialize - - () -
    - - - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:03 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_parser.html b/lib/nusoap/docs/docs/nusoap/nusoap_parser.html deleted file mode 100644 index 96b675403..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_parser.html +++ /dev/null @@ -1,1324 +0,0 @@ - - - - - - Docs For Class nusoap_parser - - - - -
    -

     Class nusoap_parser

    - - -
    -
    Description
    - -
    - -

    nusoap_parser class parses SOAP XML messages into native PHP values

    - -

    - Located in /nusoap.php (line 6446) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_parser
    - -
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - -
    ClassDescription
    -  class - soap_parser - - Backward compatibility -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - mixed - $body_position -
    -
    -  - mixed - $debug_flag -
    -
    -  - mixed - $decode_utf8 -
    -
    -  - mixed - $default_namespace -
    -
    -  - mixed - $depth -
    -
    -  - mixed - $depth_array -
    -
    -  - mixed - $document -
    -
    -  - mixed - $fault -
    -
    -  - mixed - $fault_code -
    -
    -  - mixed - $fault_detail -
    -
    -  - mixed - $fault_str -
    -
    -  - mixed - $ids -
    -
    -  - mixed - $message -
    -
    -  - mixed - $method -
    -
    -  - mixed - $multirefs -
    -
    -  - mixed - $namespaces -
    -
    -  - mixed - $parent -
    -
    -  - mixed - $position -
    -
    -  - mixed - $responseHeaders -
    -
    -  - mixed - $root_header -
    -
    -  - mixed - $root_struct -
    -
    -  - mixed - $root_struct_name -
    -
    -  - mixed - $root_struct_namespace -
    -
    -  - mixed - $soapheader -
    -
    -  - mixed - $soapresponse -
    -
    -  - mixed - $status -
    -
    -  - mixed - $xml -
    -
    -  - mixed - $xml_encoding -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - nusoap_parser - nusoap_parser - (string $xml, [string $encoding = 'UTF-8'], [string $method = ''], [string $decode_utf8 = true]) -
    - -
    -  - mixed - buildVal - (integer $pos) -
    - -
    -  - void - character_data - (resource $parser, string $data) -
    - -
    -  - mixed - decodeSimple - (string $value, string $type, string $typens) -
    - -
    -  - void - end_element - (resource $parser, string $name) -
    - -
    -  - string - getHeaders - () -
    - -
    -  - mixed - get_response - () -
    - -
    -  - mixed - get_soapbody - () -
    - -
    -  - mixed - get_soapheader - () -
    - -
    -  - void - start_element - (resource $parser, string $name, array $attrs) -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - mixed - $body_position - = 0 (line 6473) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $debug_flag - = true (line 6469) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $decode_utf8 - = true (line 6480) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $default_namespace - = '' (line 6460) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $depth - = 0 (line 6459) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $depth_array - = array() (line 6468) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $document - = '' (line 6455) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $fault - = false (line 6464) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $fault_code - = '' (line 6465) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $fault_detail - = '' (line 6467) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $fault_str - = '' (line 6466) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $ids - = array() (line 6476) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $message - = array() (line 6462) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $method - = '' (line 6450) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $multirefs - = array() (line 6478) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $namespaces - = array() (line 6461) - -
    - - - - -
    -
    Redefinition of:
    -
    -
    nusoap_base::$namespaces
    -
    namespaces in an array of prefix => uri
    -
    - - - -
    - -
    - -
    - - - mixed - $parent - = '' (line 6463) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $position - = 0 (line 6458) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $responseHeaders - = '' (line 6472) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $root_header - = '' (line 6454) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $root_struct - = '' (line 6451) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $root_struct_name - = '' (line 6452) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $root_struct_namespace - = '' (line 6453) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $soapheader - = NULL (line 6471) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $soapresponse - = NULL (line 6470) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $status - = '' (line 6457) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $xml - = '' (line 6448) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $xml_encoding - = '' (line 6449) - -
    - - - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor nusoap_parser (line 6491) -
    - - -

    constructor that actually does the parsing

    -
      -
    • access: public
    • -
    - -
    - nusoap_parser - - nusoap_parser - - (string $xml, [string $encoding = 'UTF-8'], [string $method = ''], [string $decode_utf8 = true]) -
    - -
      -
    • - string - $xml: SOAP message
    • -
    • - string - $encoding: character encoding scheme of message
    • -
    • - string - $method: method for which XML is parsed (unused?)
    • -
    • - string - $decode_utf8: whether to decode UTF-8 to ISO-8859-1
    • -
    - - -
    - -
    - -
    - - buildVal (line 6959) -
    - - -

    builds response structures for compound values (arrays/structs) and scalars

    -
      -
    • return: PHP value
    • -
    • access: private
    • -
    - -
    - mixed - - buildVal - - (integer $pos) -
    - -
      -
    • - integer - $pos: position in node tree
    • -
    - - -
    - -
    - -
    - - character_data (line 6846) -
    - - -

    element content handler

    -
      -
    • access: private
    • -
    - -
    - void - - character_data - - (resource $parser, string $data) -
    - -
      -
    • - resource - $parser: XML parser object
    • -
    • - string - $data: element content
    • -
    - - -
    - -
    - -
    - - decodeSimple (line 6915) -
    - - -

    decodes simple types into PHP variables

    -
      -
    • return: PHP value
    • -
    • access: private
    • -
    - -
    - mixed - - decodeSimple - - (string $value, string $type, string $typens) -
    - -
      -
    • - string - $value: value to decode
    • -
    • - string - $type: XML type to decode
    • -
    • - string - $typens: XML type namespace to decode
    • -
    - - -
    - -
    - -
    - - end_element (line 6740) -
    - - -

    end-element handler

    -
      -
    • access: private
    • -
    - -
    - void - - end_element - - (resource $parser, string $name) -
    - -
      -
    • - resource - $parser: XML parser object
    • -
    • - string - $name: element name
    • -
    - - -
    - -
    - -
    - - getHeaders (line 6902) -
    - - -

    get the unparsed SOAP Header

    -
      -
    • return: XML or empty if no Header
    • -
    • access: public
    • -
    - -
    - string - - getHeaders - - () -
    - - - -
    - -
    - -
    - - get_response (line 6872) -
    - - -

    get the parsed message (SOAP Body)

    -
      -
    • deprecated: use get_soapbody instead
    • -
    • access: public
    • -
    - -
    - mixed - - get_response - - () -
    - - - -
    - -
    - -
    - - get_soapbody (line 6882) -
    - - -

    get the parsed SOAP Body (NULL if there was none)

    -
      -
    • access: public
    • -
    - -
    - mixed - - get_soapbody - - () -
    - - - -
    - -
    - -
    - - get_soapheader (line 6892) -
    - - -

    get the parsed SOAP Header (NULL if there was none)

    -
      -
    • access: public
    • -
    - -
    - mixed - - get_soapheader - - () -
    - - - -
    - -
    - -
    - - start_element (line 6585) -
    - - -

    start-element handler

    -
      -
    • access: private
    • -
    - -
    - void - - start_element - - (resource $parser, string $name, array $attrs) -
    - -
      -
    • - resource - $parser: XML parser object
    • -
    • - string - $name: element name
    • -
    • - array - $attrs: associative array of attributes
    • -
    - - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:03 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_server.html b/lib/nusoap/docs/docs/nusoap/nusoap_server.html deleted file mode 100644 index 1204b6081..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_server.html +++ /dev/null @@ -1,1620 +0,0 @@ - - - - - - Docs For Class nusoap_server - - - - -
    -

     Class nusoap_server

    - - -
    -
    Description
    - -
    - -

    nusoap_server allows the user to create a SOAP server that is capable of receiving messages and returning responses

    - -

    - Located in /nusoap.php (line 3473) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_server
    - -
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - - - - - -
    ClassDescription
    -  class - soap_server - - Backward compatibility -
    -  class - nusoap_server_mime - - nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - boolean - $debug_flag -
    -
    -  - boolean - $decode_utf8 -
    -
    -  - string - $document -
    -
    -  - mixed - $externalWSDLURL -
    -
    -  - mixed - $fault -
    -
    -  - array - $headers -
    -
    -  - string - $methodname -
    -
    -  - array - $methodparams -
    -
    -  - mixed - $methodreturn -
    -
    -  - boolean - $methodreturnisliteralxml -
    -
    -  - string - $methodURI -
    -
    -  - array - $operations -
    -
    -  - array - $outgoing_headers -
    -
    -  - string - $request -
    -
    -  - mixed - $requestHeader -
    -
    -  - string - $requestHeaders -
    -
    -  - string - $requestSOAP -
    -
    -  - string - $response -
    -
    -  - mixed - $responseHeaders -
    -
    -  - string - $responseSOAP -
    -
    -  - string - $result -
    -
    -  - string - $SOAPAction -
    -
    -  - mixed - $wsdl -
    -
    -  - string - $xml_encoding -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - nusoap_server - nusoap_server - ([mixed $wsdl = false]) -
    - -
    -  - void - add_to_map - (string $methodname, string $in, string $out) -
    - -
    -  - void - configureWSDL - (mixed $serviceName, [mixed $namespace = false], [mixed $endpoint = false], [string $style = 'rpc'], [string $transport = 'http://schemas.xmlsoap.org/soap/http'], [mixed $schemaTargetNamespace = false], string $serviceName,) -
    - -
    -  - void - fault - (string $faultcode, string $faultstring, [string $faultactor = ''], [string $faultdetail = '']) -
    - -
    -  - string - getHTTPBody - (string $soapmsg) -
    - -
    -  - string - getHTTPContentType - () -
    - -
    -  - string - getHTTPContentTypeCharset - () -
    - -
    -  - void - invoke_method - () -
    - -
    -  - mixed - parseRequest - (array $headers, string $data) -
    - -
    -  - void - parse_http_headers - () -
    - -
    -  - void - parse_request - ([string $data = '']) -
    - -
    -  - void - register - (string $name, [array $in = array()], [array $out = array()], [mixed $namespace = false], [mixed $soapaction = false], [mixed $style = false], [mixed $use = false], [string $documentation = ''], [string $encodingStyle = '']) -
    - -
    -  - void - send_response - () -
    - -
    -  - void - serialize_return - () -
    - -
    -  - void - service - (string $data) -
    - -
    -  - boolean - verify_method - (string $operation, array $request) -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - boolean - $debug_flag - = false (line 3620) - -
    - - -

    whether to append debug to response as XML comment

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - boolean - $decode_utf8 - = true (line 3545) - -
    - - -

    toggles whether the parser decodes element content w/ utf8_decode()

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - string - $document - = '' (line 3503) - -
    - - -

    SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text)

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $externalWSDLURL - = false (line 3614) - -
    - - -

    URL for WSDL (if one)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $fault - = false (line 3588) - -
    - - -

    SOAP fault for response (or false)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $headers - = array() (line 3479) - -
    - - -

    HTTP headers of request

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $methodname - = '' (line 3521) - -
    - - -

    name of method requested

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $methodparams - = array() (line 3527) - -
    - - -

    method parameters from request

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $methodreturn - = false (line 3576) - -
    - - -

    method return value to place in response

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - boolean - $methodreturnisliteralxml - = false (line 3582) - -
    - - -

    whether $methodreturn is a string of literal XML

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - string - $methodURI - = '' (line 3515) - -
    - - -

    requested method namespace URI

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $operations - = array() (line 3602) - -
    - - -

    assoc array of operations => opData; operations are added by the register()

    -

    method or by parsing an external WSDL definition

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $outgoing_headers - = array() (line 3552) - -
    - - -

    HTTP headers of response

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - string - $request - = '' (line 3485) - -
    - - -

    HTTP request

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $requestHeader - = NULL (line 3497) - -
    - - -

    SOAP Headers from request (parsed)

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - string - $requestHeaders - = '' (line 3491) - -
    - - -

    SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text)

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - string - $requestSOAP - = '' (line 3509) - -
    - - -

    SOAP payload for request (text)

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - string - $response - = '' (line 3558) - -
    - - -

    HTTP response

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $responseHeaders - = '' (line 3564) - -
    - - -

    SOAP headers for response (text or array of soapval or associative array)

    -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - string - $responseSOAP - = '' (line 3570) - -
    - - -

    SOAP payload for response (text)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $result - = 'successful' (line 3594) - -
    - - -

    text indication of result (for debugging)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $SOAPAction - = '' (line 3533) - -
    - - -

    SOAP Action from request

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $wsdl - = false (line 3608) - -
    - - -

    wsdl instance (if one)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $xml_encoding - = '' (line 3539) - -
    - - -

    character set encoding of incoming (request) messages

    -
      -
    • access: public
    • -
    - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor nusoap_server (line 3630) -
    - - -

    constructor the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.

    -
      -
    • access: public
    • -
    - -
    - nusoap_server - - nusoap_server - - ([mixed $wsdl = false]) -
    - -
      -
    • - mixed - $wsdl: file path or URL (string), or wsdl instance (object)
    • -
    - - -
    - -
    - -
    - - add_to_map (line 4399) -
    - - -

    add a method to the dispatch map (this has been replaced by the register method)

    -
      -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - void - - add_to_map - - (string $methodname, string $in, string $out) -
    - -
      -
    • - string - $methodname
    • -
    • - string - $in: array of input values
    • -
    • - string - $out: array of output values
    • -
    - - -
    - -
    - -
    - - configureWSDL (line 4505) -
    - - -

    Sets up wsdl object.

    -

    Acts as a flag to enable internal WSDL generation

    - -
    - void - - configureWSDL - - (mixed $serviceName, [mixed $namespace = false], [mixed $endpoint = false], [string $style = 'rpc'], [string $transport = 'http://schemas.xmlsoap.org/soap/http'], [mixed $schemaTargetNamespace = false], string $serviceName,) -
    - -
      -
    • - string - $serviceName,: name of the service
    • -
    • - mixed - $namespace: optional 'tns' service namespace or false
    • -
    • - mixed - $endpoint: optional URL of service endpoint or false
    • -
    • - string - $style: optional (rpc|document) WSDL style (also specified by operation)
    • -
    • - string - $transport: optional SOAP transport
    • -
    • - mixed - $schemaTargetNamespace: optional 'types' targetNamespace for service schema or false
    • -
    - - -
    - -
    - -
    - - fault (line 4486) -
    - - -

    Specify a fault to be returned to the client.

    -

    This also acts as a flag to the server that a fault has occured.

    -
      -
    • access: public
    • -
    - -
    - void - - fault - - (string $faultcode, string $faultstring, [string $faultactor = ''], [string $faultdetail = '']) -
    - -
      -
    • - string - $faultcode
    • -
    • - string - $faultstring
    • -
    • - string - $faultactor
    • -
    • - string - $faultdetail
    • -
    - - -
    - -
    - -
    - - getHTTPBody (line 4361) -
    - - -

    gets the HTTP body for the current response.

    -
      -
    • return: The HTTP body, which includes the SOAP payload
    • -
    • access: private
    • -
    - -
    - string - - getHTTPBody - - (string $soapmsg) -
    - -
      -
    • - string - $soapmsg: The SOAP payload
    • -
    - - -
    -
    Redefined in descendants as:
    - -
    - -
    - -
    - - getHTTPContentType (line 4373) -
    - - -

    gets the HTTP content type for the current response.

    -

    Note: getHTTPBody must be called before this.

    -
      -
    • return: the HTTP content type for the current response.
    • -
    • access: private
    • -
    - -
    - string - - getHTTPContentType - - () -
    - - - -
    -
    Redefined in descendants as:
    - -
    - -
    - -
    - - getHTTPContentTypeCharset (line 4386) -
    - - -

    gets the HTTP content type charset for the current response.

    -

    returns false for non-text content types.

    Note: getHTTPBody must be called before this.

    -
      -
    • return: the HTTP content type charset for the current response.
    • -
    • access: private
    • -
    - -
    - string - - getHTTPContentTypeCharset - - () -
    - - - -
    -
    Redefined in descendants as:
    - -
    - -
    - -
    - - invoke_method (line 3950) -
    - - -

    invokes a PHP function for the requested SOAP method

    -

    The following fields are set by this function (when successful)

    methodreturn

    Note that the PHP function that is called may also set the following fields to affect the response sent to the client

    responseHeaders outgoing_headers

    This sets the fault field on error

    -
      -
    • access: private
    • -
    - -
    - void - - invoke_method - - () -
    - - - -
    - -
    - -
    - - parseRequest (line 4305) -
    - - -

    processes SOAP message received from client

    -
      -
    • return: value of the message, decoded into a PHP type
    • -
    • access: private
    • -
    - -
    - mixed - - parseRequest - - (array $headers, string $data) -
    - -
      -
    • - array - $headers: The HTTP headers
    • -
    • - string - $data: unprocessed request data from client
    • -
    - - -
    -
    Redefined in descendants as:
    - -
    - -
    - -
    - - parse_http_headers (line 3777) -
    - - -

    parses HTTP request headers.

    -

    The following fields are set by this function (when successful)

    headers request xml_encoding SOAPAction

    -
      -
    • access: private
    • -
    - -
    - void - - parse_http_headers - - () -
    - - - -
    - -
    - -
    - - parse_request (line 3903) -
    - - -

    parses a request

    -

    The following fields are set by this function (when successful)

    headers request xml_encoding SOAPAction request requestSOAP methodURI methodname methodparams requestHeaders document

    This sets the fault field on error

    -
      -
    • access: private
    • -
    - -
    - void - - parse_request - - ([string $data = '']) -
    - -
      -
    • - string - $data: XML string
    • -
    - - -
    - -
    - -
    - - register (line 4417) -
    - - -

    register a service function with the server

    -
      -
    • access: public
    • -
    - -
    - void - - register - - (string $name, [array $in = array()], [array $out = array()], [mixed $namespace = false], [mixed $soapaction = false], [mixed $style = false], [mixed $use = false], [string $documentation = ''], [string $encodingStyle = '']) -
    - -
      -
    • - string - $name: the name of the PHP function, class.method or class..method
    • -
    • - array - $in: assoc array of input values: key = param name, value = param type
    • -
    • - array - $out: assoc array of output values: key = param name, value = param type
    • -
    • - mixed - $namespace: the element namespace for the method or false
    • -
    • - mixed - $soapaction: the soapaction for the method or false
    • -
    • - mixed - $style: optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
    • -
    • - mixed - $use: optional (encoded|literal) or false
    • -
    • - string - $documentation: optional Description to include in WSDL
    • -
    • - string - $encodingStyle: optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
    • -
    - - -
    - -
    - -
    - - send_response (line 4207) -
    - - -

    sends an HTTP response

    -

    The following fields are set by this function (when successful)

    outgoing_headers response

    -
      -
    • access: private
    • -
    - -
    - void - - send_response - - () -
    - - - -
    - -
    - -
    - - serialize_return (line 4107) -
    - - -

    serializes the return value from a PHP function into a full SOAP Envelope

    -

    The following fields are set by this function (when successful)

    responseSOAP

    This sets the fault field on error

    -
      -
    • access: private
    • -
    - -
    - void - - serialize_return - - () -
    - - - -
    - -
    - -
    - - service (line 3693) -
    - - -

    processes request and returns response

    -
      -
    • access: public
    • -
    - -
    - void - - service - - (string $data) -
    - -
      -
    • - string - $data: usually is the value of $HTTP_RAW_POST_DATA
    • -
    - - -
    - -
    - -
    - - verify_method (line 4286) -
    - - -

    takes the value that was created by parsing the request and compares to the method's signature, if available.

    -
      -
    • return: Whether the operation was found
    • -
    • access: private
    • -
    - -
    - boolean - - verify_method - - (string $operation, array $request) -
    - -
      -
    • - string - $operation: The operation to be invoked
    • -
    • - array - $request: The array of parameter values
    • -
    - - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:04 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_server_mime.html b/lib/nusoap/docs/docs/nusoap/nusoap_server_mime.html deleted file mode 100644 index cc388955e..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_server_mime.html +++ /dev/null @@ -1,774 +0,0 @@ - - - - - - Docs For Class nusoap_server_mime - - - - -
    -

     Class nusoap_server_mime

    - - -
    -
    Description
    - -
    - -

    nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.

    -
      -
    • access: public
    • -
    • version: $Id: nusoapmime.php,v 1.13 2010/04/26 20:15:08 snichol Exp $
    • -
    • author: Scott Nichol <snichol@users.sourceforge.net>
    • -
    • author: Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
    • -
    -

    - Located in /nusoapmime.php (line 284) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_server
    -      |
    -      --nusoap_server_mime
    - -
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - -
    ClassDescription
    -  class - nusoapservermime - - nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - string - $mimeContentType -
    -
    -  - array - $requestAttachments -
    -
    -  - array - $responseAttachments -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - string - addAttachment - (string $data, [string $filename = ''], [string $contenttype = 'application/octet-stream'], [string $cid = false]) -
    - -
    -  - void - clearAttachments - () -
    - -
    -  - array - getAttachments - () -
    - -
    -  - string - getHTTPBody - (string $soapmsg) -
    - -
    -  - string - getHTTPContentType - () -
    - -
    -  - string - getHTTPContentTypeCharset - () -
    - -
    -  - mixed - parseRequest - (array $headers, string $data) -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - string - $mimeContentType - (line 301) - -
    - - -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $requestAttachments - = array() (line 290) - -
    - - -
      -
    • var: Each array element in the return is an associative array with keys data, filename, contenttype, cid
    • -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - array - $responseAttachments - (line 296) - -
    - - -
      -
    • var: Each array element in the return is an associative array with keys data, filename, contenttype, cid
    • -
    • access: private
    • -
    - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_server

    -
    - - - nusoap_server::$debug_flag
    -
    - - - nusoap_server::$decode_utf8
    -
    - - - nusoap_server::$document
    -
    - - - nusoap_server::$externalWSDLURL
    -
    - - - nusoap_server::$fault
    -
    - - - nusoap_server::$headers
    -
    - - - nusoap_server::$methodname
    -
    - - - nusoap_server::$methodparams
    -
    - - - nusoap_server::$methodreturn
    -
    - - - nusoap_server::$methodreturnisliteralxml
    -
    - - - nusoap_server::$methodURI
    -
    - - - nusoap_server::$operations
    -
    - - - nusoap_server::$outgoing_headers
    -
    - - - nusoap_server::$request
    -
    - - - nusoap_server::$requestHeader
    -
    - - - nusoap_server::$requestHeaders
    -
    - - - nusoap_server::$requestSOAP
    -
    - - - nusoap_server::$response
    -
    - - - nusoap_server::$responseHeaders
    -
    - - - nusoap_server::$responseSOAP
    -
    - - - nusoap_server::$result
    -
    - - - nusoap_server::$SOAPAction
    -
    - - - nusoap_server::$wsdl
    -
    - - - nusoap_server::$xml_encoding
    -
    -
    -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - addAttachment (line 318) -
    - - -

    adds a MIME attachment to the current response.

    -

    If the $data parameter contains an empty string, this method will read the contents of the file named by the $filename parameter.

    If the $cid parameter is false, this method will generate the cid.

    -
      -
    • return: The content-id (cid) of the attachment
    • -
    • access: public
    • -
    - -
    - string - - addAttachment - - (string $data, [string $filename = ''], [string $contenttype = 'application/octet-stream'], [string $cid = false]) -
    - -
      -
    • - string - $data: The data of the attachment
    • -
    • - string - $filename: The filename of the attachment (default is empty string)
    • -
    • - string - $contenttype: The MIME Content-Type of the attachment (default is application/octet-stream)
    • -
    • - string - $cid: The content-id (cid) of the attachment (default is false)
    • -
    - - -
    - -
    - -
    - - clearAttachments (line 338) -
    - - -

    clears the MIME attachments for the current response.

    -
      -
    • access: public
    • -
    - -
    - void - - clearAttachments - - () -
    - - - -
    - -
    - -
    - - getAttachments (line 352) -
    - - -

    gets the MIME attachments from the current request.

    -

    Each array element in the return is an associative array with keys data, filename, contenttype, cid. These keys correspond to the parameters for addAttachment.

    -
      -
    • return: The attachments.
    • -
    • access: public
    • -
    - -
    - array - - getAttachments - - () -
    - - - -
    - -
    - -
    - - getHTTPBody (line 363) -
    - - -

    gets the HTTP body for the current response.

    -
      -
    • return: The HTTP body, which includes the SOAP payload
    • -
    • access: private
    • -
    - -
    - string - - getHTTPBody - - (string $soapmsg) -
    - -
      -
    • - string - $soapmsg: The SOAP payload
    • -
    - -
    -
    Redefinition of:
    -
    -
    nusoap_server::getHTTPBody()
    -
    gets the HTTP body for the current response.
    -
    - -
    - -
    - -
    - - getHTTPContentType (line 422) -
    - - -

    gets the HTTP content type for the current response.

    -

    Note: getHTTPBody must be called before this.

    -
      -
    • return: the HTTP content type for the current response.
    • -
    • access: private
    • -
    - -
    - string - - getHTTPContentType - - () -
    - - -
    -
    Redefinition of:
    -
    -
    nusoap_server::getHTTPContentType()
    -
    gets the HTTP content type for the current response.
    -
    - -
    - -
    - -
    - - getHTTPContentTypeCharset (line 438) -
    - - -

    gets the HTTP content type charset for the current response.

    -

    returns false for non-text content types.

    Note: getHTTPBody must be called before this.

    -
      -
    • return: the HTTP content type charset for the current response.
    • -
    • access: private
    • -
    - -
    - string - - getHTTPContentTypeCharset - - () -
    - - -
    -
    Redefinition of:
    -
    -
    nusoap_server::getHTTPContentTypeCharset()
    -
    gets the HTTP content type charset for the current response.
    -
    - -
    - -
    - -
    - - parseRequest (line 453) -
    - - -

    processes SOAP message received from client

    -
      -
    • return: value of the message, decoded into a PHP type
    • -
    • access: private
    • -
    - -
    - mixed - - parseRequest - - (array $headers, string $data) -
    - -
      -
    • - array - $headers: The HTTP headers
    • -
    • - string - $data: unprocessed request data from client
    • -
    - -
    -
    Redefinition of:
    -
    -
    nusoap_server::parseRequest()
    -
    processes SOAP message received from client
    -
    - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_server

    -
    -  - nusoap_server::nusoap_server()
    -  - nusoap_server::add_to_map()
    -  - nusoap_server::configureWSDL()
    -  - nusoap_server::fault()
    -  - nusoap_server::getHTTPBody()
    -  - nusoap_server::getHTTPContentType()
    -  - nusoap_server::getHTTPContentTypeCharset()
    -  - nusoap_server::invoke_method()
    -  - nusoap_server::parseRequest()
    -  - nusoap_server::parse_http_headers()
    -  - nusoap_server::parse_request()
    -  - nusoap_server::register()
    -  - nusoap_server::send_response()
    -  - nusoap_server::serialize_return()
    -  - nusoap_server::service()
    -  - nusoap_server::verify_method()
    -
    - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:10 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_wsdlcache.html b/lib/nusoap/docs/docs/nusoap/nusoap_wsdlcache.html deleted file mode 100644 index 20aa98815..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_wsdlcache.html +++ /dev/null @@ -1,568 +0,0 @@ - - - - - - Docs For Class nusoap_wsdlcache - - - - -
    -

     Class nusoap_wsdlcache

    - - -
    -
    Description
    - -
    - -

    caches instances of the wsdl class

    - -

    - Located in /class.wsdlcache.php (line 18) -

    - - -
    
    -	
    -			
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - -
    ClassDescription
    -  class - wsdlcache - - For backward compatibility -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - string - $cache_dir -
    -
    -  - integer - $cache_lifetime -
    -
    -  - string - $debug_str -
    -
    -  - resource - $fplock -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - nusoap_wsdlcache - nusoap_wsdlcache - ([string $cache_dir = '.'], integer $cache_lifetime) -
    - -
    -  - string - createFilename - (string $wsdl) -
    - -
    -  - void - debug - (string $string) -
    - -
    -  - object wsdl - get - (string $wsdl) -
    - -
    -  - boolean - obtainMutex - (string $filename, string $mode) -
    - -
    -  - boolean - put - (object wsdl $wsdl_instance) -
    - -
    -  - boolean - releaseMutex - (string $filename) -
    - -
    -  - boolean - remove - (string $wsdl) -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - string - $cache_dir - (line 33) - -
    - - -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - integer - $cache_lifetime - (line 28) - -
    - - -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $debug_str - = '' (line 38) - -
    - - -
      -
    • access: public
    • -
    - - - - - -
    - -
    - -
    - - - resource - $fplock - (line 23) - -
    - - -
      -
    • access: private
    • -
    - - - - - -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor nusoap_wsdlcache (line 47) -
    - - -

    constructor

    -
      -
    • access: public
    • -
    - -
    - nusoap_wsdlcache - - nusoap_wsdlcache - - ([string $cache_dir = '.'], integer $cache_lifetime) -
    - -
      -
    • - string - $cache_dir: directory for cache-files
    • -
    • - integer - $cache_lifetime: lifetime for caching-files in seconds or 0 for unlimited
    • -
    - - -
    - -
    - -
    - - createFilename (line 60) -
    - - -

    creates the filename used to cache a wsdl instance

    -
      -
    • return: The filename used to cache the instance
    • -
    • access: private
    • -
    - -
    - string - - createFilename - - (string $wsdl) -
    - -
      -
    • - string - $wsdl: The URL of the wsdl instance
    • -
    - - -
    - -
    - -
    - - debug (line 70) -
    - - -

    adds debug data to the class level debug string

    -
      -
    • access: private
    • -
    - -
    - void - - debug - - (string $string) -
    - -
      -
    • - string - $string: debug data
    • -
    - - -
    - -
    - -
    - - get (line 81) -
    - - -

    gets a wsdl instance from the cache

    -
      -
    • return: The cached wsdl instance, null if the instance is not in the cache
    • -
    • access: public
    • -
    - -
    - object wsdl - - get - - (string $wsdl) -
    - -
      -
    • - string - $wsdl: The URL of the wsdl instance
    • -
    - - -
    - -
    - -
    - - obtainMutex (line 124) -
    - - -

    obtains the local mutex

    -
      -
    • return: Lock successfully obtained ?!
    • -
    • access: private
    • -
    - -
    - boolean - - obtainMutex - - (string $filename, string $mode) -
    - -
      -
    • - string - $filename: The Filename of the Cache to lock
    • -
    • - string - $mode: The open-mode ("r" or "w") or the file - affects lock-mode
    • -
    - - -
    - -
    - -
    - - put (line 144) -
    - - -

    adds a wsdl instance to the cache

    -
      -
    • return: WSDL successfully cached
    • -
    • access: public
    • -
    - -
    - boolean - - put - - (object wsdl $wsdl_instance) -
    - -
      -
    • - object wsdl - $wsdl_instance: The wsdl instance to add
    • -
    - - -
    - -
    - -
    - - releaseMutex (line 172) -
    - - -

    releases the local mutex

    -
      -
    • return: Lock successfully released
    • -
    • access: private
    • -
    - -
    - boolean - - releaseMutex - - (string $filename) -
    - -
      -
    • - string - $filename: The Filename of the Cache to lock
    • -
    - - -
    - -
    - -
    - - remove (line 189) -
    - - -

    removes a wsdl instance from the cache

    -
      -
    • return: Whether there was an instance to remove
    • -
    • access: public
    • -
    - -
    - boolean - - remove - - (string $wsdl) -
    - -
      -
    • - string - $wsdl: The URL of the wsdl instance
    • -
    - - -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:16:49 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoap_xmlschema.html b/lib/nusoap/docs/docs/nusoap/nusoap_xmlschema.html deleted file mode 100644 index d01415b07..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoap_xmlschema.html +++ /dev/null @@ -1,1462 +0,0 @@ - - - - - - Docs For Class nusoap_xmlschema - - - - -
    -

     Class nusoap_xmlschema

    - - -
    -
    Description
    - -
    - -

    parses an XML Schema, allows access to it's data, other utility methods.

    -

    imperfect, no validation... yet, but quite functional.

    - -

    - Located in /nusoap.php (line 1095) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_xmlschema
    - -
    -
    - - -
    -
    Direct descendents
    - -
    - - - - - - - - - -
    ClassDescription
    -  class - XMLSchema - - Backward compatibility -
    -
    -
    - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - mixed - $attributes -
    -
    -  - mixed - $complexTypes -
    -
    -  - mixed - $complexTypeStack -
    -
    -  - mixed - $currentComplexType -
    -
    -  - mixed - $currentElement -
    -
    -  - mixed - $currentSimpleType -
    -
    -  - mixed - $defaultNamespace -
    -
    -  - mixed - $depth -
    -
    -  - mixed - $depth_array -
    -
    -  - mixed - $elements -
    -
    -  - mixed - $elementStack -
    -
    -  - mixed - $enclosingNamespaces -
    -
    -  - mixed - $imports -
    -
    -  - mixed - $message -
    -
    -  - mixed - $parser -
    -
    -  - mixed - $position -
    -
    -  - mixed - $schema -
    -
    -  - mixed - $schemaInfo -
    -
    -  - mixed - $schemaTargetNamespace -
    -
    -  - mixed - $simpleTypes -
    -
    -  - mixed - $simpleTypeStack -
    -
    -  - mixed - $xml -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - nusoap_xmlschema - nusoap_xmlschema - ([string $schema = ''], [string $xml = ''], [string $namespaces = array()]) -
    - -
    -  - void - addComplexType - (name $name, [typeClass $typeClass = 'complexType'], [phpType: $phpType = 'array'], [compositor $compositor = ''], [restrictionBase $restrictionBase = ''], [elements $elements = array()], [attrs $attrs = array()], [arrayType: $arrayType = '']) -
    - -
    -  - void - addElement - (array $attrs) -
    - -
    -  - void - addSimpleType - (string $name, [string $restrictionBase = ''], [string $typeClass = 'simpleType'], [string $phpType = 'scalar'], [array $enumeration = array()]) -
    - -
    -  - string - CreateTypeName - (string $ename) -
    - -
    -  - mixed - getPHPType - (string $type, string $ns) -
    - -
    -  - mixed - getTypeDef - (string $type) -
    - -
    -  - boolean - parseFile - (string $xml, string $type) -
    - -
    -  - void - parseString - (string $xml, string $type) -
    - -
    -  - void - schemaCharacterData - (string $parser, string $data) -
    - -
    -  - void - schemaEndElement - (string $parser, string $name) -
    - -
    -  - void - schemaStartElement - (string $parser, string $name, string $attrs) -
    - -
    -  - void - serializeSchema - () -
    - -
    -  - mixed - serializeTypeDef - (string $type) -
    - -
    -  - string - typeToForm - (string $name, string $type) -
    - -
    -  - void - xdebug - (string $string) -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - mixed - $attributes - = array() (line 1106) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $complexTypes - = array() (line 1107) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $complexTypeStack - = array() (line 1108) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentComplexType - = null (line 1109) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentElement - = null (line 1112) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentSimpleType - = null (line 1115) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $defaultNamespace - = array() (line 1124) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $depth - = 0 (line 1121) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $depth_array - = array() (line 1122) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $elements - = array() (line 1110) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $elementStack - = array() (line 1111) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $enclosingNamespaces - (line 1101) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $imports - = array() (line 1117) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $message - = array() (line 1123) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $parser - (line 1119) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $position - = 0 (line 1120) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $schema - = '' (line 1098) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $schemaInfo - = array() (line 1103) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $schemaTargetNamespace - = '' (line 1104) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $simpleTypes - = array() (line 1113) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $simpleTypeStack - = array() (line 1114) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $xml - = '' (line 1099) - -
    - - - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor nusoap_xmlschema (line 1134) -
    - - -

    constructor

    -
      -
    • access: public
    • -
    - -
    - nusoap_xmlschema - - nusoap_xmlschema - - ([string $schema = ''], [string $xml = ''], [string $namespaces = array()]) -
    - -
      -
    • - string - $schema: schema document URI
    • -
    • - string - $xml: xml document URI
    • -
    • - string - $namespaces: namespaces defined in enclosing XML
    • -
    - - -
    - -
    - -
    - - addComplexType (line 1985) -
    - - -

    adds a complex type to the schema

    -

    example: array

    addType( 'ArrayOfstring', 'complexType', 'array', '', 'SOAP-ENC:Array', array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), 'xsd:string' );

    example: PHP associative array ( SOAP Struct )

    addType( 'SOAPStruct', 'complexType', 'struct', 'all', array('myVar'=> array('name'=>'myVar','type'=>'string') );

    - - -
    - void - - addComplexType - - (name $name, [typeClass $typeClass = 'complexType'], [phpType: $phpType = 'array'], [compositor $compositor = ''], [restrictionBase $restrictionBase = ''], [elements $elements = array()], [attrs $attrs = array()], [arrayType: $arrayType = '']) -
    - -
      -
    • - name - $name
    • -
    • - typeClass - $typeClass: (complexType|simpleType|attribute)
    • -
    • - phpType: - $phpType: currently supported are array and struct (php assoc array)
    • -
    • - compositor - $compositor: (all|sequence|choice)
    • -
    • - restrictionBase - $restrictionBase: namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
    • -
    • - elements - $elements: = array ( name = array(name=>'',type=>'') )
    • -
    • - attrs - $attrs: = array( array( 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" ) )
    • -
    • - arrayType: - $arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
    • -
    - - -
    - -
    - -
    - - addElement (line 2033) -
    - - -

    adds an element to the schema

    - - -
    - void - - addElement - - (array $attrs) -
    - -
      -
    • - array - $attrs: attributes that must include name and type
    • -
    - - -
    - -
    - -
    - - addSimpleType (line 2013) -
    - - -

    adds a simple type to the schema

    - - -
    - void - - addSimpleType - - (string $name, [string $restrictionBase = ''], [string $typeClass = 'simpleType'], [string $phpType = 'scalar'], [array $enumeration = array()]) -
    - -
      -
    • - string - $name
    • -
    • - string - $restrictionBase: namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
    • -
    • - string - $typeClass: (should always be simpleType)
    • -
    • - string - $phpType: (should always be scalar)
    • -
    • - array - $enumeration: array of values
    • -
    - - -
    - -
    - -
    - - CreateTypeName (line 1240) -
    - - -

    gets a type name for an unnamed type

    -
      -
    • return: A type name for an unnamed type
    • -
    • access: private
    • -
    - -
    - string - - CreateTypeName - - (string $ename) -
    - -
      -
    • - string - $ename: Element name
    • -
    - - -
    - -
    - -
    - - getPHPType (line 1766) -
    - - -

    get the PHP type of a user defined type in the schema

    -

    PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays returns false if no type exists, or not w/ the given namespace else returns a string that is either a native php type, or 'struct'

    -
      -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - mixed - - getPHPType - - (string $type, string $ns) -
    - -
      -
    • - string - $type: name of defined type
    • -
    • - string - $ns: namespace of type
    • -
    - - -
    - -
    - -
    - - getTypeDef (line 1799) -
    - - -

    returns an associative array of information about a given type returns false if no type exists by the given name

    -

    For a complexType typeDef = array( 'restrictionBase' => '', 'phpType' => '', 'compositor' => '(sequence|all)', 'elements' => array(), // refs to elements array 'attrs' => array() // refs to attributes array ... and so on (see addComplexType) )

    For simpleType or element, the array has different keys.

    - - -
    - mixed - - getTypeDef - - (string $type) -
    - -
      -
    • - string - $type
    • -
    - - -
    - -
    - -
    - - parseFile (line 1167) -
    - - -

    parse an XML file

    -
      -
    • access: public
    • -
    - -
    - boolean - - parseFile - - (string $xml, string $type) -
    - -
      -
    • - string - $xml: path/URL to XML file
    • -
    • - string - $type: (schema | xml)
    • -
    - - -
    - -
    - -
    - - parseString (line 1193) -
    - - -

    parse an XML string

    -
      -
    • access: private
    • -
    - -
    - void - - parseString - - (string $xml, string $type) -
    - -
      -
    • - string - $xml: path or URL
    • -
    • - string - $type: (schema|xml)
    • -
    - - -
    - -
    - -
    - - schemaCharacterData (line 1622) -
    - - -

    element content handler

    -
      -
    • access: private
    • -
    - -
    - void - - schemaCharacterData - - (string $parser, string $data) -
    - -
      -
    • - string - $parser: XML parser object
    • -
    • - string - $data: element content
    • -
    - - -
    - -
    - -
    - - schemaEndElement (line 1583) -
    - - -

    end-element handler

    -
      -
    • access: private
    • -
    - -
    - void - - schemaEndElement - - (string $parser, string $name) -
    - -
      -
    • - string - $parser: XML parser object
    • -
    • - string - $name: element name
    • -
    - - -
    - -
    - -
    - - schemaStartElement (line 1256) -
    - - -

    start-element handler

    -
      -
    • access: private
    • -
    - -
    - void - - schemaStartElement - - (string $parser, string $name, string $attrs) -
    - -
      -
    • - string - $parser: XML parser object
    • -
    • - string - $name: element name
    • -
    • - string - $attrs: associative array of attributes
    • -
    - - -
    - -
    - -
    - - serializeSchema (line 1632) -
    - - -

    serialize the schema

    -
      -
    • access: public
    • -
    - -
    - void - - serializeSchema - - () -
    - - - -
    - -
    - -
    - - serializeTypeDef (line 1878) -
    - - -

    returns a sample serialization of a given type, or false if no type by the given name

    -
      -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - mixed - - serializeTypeDef - - (string $type) -
    - -
      -
    • - string - $type: name of type
    • -
    - - -
    - -
    - -
    - - typeToForm (line 1914) -
    - - -

    returns HTML form elements that allow a user to enter values for creating an instance of the given type.

    -
      -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - string - - typeToForm - - (string $name, string $type) -
    - -
      -
    • - string - $name: name for type instance
    • -
    • - string - $type: name of type
    • -
    - - -
    - -
    - -
    - - xdebug (line 1750) -
    - - -

    adds debug data to the clas level debug string

    -
      -
    • access: private
    • -
    - -
    - void - - xdebug - - (string $string) -
    - -
      -
    • - string - $string: debug data
    • -
    - - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:04 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/nusoapservermime.html b/lib/nusoap/docs/docs/nusoap/nusoapservermime.html deleted file mode 100644 index 56fdb1ab4..000000000 --- a/lib/nusoap/docs/docs/nusoap/nusoapservermime.html +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - Docs For Class nusoapservermime - - - - -
    -

     Class nusoapservermime

    - - -
    -
    Description
    - -
    - -

    nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.

    -
      -
    • version: $Id: nusoapmime.php,v 1.13 2010/04/26 20:15:08 snichol Exp $
    • -
    • author: Scott Nichol <snichol@users.sourceforge.net>
    • -
    • author: Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
    • -
    -

    - Located in /nusoapmime.php (line 498) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_server
    -      |
    -      --nusoap_server_mime
    -         |
    -         --nusoapservermime
    - -
    -
    - - - - - - -
    -
    Variables
    - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_server_mime

    -
    - - - nusoap_server_mime::$mimeContentType
    -
    - - - nusoap_server_mime::$requestAttachments
    -
    - - - nusoap_server_mime::$responseAttachments
    -
    -
    -

    Inherited from nusoap_server

    -
    - - - nusoap_server::$debug_flag
    -
    - - - nusoap_server::$decode_utf8
    -
    - - - nusoap_server::$document
    -
    - - - nusoap_server::$externalWSDLURL
    -
    - - - nusoap_server::$fault
    -
    - - - nusoap_server::$headers
    -
    - - - nusoap_server::$methodname
    -
    - - - nusoap_server::$methodparams
    -
    - - - nusoap_server::$methodreturn
    -
    - - - nusoap_server::$methodreturnisliteralxml
    -
    - - - nusoap_server::$methodURI
    -
    - - - nusoap_server::$operations
    -
    - - - nusoap_server::$outgoing_headers
    -
    - - - nusoap_server::$request
    -
    - - - nusoap_server::$requestHeader
    -
    - - - nusoap_server::$requestHeaders
    -
    - - - nusoap_server::$requestSOAP
    -
    - - - nusoap_server::$response
    -
    - - - nusoap_server::$responseHeaders
    -
    - - - nusoap_server::$responseSOAP
    -
    - - - nusoap_server::$result
    -
    - - - nusoap_server::$SOAPAction
    -
    - - - nusoap_server::$wsdl
    -
    - - - nusoap_server::$xml_encoding
    -
    -
    -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - -

    Inherited Methods

    - - -

    Inherited From nusoap_server_mime

    -
    -  - nusoap_server_mime::addAttachment()
    -  - nusoap_server_mime::clearAttachments()
    -  - nusoap_server_mime::getAttachments()
    -  - nusoap_server_mime::getHTTPBody()
    -  - nusoap_server_mime::getHTTPContentType()
    -  - nusoap_server_mime::getHTTPContentTypeCharset()
    -  - nusoap_server_mime::parseRequest()
    -
    - -

    Inherited From nusoap_server

    -
    -  - nusoap_server::nusoap_server()
    -  - nusoap_server::add_to_map()
    -  - nusoap_server::configureWSDL()
    -  - nusoap_server::fault()
    -  - nusoap_server::getHTTPBody()
    -  - nusoap_server::getHTTPContentType()
    -  - nusoap_server::getHTTPContentTypeCharset()
    -  - nusoap_server::invoke_method()
    -  - nusoap_server::parseRequest()
    -  - nusoap_server::parse_http_headers()
    -  - nusoap_server::parse_request()
    -  - nusoap_server::register()
    -  - nusoap_server::send_response()
    -  - nusoap_server::serialize_return()
    -  - nusoap_server::service()
    -  - nusoap_server::verify_method()
    -
    - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:09 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/soap_fault.html b/lib/nusoap/docs/docs/nusoap/soap_fault.html deleted file mode 100644 index 59279361f..000000000 --- a/lib/nusoap/docs/docs/nusoap/soap_fault.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - Docs For Class soap_fault - - - - -
    -

     Class soap_fault

    - - -
    -
    Description
    - -
    - -

    Backward compatibility

    -
      -
    • version: $Id: soap_fault.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    • -
    • author: Dietrich Ayala <dietrich@ganx4.com>
    • -
    -

    - Located in /nusoap.php (line 1079) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_fault
    -      |
    -      --soap_fault
    - -
    -
    - - - - - - - - - - - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:06 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/soap_parser.html b/lib/nusoap/docs/docs/nusoap/soap_parser.html deleted file mode 100644 index 042d90f19..000000000 --- a/lib/nusoap/docs/docs/nusoap/soap_parser.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - Docs For Class soap_parser - - - - -
    -

     Class soap_parser

    - - -
    -
    Description
    - -
    - -

    Backward compatibility

    - -

    - Located in /nusoap.php (line 7070) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_parser
    -      |
    -      --soap_parser
    - -
    -
    - - - - - - -
    -
    Variables
    - - -
    - - - - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:06 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/soap_server.html b/lib/nusoap/docs/docs/nusoap/soap_server.html deleted file mode 100644 index 6c996d0f3..000000000 --- a/lib/nusoap/docs/docs/nusoap/soap_server.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - Docs For Class soap_server - - - - -
    -

     Class soap_server

    - - -
    -
    Description
    - -
    - -

    Backward compatibility

    - -

    - Located in /nusoap.php (line 4580) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_server
    -      |
    -      --soap_server
    - -
    -
    - - - - - - - - - -
    -
    Methods
    - -
    - -

    Inherited Methods

    - - -

    Inherited From nusoap_server

    -
    -  - nusoap_server::nusoap_server()
    -  - nusoap_server::add_to_map()
    -  - nusoap_server::configureWSDL()
    -  - nusoap_server::fault()
    -  - nusoap_server::getHTTPBody()
    -  - nusoap_server::getHTTPContentType()
    -  - nusoap_server::getHTTPContentTypeCharset()
    -  - nusoap_server::invoke_method()
    -  - nusoap_server::parseRequest()
    -  - nusoap_server::parse_http_headers()
    -  - nusoap_server::parse_request()
    -  - nusoap_server::register()
    -  - nusoap_server::send_response()
    -  - nusoap_server::serialize_return()
    -  - nusoap_server::service()
    -  - nusoap_server::verify_method()
    -
    - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:06 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/soap_transport_http.html b/lib/nusoap/docs/docs/nusoap/soap_transport_http.html deleted file mode 100644 index f6fb4cd0e..000000000 --- a/lib/nusoap/docs/docs/nusoap/soap_transport_http.html +++ /dev/null @@ -1,1765 +0,0 @@ - - - - - - Docs For Class soap_transport_http - - - - -
    -

     Class soap_transport_http

    - - -
    -
    Description
    - -
    - -

    transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support

    - -

    - Located in /nusoap.php (line 2168) -

    - - -
    nusoap_base
    -   |
    -   --soap_transport_http
    - -
    -
    - - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - mixed - $authtype -
    -
    -  - mixed - $certRequest -
    -
    -  - mixed - $ch -
    -
    -  - mixed - $ch_options -
    -
    -  - mixed - $digestRequest -
    -
    -  - mixed - $digest_uri -
    -
    -  - mixed - $encoding -
    -
    -  - mixed - $host -
    -
    -  - mixed - $incoming_cookies -
    -
    -  - mixed - $incoming_headers -
    -
    -  - mixed - $incoming_payload -
    -
    -  - mixed - $outgoing_headers -
    -
    -  - mixed - $outgoing_payload -
    -
    -  - mixed - $password -
    -
    -  - mixed - $path -
    -
    -  - mixed - $persistentConnection -
    -
    -  - mixed - $port -
    -
    -  - mixed - $protocol_version -
    -
    -  - mixed - $proxy -
    -
    -  - mixed - $request_method -
    -
    -  - mixed - $response_status_line -
    -
    -  - mixed - $scheme -
    -
    -  - mixed - $uri -
    -
    -  - mixed - $url -
    -
    -  - mixed - $username -
    -
    -  - mixed - $useSOAPAction -
    -
    -  - mixed - $use_curl -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - soap_transport_http - soap_transport_http - (string $url, [array $curl_options = NULL], [boolean $use_curl = false]) -
    - -
    -  - void - buildPayload - (string $data, [string $cookie_str = '']) -
    - -
    -  - boolean - connect - (mixed $connection_timeout, [integer $response_timeout = 30], integer $timeout) -
    - -
    -  - string - decodeChunked - (string $buffer, string $lb) -
    - -
    -  - string - getCookiesForRequest - (array $cookies, [boolean $secure = false]) -
    - -
    -  - string - getResponse - () -
    - -
    -  - string - io_method - () -
    - -
    -  - boolean - isSkippableCurlHeader - (string &$data) -
    - -
    -  - array - parseCookie - (string $cookie_str) -
    - -
    -  - string - send - (string $data, integer $timeout, [integer $response_timeout = 30], [array $cookies = NULL]) -
    - -
    -  - string - sendHTTPS - (string $data, integer $timeout, [integer $response_timeout = 30], array $cookies) -
    - -
    -  - boolean - sendRequest - (string $data, [array $cookies = NULL]) -
    - -
    -  - void - setContentType - (string $type, [mixed $charset = false]) -
    - -
    -  - void - setCredentials - (string $username, string $password, [string $authtype = 'basic'], [array $digestRequest = array()], [array $certRequest = array()]) -
    - -
    -  - void - setCurlOption - (mixed $option, mixed $value) -
    - -
    -  - void - setEncoding - ([string $enc = 'gzip, deflate']) -
    - -
    -  - void - setHeader - (string $name, string $value) -
    - -
    -  - void - setProxy - (string $proxyhost, string $proxyport, [string $proxyusername = ''], [string $proxypassword = ''], [string $proxyauthtype = 'basic']) -
    - -
    -  - void - setSOAPAction - (string $soapaction) -
    - -
    -  - void - setURL - (string $url) -
    - -
    -  - void - unsetHeader - (string $name) -
    - -
    -  - boolean - usePersistentConnection - () -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - mixed - $authtype - = '' (line 2194) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $certRequest - = array() (line 2196) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $ch - = false (line 2188) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $ch_options - = array() (line 2189) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $digestRequest - = array() (line 2195) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $digest_uri - = '' (line 2172) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $encoding - = '' (line 2179) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $host - = '' (line 2174) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $incoming_cookies - = array() (line 2182) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $incoming_headers - = array() (line 2181) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $incoming_payload - = '' (line 2184) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $outgoing_headers - = array() (line 2180) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $outgoing_payload - = '' (line 2183) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $password - = '' (line 2193) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $path - = '' (line 2176) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $persistentConnection - = false (line 2187) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $port - = '' (line 2175) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $protocol_version - = '1.0' (line 2178) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxy - = null (line 2191) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $request_method - = 'POST' (line 2177) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $response_status_line - (line 2185) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $scheme - = '' (line 2173) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $uri - = '' (line 2171) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $url - = '' (line 2170) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $username - = '' (line 2192) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $useSOAPAction - = true (line 2186) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $use_curl - = false (line 2190) - -
    - - - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor soap_transport_http (line 2213) -
    - - -

    constructor

    -
      -
    • access: public
    • -
    - -
    - soap_transport_http - - soap_transport_http - - (string $url, [array $curl_options = NULL], [boolean $use_curl = false]) -
    - -
      -
    • - string - $url: The URL to which to connect
    • -
    • - array - $curl_options: User-specified cURL options
    • -
    • - boolean - $use_curl: Whether to try to force cURL use
    • -
    - - -
    - -
    - -
    - - buildPayload (line 2841) -
    - - -

    Writes the payload, including HTTP headers, to $this->outgoing_payload.

    -
      -
    • access: private
    • -
    - -
    - void - - buildPayload - - (string $data, [string $cookie_str = '']) -
    - -
      -
    • - string - $data: HTTP body
    • -
    • - string - $cookie_str: data for HTTP Cookie header
    • -
    - - -
    - -
    - -
    - - connect (line 2330) -
    - - -

    establish an HTTP connection

    -
      -
    • return: true if connected, false if not
    • -
    • access: private
    • -
    - -
    - boolean - - connect - - (mixed $connection_timeout, [integer $response_timeout = 30], integer $timeout) -
    - -
      -
    • - integer - $timeout: set connection timeout in seconds
    • -
    • - integer - $response_timeout: set response timeout in seconds
    • -
    - - -
    - -
    - -
    - - decodeChunked (line 2784) -
    - - -

    decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6

    -
      -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - string - - decodeChunked - - (string $buffer, string $lb) -
    - -
      -
    • - string - $buffer
    • -
    • - string - $lb
    • -
    - - -
    - -
    - -
    - - getCookiesForRequest (line 3419) -
    - - -

    sort out cookies for the current request

    -
      -
    • return: for Cookie-HTTP-Header
    • -
    • access: private
    • -
    - -
    - string - - getCookiesForRequest - - (array $cookies, [boolean $secure = false]) -
    - -
      -
    • - array - $cookies: array with all cookies
    • -
    • - boolean - $secure: is the send-content secure or not?
    • -
    - - -
    - -
    - -
    - - getResponse (line 2947) -
    - - -

    gets the SOAP response via HTTP[S]

    -
      -
    • return: the response (also sets member variables like incoming_payload)
    • -
    • access: private
    • -
    - -
    - string - - getResponse - - () -
    - - - -
    - -
    - -
    - - io_method (line 2314) -
    - - -

    gets the I/O method to use

    -
      -
    • return: I/O method to use (socket|curl|unknown)
    • -
    • access: private
    • -
    - -
    - string - - io_method - - () -
    - - - -
    - -
    - -
    - - isSkippableCurlHeader (line 2757) -
    - - -

    Test if the given string starts with a header that is to be skipped.

    -

    Skippable headers result from chunked transfer and proxy requests.

    -
      -
    • return: Whether a skippable header was found.
    • -
    • access: private
    • -
    - -
    - boolean - - isSkippableCurlHeader - - (string &$data) -
    - -
      -
    • - string - $data: The string to check.
    • -
    - - -
    - -
    - -
    - - parseCookie (line 3355) -
    - - -

    parse an incoming Cookie into it's parts

    -
      -
    • return: with data of that cookie
    • -
    • access: private
    • -
    - -
    - array - - parseCookie - - (string $cookie_str) -
    - -
      -
    • - string - $cookie_str: content of cookie
    • -
    - - -
    - -
    - -
    - - send (line 2566) -
    - - -

    sends the SOAP request and gets the SOAP response via HTTP[S]

    -
      -
    • return: data
    • -
    • access: public
    • -
    - -
    - string - - send - - (string $data, integer $timeout, [integer $response_timeout = 30], [array $cookies = NULL]) -
    - -
      -
    • - string - $data: message data
    • -
    • - integer - $timeout: set connection timeout in seconds
    • -
    • - integer - $response_timeout: set response timeout in seconds
    • -
    • - array - $cookies: cookies to send
    • -
    - - -
    - -
    - -
    - - sendHTTPS (line 2607) -
    - - -

    sends the SOAP request and gets the SOAP response via HTTPS using CURL

    -
      -
    • return: data
    • -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - string - - sendHTTPS - - (string $data, integer $timeout, [integer $response_timeout = 30], array $cookies) -
    - -
      -
    • - string - $data: message data
    • -
    • - integer - $timeout: set connection timeout in seconds
    • -
    • - integer - $response_timeout: set response timeout in seconds
    • -
    • - array - $cookies: cookies to send
    • -
    - - -
    - -
    - -
    - - sendRequest (line 2890) -
    - - -

    sends the SOAP request via HTTP[S]

    -
      -
    • return: true if OK, false if problem
    • -
    • access: private
    • -
    - -
    - boolean - - sendRequest - - (string $data, [array $cookies = NULL]) -
    - -
      -
    • - string - $data: message data
    • -
    • - array - $cookies: cookies to send
    • -
    - - -
    - -
    - -
    - - setContentType (line 3325) -
    - - -

    sets the content-type for the SOAP message to be sent

    -
      -
    • access: public
    • -
    - -
    - void - - setContentType - - (string $type, [mixed $charset = false]) -
    - -
      -
    • - string - $type: the content type, MIME style
    • -
    • - mixed - $charset: character set used for encoding (or false)
    • -
    - - -
    - -
    - -
    - - setCredentials (line 2621) -
    - - -

    if authenticating, set user credentials here

    -
      -
    • access: public
    • -
    - -
    - void - - setCredentials - - (string $username, string $password, [string $authtype = 'basic'], [array $digestRequest = array()], [array $certRequest = array()]) -
    - -
      -
    • - string - $username
    • -
    • - string - $password
    • -
    • - string - $authtype: (basic|digest|certificate|ntlm)
    • -
    • - array - $digestRequest: (keys must be nonce, nc, realm, qop)
    • -
    • - array - $certRequest: (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
    • -
    - - -
    - -
    - -
    - - setCurlOption (line 2233) -
    - - -

    sets a cURL option

    -
      -
    • access: private
    • -
    - -
    - void - - setCurlOption - - (mixed $option, mixed $value) -
    - -
      -
    • - mixed - $option: The cURL option (always integer?)
    • -
    • - mixed - $value: The cURL option value
    • -
    - - -
    - -
    - -
    - - setEncoding (line 2705) -
    - - -

    use http encoding

    -
      -
    • access: public
    • -
    - -
    - void - - setEncoding - - ([string $enc = 'gzip, deflate']) -
    - -
      -
    • - string - $enc: encoding style. supported values: gzip, deflate, or both
    • -
    - - -
    - -
    - -
    - - setHeader (line 2246) -
    - - -

    sets an HTTP header

    -
      -
    • access: private
    • -
    - -
    - void - - setHeader - - (string $name, string $value) -
    - -
      -
    • - string - $name: The name of the header
    • -
    • - string - $value: The value of the header
    • -
    - - -
    - -
    - -
    - - setProxy (line 2729) -
    - - -

    set proxy info here

    -
      -
    • access: public
    • -
    - -
    - void - - setProxy - - (string $proxyhost, string $proxyport, [string $proxyusername = ''], [string $proxypassword = ''], [string $proxyauthtype = 'basic']) -
    - -
      -
    • - string - $proxyhost: use an empty string to remove proxy
    • -
    • - string - $proxyport
    • -
    • - string - $proxyusername
    • -
    • - string - $proxypassword
    • -
    • - string - $proxyauthtype: (basic|ntlm)
    • -
    - - -
    - -
    - -
    - - setSOAPAction (line 2695) -
    - - -

    set the soapaction value

    -
      -
    • access: public
    • -
    - -
    - void - - setSOAPAction - - (string $soapaction) -
    - -
      -
    • - string - $soapaction
    • -
    - - -
    - -
    - -
    - - setURL (line 2270) -
    - - -

    sets the URL to which to connect

    -
      -
    • access: private
    • -
    - -
    - void - - setURL - - (string $url) -
    - -
      -
    • - string - $url: The URL to which to connect
    • -
    - - -
    - -
    - -
    - - unsetHeader (line 2257) -
    - - -

    unsets an HTTP header

    -
      -
    • access: private
    • -
    - -
    - void - - unsetHeader - - (string $name) -
    - -
      -
    • - string - $name: The name of the header
    • -
    - - -
    - -
    - -
    - - usePersistentConnection (line 3335) -
    - - -

    specifies that an HTTP persistent connection should be used

    -
      -
    • return: whether the request was honored by this method.
    • -
    • access: public
    • -
    - -
    - boolean - - usePersistentConnection - - () -
    - - - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:06 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/soapclient.html b/lib/nusoap/docs/docs/nusoap/soapclient.html deleted file mode 100644 index b10bf5d38..000000000 --- a/lib/nusoap/docs/docs/nusoap/soapclient.html +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - Docs For Class soapclient - - - - -
    -

     Class soapclient

    - - -
    -
    Description
    - -
    - -

    For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded.

    - -

    - Located in /nusoap.php (line 8055) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_client
    -      |
    -      --soapclient
    - -
    -
    - - - - - - -
    -
    Variables
    - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_client

    -
    - - - nusoap_client::$authtype
    -
    - - - nusoap_client::$bindingType
    -
    - - - nusoap_client::$certRequest
    -
    - - - nusoap_client::$cookies
    -
    - - - nusoap_client::$curl_options
    -
    - - - nusoap_client::$decode_utf8
    -
    - - - nusoap_client::$defaultRpcParams
    -
    - - - nusoap_client::$document
    -
    - - - nusoap_client::$endpoint
    -
    - - - nusoap_client::$endpointType
    -
    - - - nusoap_client::$fault
    -
    - - - nusoap_client::$faultcode
    -
    - - - nusoap_client::$faultdetail
    -
    - - - nusoap_client::$faultstring
    -
    - - - nusoap_client::$forceEndpoint
    -
    - - - nusoap_client::$http_encoding
    -
    - - - nusoap_client::$operations
    -
    - - - nusoap_client::$password
    -
    - - - nusoap_client::$persistentConnection
    -
    - - - nusoap_client::$portName
    -
    - - - nusoap_client::$proxyhost
    -
    - - - nusoap_client::$proxypassword
    -
    - - - nusoap_client::$proxyport
    -
    - - - nusoap_client::$proxyusername
    -
    - - - nusoap_client::$request
    -
    - - - nusoap_client::$requestHeaders
    -
    - - - nusoap_client::$response
    -
    - - - nusoap_client::$responseData
    -
    - - - nusoap_client::$responseHeader
    -
    - - - nusoap_client::$responseHeaders
    -
    - - - nusoap_client::$response_timeout
    -
    - - - nusoap_client::$timeout
    -
    - - - nusoap_client::$username
    -
    - - - nusoap_client::$use_curl
    -
    - - - nusoap_client::$xml_encoding
    -
    -
    -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - -

    Inherited Methods

    - - -

    Inherited From nusoap_client

    -
    -  - nusoap_client::nusoap_client()
    -  - nusoap_client::call()
    -  - nusoap_client::checkCookies()
    -  - nusoap_client::checkWSDL()
    -  - nusoap_client::decodeUTF8()
    -  - nusoap_client::getCookies()
    -  - nusoap_client::getDefaultRpcParams()
    -  - nusoap_client::getHeader()
    -  - nusoap_client::getHeaders()
    -  - nusoap_client::getHTTPBody()
    -  - nusoap_client::getHTTPContentType()
    -  - nusoap_client::getHTTPContentTypeCharset()
    -  - nusoap_client::getOperationData()
    -  - nusoap_client::getProxy()
    -  - nusoap_client::getProxyClassCode()
    -  - nusoap_client::loadWSDL()
    -  - nusoap_client::parseResponse()
    -  - nusoap_client::send()
    -  - nusoap_client::setCookie()
    -  - nusoap_client::setCredentials()
    -  - nusoap_client::setCurlOption()
    -  - nusoap_client::setDefaultRpcParams()
    -  - nusoap_client::setEndpoint()
    -  - nusoap_client::setHeaders()
    -  - nusoap_client::setHTTPEncoding()
    -  - nusoap_client::setHTTPProxy()
    -  - nusoap_client::setUseCURL()
    -  - nusoap_client::UpdateCookies()
    -  - nusoap_client::useHTTPPersistentConnection()
    -  - nusoap_client::_getProxyClassCode()
    -
    - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:05 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/soapclientmime.html b/lib/nusoap/docs/docs/nusoap/soapclientmime.html deleted file mode 100644 index 2869e5260..000000000 --- a/lib/nusoap/docs/docs/nusoap/soapclientmime.html +++ /dev/null @@ -1,446 +0,0 @@ - - - - - - Docs For Class soapclientmime - - - - -
    -

     Class soapclientmime

    - - -
    -
    Description
    - -
    - -

    nusoap_client_mime client supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.

    -
      -
    • version: $Id: soapclientmime.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    • -
    • author: Scott Nichol <snichol@users.sourceforge.net>
    • -
    • author: Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
    • -
    -

    - Located in /nusoapmime.php (line 271) -

    - - -
    nusoap_base
    -   |
    -   --nusoap_client
    -      |
    -      --nusoap_client_mime
    -         |
    -         --soapclientmime
    - -
    -
    - - - - - - -
    -
    Variables
    - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_client_mime

    -
    - - - nusoap_client_mime::$mimeContentType
    -
    - - - nusoap_client_mime::$requestAttachments
    -
    - - - nusoap_client_mime::$responseAttachments
    -
    -
    -

    Inherited from nusoap_client

    -
    - - - nusoap_client::$authtype
    -
    - - - nusoap_client::$bindingType
    -
    - - - nusoap_client::$certRequest
    -
    - - - nusoap_client::$cookies
    -
    - - - nusoap_client::$curl_options
    -
    - - - nusoap_client::$decode_utf8
    -
    - - - nusoap_client::$defaultRpcParams
    -
    - - - nusoap_client::$document
    -
    - - - nusoap_client::$endpoint
    -
    - - - nusoap_client::$endpointType
    -
    - - - nusoap_client::$fault
    -
    - - - nusoap_client::$faultcode
    -
    - - - nusoap_client::$faultdetail
    -
    - - - nusoap_client::$faultstring
    -
    - - - nusoap_client::$forceEndpoint
    -
    - - - nusoap_client::$http_encoding
    -
    - - - nusoap_client::$operations
    -
    - - - nusoap_client::$password
    -
    - - - nusoap_client::$persistentConnection
    -
    - - - nusoap_client::$portName
    -
    - - - nusoap_client::$proxyhost
    -
    - - - nusoap_client::$proxypassword
    -
    - - - nusoap_client::$proxyport
    -
    - - - nusoap_client::$proxyusername
    -
    - - - nusoap_client::$request
    -
    - - - nusoap_client::$requestHeaders
    -
    - - - nusoap_client::$response
    -
    - - - nusoap_client::$responseData
    -
    - - - nusoap_client::$responseHeader
    -
    - - - nusoap_client::$responseHeaders
    -
    - - - nusoap_client::$response_timeout
    -
    - - - nusoap_client::$timeout
    -
    - - - nusoap_client::$username
    -
    - - - nusoap_client::$use_curl
    -
    - - - nusoap_client::$xml_encoding
    -
    -
    -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - -

    Inherited Methods

    - - -

    Inherited From nusoap_client_mime

    -
    -  - nusoap_client_mime::addAttachment()
    -  - nusoap_client_mime::clearAttachments()
    -  - nusoap_client_mime::getAttachments()
    -  - nusoap_client_mime::getHTTPBody()
    -  - nusoap_client_mime::getHTTPContentType()
    -  - nusoap_client_mime::getHTTPContentTypeCharset()
    -  - nusoap_client_mime::parseResponse()
    -
    - -

    Inherited From nusoap_client

    -
    -  - nusoap_client::nusoap_client()
    -  - nusoap_client::call()
    -  - nusoap_client::checkCookies()
    -  - nusoap_client::checkWSDL()
    -  - nusoap_client::decodeUTF8()
    -  - nusoap_client::getCookies()
    -  - nusoap_client::getDefaultRpcParams()
    -  - nusoap_client::getHeader()
    -  - nusoap_client::getHeaders()
    -  - nusoap_client::getHTTPBody()
    -  - nusoap_client::getHTTPContentType()
    -  - nusoap_client::getHTTPContentTypeCharset()
    -  - nusoap_client::getOperationData()
    -  - nusoap_client::getProxy()
    -  - nusoap_client::getProxyClassCode()
    -  - nusoap_client::loadWSDL()
    -  - nusoap_client::parseResponse()
    -  - nusoap_client::send()
    -  - nusoap_client::setCookie()
    -  - nusoap_client::setCredentials()
    -  - nusoap_client::setCurlOption()
    -  - nusoap_client::setDefaultRpcParams()
    -  - nusoap_client::setEndpoint()
    -  - nusoap_client::setHeaders()
    -  - nusoap_client::setHTTPEncoding()
    -  - nusoap_client::setHTTPProxy()
    -  - nusoap_client::setUseCURL()
    -  - nusoap_client::UpdateCookies()
    -  - nusoap_client::useHTTPPersistentConnection()
    -  - nusoap_client::_getProxyClassCode()
    -
    - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:11 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/soapval.html b/lib/nusoap/docs/docs/nusoap/soapval.html deleted file mode 100644 index 54e6c6988..000000000 --- a/lib/nusoap/docs/docs/nusoap/soapval.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - - Docs For Class soapval - - - - -
    -

     Class soapval

    - - -
    -
    Description
    - -
    - -

    For creating serializable abstractions of native PHP types. This class

    -

    allows element name/namespace, XSD type, and XML attributes to be associated with a value. This is extremely useful when WSDL is not used, but is also useful when WSDL is used with polymorphic types, including xsd:anyType and user-defined types.

    -
      -
    • access: public
    • -
    • version: $Id: soapval.html,v 1.2 2010/04/26 20:25:21 snichol Exp $
    • -
    • author: Dietrich Ayala <dietrich@ganx4.com>
    • -
    -

    - Located in /nusoap.php (line 2066) -

    - - -
    nusoap_base
    -   |
    -   --soapval
    - -
    -
    - - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - mixed - $attributes -
    -
    -  - mixed - $element_ns -
    -
    -  - string - $name -
    -
    -  - mixed - $type -
    -
    -  - mixed - $type_ns -
    -
    -  - mixed - $value -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - soapval - soapval - ([string $name = 'soapval'], [mixed $type = false], [mixed $value = -1], [mixed $element_ns = false], [mixed $type_ns = false], [mixed $attributes = false]) -
    - -
    -  - mixed - decode - () -
    - -
    -  - string - serialize - ([string $use = 'encoded']) -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - mixed - $attributes - (line 2108) - -
    - - -

    The XML element attributes (array or false)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $element_ns - (line 2094) - -
    - - -

    The XML element namespace (string or false)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - string - $name - (line 2073) - -
    - - -

    The XML element name

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $type - (line 2080) - -
    - - -

    The XML type name (string or false)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $type_ns - (line 2101) - -
    - - -

    The XML type namespace (string or false)

    -
      -
    • access: private
    • -
    - - - - - -
    - -
    - -
    - - - mixed - $value - (line 2087) - -
    - - -

    The PHP value

    -
      -
    • access: private
    • -
    - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor soapval (line 2121) -
    - - -

    constructor

    -
      -
    • access: public
    • -
    - -
    - soapval - - soapval - - ([string $name = 'soapval'], [mixed $type = false], [mixed $value = -1], [mixed $element_ns = false], [mixed $type_ns = false], [mixed $attributes = false]) -
    - -
      -
    • - string - $name: optional name
    • -
    • - mixed - $type: optional type name
    • -
    • - mixed - $value: optional value
    • -
    • - mixed - $element_ns: optional namespace of value
    • -
    • - mixed - $type_ns: optional namespace of type
    • -
    • - mixed - $attributes: associative array of attributes to add to element serialization
    • -
    - - -
    - -
    - -
    - - decode (line 2148) -
    - - -

    decodes a soapval object into a PHP native type

    -
      -
    • access: public
    • -
    - -
    - mixed - - decode - - () -
    - - - -
    - -
    - -
    - - serialize (line 2138) -
    - - -

    return serialized value

    -
      -
    • return: XML data
    • -
    • access: public
    • -
    - -
    - string - - serialize - - ([string $use = 'encoded']) -
    - -
      -
    • - string - $use: The WSDL use value (encoded|literal)
    • -
    - - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:05 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/wsdl.html b/lib/nusoap/docs/docs/nusoap/wsdl.html deleted file mode 100644 index b92ff1faa..000000000 --- a/lib/nusoap/docs/docs/nusoap/wsdl.html +++ /dev/null @@ -1,2129 +0,0 @@ - - - - - - Docs For Class wsdl - - - - -
    -

     Class wsdl

    - - -
    -
    Description
    - -
    - -

    parses a WSDL file, allows access to it's data, other utility methods.

    -

    also builds WSDL structures programmatically.

    - -

    - Located in /nusoap.php (line 4596) -

    - - -
    nusoap_base
    -   |
    -   --wsdl
    - -
    -
    - - - - -
    -
    Variable Summary
    - -
    -
    -
    -  - mixed - $authtype -
    -
    -  - mixed - $bindings -
    -
    -  - mixed - $certRequest -
    -
    -  - mixed - $complexTypes -
    -
    -  - mixed - $curl_options -
    -
    -  - mixed - $currentBinding -
    -
    -  - mixed - $currentMessage -
    -
    -  - mixed - $currentOperation -
    -
    -  - mixed - $currentPort -
    -
    -  - mixed - $currentPortType -
    -
    -  - mixed - $currentSchema -
    -
    -  - mixed - $depth -
    -
    -  - mixed - $depth_array -
    -
    -  - mixed - $documentation -
    -
    -  - mixed - $endpoint -
    -
    -  - mixed - $import -
    -
    -  - mixed - $message -
    -
    -  - mixed - $messages -
    -
    -  - mixed - $opData -
    -
    -  - mixed - $parser -
    -
    -  - mixed - $password -
    -
    -  - mixed - $ports -
    -
    -  - mixed - $portTypes -
    -
    -  - mixed - $position -
    -
    -  - mixed - $proxyhost -
    -
    -  - mixed - $proxypassword -
    -
    -  - mixed - $proxyport -
    -
    -  - mixed - $proxyusername -
    -
    -  - mixed - $response_timeout -
    -
    -  - mixed - $schemas -
    -
    -  - mixed - $status -
    -
    -  - mixed - $timeout -
    -
    -  - mixed - $username -
    -
    -  - mixed - $use_curl -
    -
    -  - mixed - $wsdl -
    -
    -
    -
    - - -
    -
    Method Summary
    - -
    -
    - -
    -  - wsdl - wsdl - ([string $wsdl = ''], [string $proxyhost = false], [string $proxyport = false], [string $proxyusername = false], [string $proxypassword = false], integer $timeout, [integer $response_timeout = 30], [array $curl_options = null], [boolean $use_curl = false]) -
    - -
    -  - void - addComplexType - (string $name, [string $typeClass = 'complexType'], [string $phpType = 'array'], [string $compositor = ''], [string $restrictionBase = ''], [array $elements = array()], [array $attrs = array()], [string $arrayType = '']) -
    - -
    -  - void - addElement - (array $attrs) -
    - -
    -  - void - addOperation - (string $name, [array $in = false], [array $out = false], [string $namespace = false], [string $soapaction = false], [string $style = 'rpc'], [string $use = 'encoded'], [string $documentation = ''], [string $encodingStyle = '']) -
    - -
    -  - void - addSimpleType - (string $name, [string $restrictionBase = ''], [string $typeClass = 'simpleType'], [string $phpType = 'scalar'], [array $enumeration = array()]) -
    - -
    -  - void - character_data - (string $parser, string $data) -
    - -
    -  - void - end_element - (string $parser, string $name) -
    - -
    -  - void - fetchWSDL - (mixed $wsdl) -
    - -
    -  - void - getBindingData - (mixed $binding) -
    - -
    -  - array - getOperationData - (string $operation, [string $bindingType = 'soap']) -
    - -
    -  - array - getOperationDataForSoapAction - (string $soapAction, [string $bindingType = 'soap']) -
    - -
    -  - array - getOperations - ([string $portName = ''], [string $bindingType = 'soap']) -
    - -
    -  - mixed - getTypeDef - (string $type, string $ns) -
    - -
    -  - boolean - parametersMatchWrapped - (string $type, array &$parameters) -
    - -
    -  - void - parseWSDL - ([string $wsdl = '']) -
    - -
    -  - string - serialize - (mixed $debug) -
    - -
    -  - string - serializeComplexTypeAttributes - (array $typeDef, mixed $value, string $ns, string $uqType) -
    - -
    -  - string - serializeComplexTypeElements - (array $typeDef, mixed $value, string $ns, string $uqType, [string $use = 'encoded'], [string $encodingStyle = false]) -
    - -
    -  - mixed - serializeParameters - (string $operation, string $direction, mixed $parameters) -
    - -
    -  - mixed - serializeRPCParameters - (string $operation, string $direction, mixed $parameters, [string $bindingType = 'soap']) -
    - -
    -  - string - serializeType - (string $name, string $type, mixed $value, [string $use = 'encoded'], [string $encodingStyle = false], [boolean $unqualified = false]) -
    - -
    -  - void - setCredentials - (string $username, string $password, [string $authtype = 'basic'], [array $certRequest = array()]) -
    - -
    -  - void - start_element - (string $parser, string $name, string $attrs) -
    - -
    -  - void - webDescription - () -
    -
    -
    -
    - - -
    -
    Variables
    - -
    - -
    - -
    - - - mixed - $authtype - = '' (line 4636) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $bindings - = array() (line 4609) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $certRequest - = array() (line 4637) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $complexTypes - = array() (line 4603) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $curl_options - = array() (line 4631) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentBinding - (line 4610) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentMessage - (line 4605) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentOperation - (line 4606) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentPort - (line 4612) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentPortType - (line 4608) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $currentSchema - (line 4601) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $depth - = 0 (line 4622) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $depth_array - = array() (line 4623) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $documentation - = false (line 4615) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $endpoint - = '' (line 4616) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $import - = array() (line 4618) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $message - = array() (line 4602) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $messages - = array() (line 4604) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $opData - = array() (line 4613) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $parser - (line 4620) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $password - = '' (line 4635) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $ports - = array() (line 4611) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $portTypes - = array() (line 4607) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $position - = 0 (line 4621) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxyhost - = '' (line 4625) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxypassword - = '' (line 4628) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxyport - = '' (line 4626) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $proxyusername - = '' (line 4627) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $response_timeout - = 30 (line 4630) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $schemas - = array() (line 4600) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $status - = '' (line 4614) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $timeout - = 0 (line 4629) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $username - = '' (line 4634) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $use_curl - = false (line 4632) - -
    - - - - - - - -
    - -
    - -
    - - - mixed - $wsdl - (line 4598) - -
    - - - - - - - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_base

    -
    - - - nusoap_base::$charencoding
    -
    - - - nusoap_base::$debugLevel
    -
    - - - nusoap_base::$debug_str
    -
    - - - nusoap_base::$error_str
    -
    - - - nusoap_base::$namespaces
    -
    - - - nusoap_base::$revision
    -
    - - - nusoap_base::$soap_defencoding
    -
    - - - nusoap_base::$title
    -
    - - - nusoap_base::$typemap
    -
    - - - nusoap_base::$usedNamespaces
    -
    - - - nusoap_base::$version
    -
    - - - nusoap_base::$xmlEntities
    -
    - - - nusoap_base::$XMLSchemaVersion
    -
    -
    - -
    -
    - - -
    -
    Methods
    - -
    - - -
    - -
    - - Constructor wsdl (line 4653) -
    - - -

    constructor

    -
      -
    • access: public
    • -
    - -
    - wsdl - - wsdl - - ([string $wsdl = ''], [string $proxyhost = false], [string $proxyport = false], [string $proxyusername = false], [string $proxypassword = false], integer $timeout, [integer $response_timeout = 30], [array $curl_options = null], [boolean $use_curl = false]) -
    - -
      -
    • - string - $wsdl: WSDL document URL
    • -
    • - string - $proxyhost
    • -
    • - string - $proxyport
    • -
    • - string - $proxyusername
    • -
    • - string - $proxypassword
    • -
    • - integer - $timeout: set the connection timeout
    • -
    • - integer - $response_timeout: set the response timeout
    • -
    • - array - $curl_options: user-specified cURL options
    • -
    • - boolean - $use_curl: try to use cURL
    • -
    - - -
    - -
    - -
    - - addComplexType (line 6278) -
    - - -

    adds an XML Schema complex type to the WSDL types

    - - -
    - void - - addComplexType - - (string $name, [string $typeClass = 'complexType'], [string $phpType = 'array'], [string $compositor = ''], [string $restrictionBase = ''], [array $elements = array()], [array $attrs = array()], [string $arrayType = '']) -
    - -
      -
    • - string - $name
    • -
    • - string - $typeClass: (complexType|simpleType|attribute)
    • -
    • - string - $phpType: currently supported are array and struct (php assoc array)
    • -
    • - string - $compositor: (all|sequence|choice)
    • -
    • - string - $restrictionBase: namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
    • -
    • - array - $elements: e.g. array ( name => array(name=>'',type=>'') )
    • -
    • - array - $attrs: e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]'))
    • -
    • - string - $arrayType: as namespace:name (xsd:string)
    • -
    - - -
    - -
    - -
    - - addElement (line 6339) -
    - - -

    adds an element to the WSDL types

    - - -
    - void - - addElement - - (array $attrs) -
    - -
      -
    • - array - $attrs: attributes that must include name and type
    • -
    - - -
    - -
    - -
    - - addOperation (line 6358) -
    - - -

    register an operation with the server

    -
      -
    • access: public
    • -
    - -
    - void - - addOperation - - (string $name, [array $in = false], [array $out = false], [string $namespace = false], [string $soapaction = false], [string $style = 'rpc'], [string $use = 'encoded'], [string $documentation = ''], [string $encodingStyle = '']) -
    - -
      -
    • - string - $name: operation (method) name
    • -
    • - array - $in: assoc array of input values: key = param name, value = param type
    • -
    • - array - $out: assoc array of output values: key = param name, value = param type
    • -
    • - string - $namespace: optional The namespace for the operation
    • -
    • - string - $soapaction: optional The soapaction for the operation
    • -
    • - string - $style: (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically
    • -
    • - string - $use: (encoded|literal) optional The use for the parameters (cannot mix right now)
    • -
    • - string - $documentation: optional The description to include in the WSDL
    • -
    • - string - $encodingStyle: optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
    • -
    - - -
    - -
    - -
    - - addSimpleType (line 6325) -
    - - -

    adds an XML Schema simple type to the WSDL types

    - - -
    - void - - addSimpleType - - (string $name, [string $restrictionBase = ''], [string $typeClass = 'simpleType'], [string $phpType = 'scalar'], [array $enumeration = array()]) -
    - -
      -
    • - string - $name
    • -
    • - string - $restrictionBase: namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
    • -
    • - string - $typeClass: (should always be simpleType)
    • -
    • - string - $phpType: (should always be scalar)
    • -
    • - array - $enumeration: array of values
    • -
    - - -
    - -
    - -
    - - character_data (line 5123) -
    - - -

    element content handler

    -
      -
    • access: private
    • -
    - -
    - void - - character_data - - (string $parser, string $data) -
    - -
      -
    • - string - $parser: XML parser object
    • -
    • - string - $data: element content
    • -
    - - -
    - -
    - -
    - - end_element (line 5093) -
    - - -

    end-element handler

    -
      -
    • access: private
    • -
    - -
    - void - - end_element - - (string $parser, string $name) -
    - -
      -
    • - string - $parser: XML parser object
    • -
    • - string - $name: element name
    • -
    - - -
    - -
    - -
    - - fetchWSDL (line 4673) -
    - - -

    fetches the WSDL document and parses it

    -
      -
    • access: public
    • -
    - -
    - void - - fetchWSDL - - (mixed $wsdl) -
    - - - -
    - -
    - -
    - - getBindingData (line 5152) -
    - - - -
    - void - - getBindingData - - (mixed $binding) -
    - - - -
    - -
    - -
    - - getOperationData (line 5207) -
    - - -

    returns an associative array of data necessary for calling an operation

    -
      -
    • access: public
    • -
    - -
    - array - - getOperationData - - (string $operation, [string $bindingType = 'soap']) -
    - -
      -
    • - string - $operation: name of operation
    • -
    • - string - $bindingType: type of binding eg: soap, soap12
    • -
    - - -
    - -
    - -
    - - getOperationDataForSoapAction (line 5239) -
    - - -

    returns an associative array of data necessary for calling an operation

    -
      -
    • access: public
    • -
    - -
    - array - - getOperationDataForSoapAction - - (string $soapAction, [string $bindingType = 'soap']) -
    - -
      -
    • - string - $soapAction: soapAction for operation
    • -
    • - string - $bindingType: type of binding eg: soap, soap12
    • -
    - - -
    - -
    - -
    - - getOperations (line 5167) -
    - - -

    returns an assoc array of operation names => operation data

    -
      -
    • access: public
    • -
    - -
    - array - - getOperations - - ([string $portName = ''], [string $bindingType = 'soap']) -
    - -
      -
    • - string - $portName: WSDL port name
    • -
    • - string - $bindingType: eg: soap, smtp, dime (only soap and soap12 are currently supported)
    • -
    - - -
    - -
    - -
    - - getTypeDef (line 5277) -
    - - -

    returns an array of information about a given type returns false if no type exists by the given name

    -

    typeDef = array( 'elements' => array(), // refs to elements array 'restrictionBase' => '', 'phpType' => '', 'order' => '(sequence|all)', 'attrs' => array() // refs to attributes array )

    - - -
    - mixed - - getTypeDef - - (string $type, string $ns) -
    - -
      -
    • - string - $type: the type
    • -
    • - string - $ns: namespace (not prefix) of the type
    • -
    - - -
    - -
    - -
    - - parametersMatchWrapped (line 5525) -
    - - -

    determine whether a set of parameters are unwrapped when they are expect to be wrapped, Microsoft-style.

    -
      -
    • return: whether they parameters are unwrapped (and should be wrapped)
    • -
    • access: private
    • -
    - -
    - boolean - - parametersMatchWrapped - - (string $type, array &$parameters) -
    - -
      -
    • - string - $type: the type (element name) of the wrapper
    • -
    • - array - $parameters: the parameter values for the SOAP call
    • -
    - - -
    - -
    - -
    - - parseWSDL (line 4776) -
    - - -

    parses the wsdl document

    -
      -
    • access: private
    • -
    - -
    - void - - parseWSDL - - ([string $wsdl = '']) -
    - -
      -
    • - string - $wsdl: path or URL
    • -
    - - -
    - -
    - -
    - - serialize (line 5386) -
    - - -

    serialize the parsed wsdl

    -
      -
    • return: serialization of WSDL
    • -
    • access: public
    • -
    - -
    - string - - serialize - - (mixed $debug) -
    - -
      -
    • - mixed - $debug: whether to put debug=1 in endpoint URL
    • -
    - - -
    - -
    - -
    - - serializeComplexTypeAttributes (line 6107) -
    - - -

    serializes the attributes for a complexType

    -
      -
    • return: value serialized as an XML string
    • -
    • access: private
    • -
    - -
    - string - - serializeComplexTypeAttributes - - (array $typeDef, mixed $value, string $ns, string $uqType) -
    - -
      -
    • - array - $typeDef: our internal representation of an XML schema type (or element)
    • -
    • - mixed - $value: a native PHP value (parameter value)
    • -
    • - string - $ns: the namespace of the type
    • -
    • - string - $uqType: the local part of the type
    • -
    - - -
    - -
    - -
    - - serializeComplexTypeElements (line 6170) -
    - - -

    serializes the elements for a complexType

    -
      -
    • return: value serialized as an XML string
    • -
    • access: private
    • -
    - -
    - string - - serializeComplexTypeElements - - (array $typeDef, mixed $value, string $ns, string $uqType, [string $use = 'encoded'], [string $encodingStyle = false]) -
    - -
      -
    • - array - $typeDef: our internal representation of an XML schema type (or element)
    • -
    • - mixed - $value: a native PHP value (parameter value)
    • -
    • - string - $ns: the namespace of the type
    • -
    • - string - $uqType: the local part of the type
    • -
    • - string - $use: use for part (encoded|literal)
    • -
    • - string - $encodingStyle: SOAP encoding style for the value (if different than the enclosing style)
    • -
    - - -
    - -
    - -
    - - serializeParameters (line 5709) -
    - - -

    serialize a PHP value according to a WSDL message definition

    -

    TODO

    • multi-ref serialization
    • validate PHP values against type definitions, return errors if invalid

    -
      -
    • return: parameters serialized as XML or false on error (e.g. operation not found)
    • -
    • deprecated:
    • -
    • access: public
    • -
    - -
    - mixed - - serializeParameters - - (string $operation, string $direction, mixed $parameters) -
    - -
      -
    • - string - $operation: operation name
    • -
    • - string - $direction: (input|output)
    • -
    • - mixed - $parameters: parameter value(s)
    • -
    - - -
    - -
    - -
    - - serializeRPCParameters (line 5608) -
    - - -

    serialize PHP values according to a WSDL message definition contrary to the method name, this is not limited to RPC

    -

    TODO

    • multi-ref serialization
    • validate PHP values against type definitions, return errors if invalid

    -
      -
    • return: parameters serialized as XML or false on error (e.g. operation not found)
    • -
    • access: public
    • -
    - -
    - mixed - - serializeRPCParameters - - (string $operation, string $direction, mixed $parameters, [string $bindingType = 'soap']) -
    - -
      -
    • - string - $operation: operation name
    • -
    • - string - $direction: (input|output)
    • -
    • - mixed - $parameters: parameter value(s)
    • -
    • - string - $bindingType: (soap|soap12)
    • -
    - - -
    - -
    - -
    - - serializeType (line 5788) -
    - - -

    serializes a PHP value according a given type definition

    -
      -
    • return: value serialized as an XML string
    • -
    • access: private
    • -
    - -
    - string - - serializeType - - (string $name, string $type, mixed $value, [string $use = 'encoded'], [string $encodingStyle = false], [boolean $unqualified = false]) -
    - -
      -
    • - string - $name: name of value (part or element)
    • -
    • - string - $type: XML schema type of value (type or element)
    • -
    • - mixed - $value: a native PHP value (parameter value)
    • -
    • - string - $use: use for part (encoded|literal)
    • -
    • - string - $encodingStyle: SOAP encoding style for the value (if different than the enclosing style)
    • -
    • - boolean - $unqualified: a kludge for what should be XML namespace form handling
    • -
    - - -
    - -
    - -
    - - setCredentials (line 5143) -
    - - -

    if authenticating, set user credentials here

    -
      -
    • access: public
    • -
    - -
    - void - - setCredentials - - (string $username, string $password, [string $authtype = 'basic'], [array $certRequest = array()]) -
    - -
      -
    • - string - $username
    • -
    • - string - $password
    • -
    • - string - $authtype: (basic|digest|certificate|ntlm)
    • -
    • - array - $certRequest: (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
    • -
    - - -
    - -
    - -
    - - start_element (line 4880) -
    - - -

    start-element handler

    -
      -
    • access: private
    • -
    - -
    - void - - start_element - - (string $parser, string $name, string $attrs) -
    - -
      -
    • - string - $parser: XML parser object
    • -
    • - string - $name: element name
    • -
    • - string - $attrs: associative array of attributes
    • -
    - - -
    - -
    - -
    - - webDescription (line 5337) -
    - - -

    prints html description of services

    -
      -
    • access: private
    • -
    - -
    - void - - webDescription - - () -
    - - - -
    -

    Inherited Methods

    - - -

    Inherited From nusoap_base

    -
    -  - nusoap_base::nusoap_base()
    -  - nusoap_base::appendDebug()
    -  - nusoap_base::clearDebug()
    -  - nusoap_base::contractQname()
    -  - nusoap_base::debug()
    -  - nusoap_base::expandEntities()
    -  - nusoap_base::expandQname()
    -  - nusoap_base::formatDump()
    -  - nusoap_base::getDebug()
    -  - nusoap_base::getDebugAsXMLComment()
    -  - nusoap_base::getDebugLevel()
    -  - nusoap_base::getError()
    -  - nusoap_base::getGlobalDebugLevel()
    -  - nusoap_base::getLocalPart()
    -  - nusoap_base::getmicrotime()
    -  - nusoap_base::getNamespaceFromPrefix()
    -  - nusoap_base::getPrefix()
    -  - nusoap_base::getPrefixFromNamespace()
    -  - nusoap_base::isArraySimpleOrStruct()
    -  - nusoap_base::serializeEnvelope()
    -  - nusoap_base::serialize_val()
    -  - nusoap_base::setDebugLevel()
    -  - nusoap_base::setError()
    -  - nusoap_base::setGlobalDebugLevel()
    -  - nusoap_base::varDump()
    -  - nusoap_base::__toString()
    -
    - -
    -
    - - -

    - Documentation generated on Mon, 26 Apr 2010 16:17:07 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/nusoap/wsdlcache.html b/lib/nusoap/docs/docs/nusoap/wsdlcache.html deleted file mode 100644 index 924eb8ba8..000000000 --- a/lib/nusoap/docs/docs/nusoap/wsdlcache.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - Docs For Class wsdlcache - - - - -
    -

     Class wsdlcache

    - - -
    -
    Description
    - -
    - -

    For backward compatibility

    - -

    - Located in /class.wsdlcache.php (line 207) -

    - - -
    nusoap_wsdlcache
    -   |
    -   --wsdlcache
    - -
    -
    - - - - - - -
    -
    Variables
    - -
    -

    Inherited Variables

    - -

    Inherited from nusoap_wsdlcache

    -
    - - - nusoap_wsdlcache::$cache_dir
    -
    - - - nusoap_wsdlcache::$cache_lifetime
    -
    - - - nusoap_wsdlcache::$debug_str
    -
    - - - nusoap_wsdlcache::$fplock
    -
    -
    - -
    -
    - - - - - -

    - Documentation generated on Mon, 26 Apr 2010 16:16:49 -0400 by phpDocumentor 1.3.0RC3 -

    -
    - \ No newline at end of file diff --git a/lib/nusoap/docs/docs/packages.html b/lib/nusoap/docs/docs/packages.html deleted file mode 100644 index 65732bec9..000000000 --- a/lib/nusoap/docs/docs/packages.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/nusoap/nusoap.php b/lib/nusoap/nusoap.php deleted file mode 100644 index 90a7a3b0a..000000000 --- a/lib/nusoap/nusoap.php +++ /dev/null @@ -1,8148 +0,0 @@ - -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_base { - /** - * Identification for HTTP headers. - * - * @var string - * @access private - */ - var $title = 'NuSOAP'; - /** - * Version for HTTP headers. - * - * @var string - * @access private - */ - var $version = '0.9.5'; - /** - * CVS revision for HTTP headers. - * - * @var string - * @access private - */ - var $revision = '$Revision: 1.123 $'; - /** - * Current error string (manipulated by getError/setError) - * - * @var string - * @access private - */ - var $error_str = ''; - /** - * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) - * - * @var string - * @access private - */ - var $debug_str = ''; - /** - * toggles automatic encoding of special characters as entities - * (should always be true, I think) - * - * @var boolean - * @access private - */ - var $charencoding = true; - /** - * the debug level for this instance - * - * @var integer - * @access private - */ - var $debugLevel; - - /** - * set schema version - * - * @var string - * @access public - */ - var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'; - - /** - * charset encoding for outgoing messages - * - * @var string - * @access public - */ - var $soap_defencoding = 'ISO-8859-1'; - //var $soap_defencoding = 'UTF-8'; - - /** - * namespaces in an array of prefix => uri - * - * this is "seeded" by a set of constants, but it may be altered by code - * - * @var array - * @access public - */ - var $namespaces = array( - 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', - 'xsd' => 'http://www.w3.org/2001/XMLSchema', - 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/' - ); - - /** - * namespaces used in the current context, e.g. during serialization - * - * @var array - * @access private - */ - var $usedNamespaces = array(); - - /** - * XML Schema types in an array of uri => (array of xml type => php type) - * is this legacy yet? - * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. - * @var array - * @access public - */ - var $typemap = array( - 'http://www.w3.org/2001/XMLSchema' => array( - 'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double', - 'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'', - 'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string', - // abstract "any" types - 'anyType'=>'string','anySimpleType'=>'string', - // derived datatypes - 'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'', - 'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer', - 'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer', - 'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''), - 'http://www.w3.org/2000/10/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://www.w3.org/1999/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'), - 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'), - 'http://xml.apache.org/xml-soap' => array('Map') - ); - - /** - * XML entities to convert - * - * @var array - * @access public - * @deprecated - * @see expandEntities - */ - var $xmlEntities = array('quot' => '"','amp' => '&', - 'lt' => '<','gt' => '>','apos' => "'"); - - /** - * constructor - * - * @access public - */ - function nusoap_base() { - $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * gets the global debug level, which applies to future instances - * - * @return integer Debug level 0-9, where 0 turns off - * @access public - */ - function getGlobalDebugLevel() { - return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * sets the global debug level, which applies to future instances - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setGlobalDebugLevel($level) { - $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level; - } - - /** - * gets the debug level for this instance - * - * @return int Debug level 0-9, where 0 turns off - * @access public - */ - function getDebugLevel() { - return $this->debugLevel; - } - - /** - * sets the debug level for this instance - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setDebugLevel($level) { - $this->debugLevel = $level; - } - - /** - * adds debug data to the instance debug string with formatting - * - * @param string $string debug data - * @access private - */ - function debug($string){ - if ($this->debugLevel > 0) { - $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n"); - } - } - - /** - * adds debug data to the instance debug string without formatting - * - * @param string $string debug data - * @access public - */ - function appendDebug($string){ - if ($this->debugLevel > 0) { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str .= $string; - } - } - - /** - * clears the current debug data for this instance - * - * @access public - */ - function clearDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str = ''; - } - - /** - * gets the current debug data for this instance - * - * @return debug data - * @access public - */ - function &getDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - return $this->debug_str; - } - - /** - * gets the current debug data for this instance as an XML comment - * this may change the contents of the debug data - * - * @return debug data as an XML comment - * @access public - */ - function &getDebugAsXMLComment() { - // it would be nice to use a memory stream here to use - // memory more efficiently - while (strpos($this->debug_str, '--')) { - $this->debug_str = str_replace('--', '- -', $this->debug_str); - } - $ret = ""; - return $ret; - } - - /** - * expands entities, e.g. changes '<' to '<'. - * - * @param string $val The string in which to expand entities. - * @access private - */ - function expandEntities($val) { - if ($this->charencoding) { - $val = str_replace('&', '&', $val); - $val = str_replace("'", ''', $val); - $val = str_replace('"', '"', $val); - $val = str_replace('<', '<', $val); - $val = str_replace('>', '>', $val); - } - return $val; - } - - /** - * returns error string if present - * - * @return mixed error string or false - * @access public - */ - function getError(){ - if($this->error_str != ''){ - return $this->error_str; - } - return false; - } - - /** - * sets error string - * - * @return boolean $string error string - * @access private - */ - function setError($str){ - $this->error_str = $str; - } - - /** - * detect if array is a simple array or a struct (associative array) - * - * @param mixed $val The PHP array - * @return string (arraySimple|arrayStruct) - * @access private - */ - function isArraySimpleOrStruct($val) { - $keyList = array_keys($val); - foreach ($keyList as $keyListValue) { - if (!is_int($keyListValue)) { - return 'arrayStruct'; - } - } - return 'arraySimple'; - } - - /** - * serializes PHP values in accordance w/ section 5. Type information is - * not serialized if $use == 'literal'. - * - * @param mixed $val The value to serialize - * @param string $name The name (local part) of the XML element - * @param string $type The XML schema type (local part) for the element - * @param string $name_ns The namespace for the name of the XML element - * @param string $type_ns The namespace for the type of the element - * @param array $attributes The attributes to serialize as name=>value pairs - * @param string $use The WSDL "use" (encoded|literal) - * @param boolean $soapval Whether this is called from soapval. - * @return string The serialized element, possibly with child elements - * @access public - */ - function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) { - $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval"); - $this->appendDebug('value=' . $this->varDump($val)); - $this->appendDebug('attributes=' . $this->varDump($attributes)); - - if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) { - $this->debug("serialize_val: serialize soapval"); - $xml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - $this->debug("serialize_val of soapval returning $xml"); - return $xml; - } - // force valid name if necessary - if (is_numeric($name)) { - $name = '__numeric_' . $name; - } elseif (! $name) { - $name = 'noname'; - } - // if name has ns, add ns prefix to name - $xmlns = ''; - if($name_ns){ - $prefix = 'nu'.rand(1000,9999); - $name = $prefix.':'.$name; - $xmlns .= " xmlns:$prefix=\"$name_ns\""; - } - // if type is prefixed, create type prefix - if($type_ns != '' && $type_ns == $this->namespaces['xsd']){ - // need to fix this. shouldn't default to xsd if no ns specified - // w/o checking against typemap - $type_prefix = 'xsd'; - } elseif($type_ns){ - $type_prefix = 'ns'.rand(1000,9999); - $xmlns .= " xmlns:$type_prefix=\"$type_ns\""; - } - // serialize attributes if present - $atts = ''; - if($attributes){ - foreach($attributes as $k => $v){ - $atts .= " $k=\"".$this->expandEntities($v).'"'; - } - } - // serialize null value - if (is_null($val)) { - $this->debug("serialize_val: serialize null"); - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$xmlns$atts/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // serialize if an xsd built-in primitive type - if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ - $this->debug("serialize_val: serialize xsd built-in primitive type"); - if (is_bool($val)) { - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - } else if (is_string($val)) { - $val = $this->expandEntities($val); - } - if ($use == 'literal') { - $xml = "<$name$xmlns$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // detect type and serialize - $xml = ''; - switch(true) { - case (is_bool($val) || $type == 'boolean'): - $this->debug("serialize_val: serialize boolean"); - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val"; - } - break; - case (is_int($val) || is_long($val) || $type == 'int'): - $this->debug("serialize_val: serialize int"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val"; - } - break; - case (is_float($val)|| is_double($val) || $type == 'float'): - $this->debug("serialize_val: serialize float"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val"; - } - break; - case (is_string($val) || $type == 'string'): - $this->debug("serialize_val: serialize string"); - $val = $this->expandEntities($val); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val"; - } - break; - case is_object($val): - $this->debug("serialize_val: serialize object"); - if (get_class($val) == 'soapval') { - $this->debug("serialize_val: serialize soapval object"); - $pXml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - } else { - if (! $name) { - $name = get_class($val); - $this->debug("In serialize_val, used class name $name as element name"); - } else { - $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val)); - } - foreach(get_object_vars($val) as $k => $v){ - $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$pXml"; - } else { - $xml .= "<$name$xmlns$type_str$atts>$pXml"; - } - break; - break; - case (is_array($val) || $type): - // detect if struct or array - $valueType = $this->isArraySimpleOrStruct($val); - if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){ - $this->debug("serialize_val: serialize array"); - $i = 0; - if(is_array($val) && count($val)> 0){ - foreach($val as $v){ - if(is_object($v) && get_class($v) == 'soapval'){ - $tt_ns = $v->type_ns; - $tt = $v->type; - } elseif (is_array($v)) { - $tt = $this->isArraySimpleOrStruct($v); - } else { - $tt = gettype($v); - } - $array_types[$tt] = 1; - // TODO: for literal, the name should be $name - $xml .= $this->serialize_val($v,'item',false,false,false,false,$use); - ++$i; - } - if(count($array_types) > 1){ - $array_typename = 'xsd:anyType'; - } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) { - if ($tt == 'integer') { - $tt = 'int'; - } - $array_typename = 'xsd:'.$tt; - } elseif(isset($tt) && $tt == 'arraySimple'){ - $array_typename = 'SOAP-ENC:Array'; - } elseif(isset($tt) && $tt == 'arrayStruct'){ - $array_typename = 'unnamed_struct_use_soapval'; - } else { - // if type is prefixed, create type prefix - if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){ - $array_typename = 'xsd:' . $tt; - } elseif ($tt_ns) { - $tt_prefix = 'ns' . rand(1000, 9999); - $array_typename = "$tt_prefix:$tt"; - $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\""; - } else { - $array_typename = $tt; - } - } - $array_type = $i; - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\""; - } - // empty array - } else { - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\""; - } - } - // TODO: for array in literal, there is no wrapper here - $xml = "<$name$xmlns$type_str$atts>".$xml.""; - } else { - // got a struct - $this->debug("serialize_val: serialize struct"); - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>"; - } else { - $xml .= "<$name$xmlns$type_str$atts>"; - } - foreach($val as $k => $v){ - // Apache Map - if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') { - $xml .= ''; - $xml .= $this->serialize_val($k,'key',false,false,false,false,$use); - $xml .= $this->serialize_val($v,'value',false,false,false,false,$use); - $xml .= ''; - } else { - $xml .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - $xml .= ""; - } - break; - default: - $this->debug("serialize_val: serialize unknown"); - $xml .= 'not detected, got '.gettype($val).' for '.$val; - break; - } - $this->debug("serialize_val returning $xml"); - return $xml; - } - - /** - * serializes a message - * - * @param string $body the XML of the SOAP body - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param array $namespaces optional the namespaces used in generating the body and headers - * @param string $style optional (rpc|document) - * @param string $use optional (encoded|literal) - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @return string the message - * @access public - */ - function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){ - // TODO: add an option to automatically run utf8_encode on $body and $headers - // if $this->soap_defencoding is UTF-8. Not doing this automatically allows - // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1 - - $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle"); - $this->debug("headers:"); - $this->appendDebug($this->varDump($headers)); - $this->debug("namespaces:"); - $this->appendDebug($this->varDump($namespaces)); - - // serialize namespaces - $ns_string = ''; - foreach(array_merge($this->namespaces,$namespaces) as $k => $v){ - $ns_string .= " xmlns:$k=\"$v\""; - } - if($encodingStyle) { - $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string"; - } - - // serialize headers - if($headers){ - if (is_array($headers)) { - $xml = ''; - foreach ($headers as $k => $v) { - if (is_object($v) && get_class($v) == 'soapval') { - $xml .= $this->serialize_val($v, false, false, false, false, false, $use); - } else { - $xml .= $this->serialize_val($v, $k, false, false, false, false, $use); - } - } - $headers = $xml; - $this->debug("In serializeEnvelope, serialized array of headers to $headers"); - } - $headers = "".$headers.""; - } - // serialize envelope - return - 'soap_defencoding .'"?'.">". - '". - $headers. - "". - $body. - "". - ""; - } - - /** - * formats a string to be inserted into an HTML stream - * - * @param string $str The string to format - * @return string The formatted string - * @access public - * @deprecated - */ - function formatDump($str){ - $str = htmlspecialchars($str); - return nl2br($str); - } - - /** - * contracts (changes namespace to prefix) a qualified name - * - * @param string $qname qname - * @return string contracted qname - * @access private - */ - function contractQname($qname){ - // get element namespace - //$this->xdebug("Contract $qname"); - if (strrpos($qname, ':')) { - // get unqualified name - $name = substr($qname, strrpos($qname, ':') + 1); - // get ns - $ns = substr($qname, 0, strrpos($qname, ':')); - $p = $this->getPrefixFromNamespace($ns); - if ($p) { - return $p . ':' . $name; - } - return $qname; - } else { - return $qname; - } - } - - /** - * expands (changes prefix to namespace) a qualified name - * - * @param string $qname qname - * @return string expanded qname - * @access private - */ - function expandQname($qname){ - // get element prefix - if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){ - // get unqualified name - $name = substr(strstr($qname,':'),1); - // get ns prefix - $prefix = substr($qname,0,strpos($qname,':')); - if(isset($this->namespaces[$prefix])){ - return $this->namespaces[$prefix].':'.$name; - } else { - return $qname; - } - } else { - return $qname; - } - } - - /** - * returns the local part of a prefixed string - * returns the original string, if not prefixed - * - * @param string $str The prefixed string - * @return string The local part - * @access public - */ - function getLocalPart($str){ - if($sstr = strrchr($str,':')){ - // get unqualified name - return substr( $sstr, 1 ); - } else { - return $str; - } - } - - /** - * returns the prefix part of a prefixed string - * returns false, if not prefixed - * - * @param string $str The prefixed string - * @return mixed The prefix or false if there is no prefix - * @access public - */ - function getPrefix($str){ - if($pos = strrpos($str,':')){ - // get prefix - return substr($str,0,$pos); - } - return false; - } - - /** - * pass it a prefix, it returns a namespace - * - * @param string $prefix The prefix - * @return mixed The namespace, false if no namespace has the specified prefix - * @access public - */ - function getNamespaceFromPrefix($prefix){ - if (isset($this->namespaces[$prefix])) { - return $this->namespaces[$prefix]; - } - //$this->setError("No namespace registered for prefix '$prefix'"); - return false; - } - - /** - * returns the prefix for a given namespace (or prefix) - * or false if no prefixes registered for the given namespace - * - * @param string $ns The namespace - * @return mixed The prefix, false if the namespace has no prefixes - * @access public - */ - function getPrefixFromNamespace($ns) { - foreach ($this->namespaces as $p => $n) { - if ($ns == $n || $ns == $p) { - $this->usedNamespaces[$p] = $n; - return $p; - } - } - return false; - } - - /** - * returns the time in ODBC canonical form with microseconds - * - * @return string The time in ODBC canonical form with microseconds - * @access public - */ - function getmicrotime() { - if (function_exists('gettimeofday')) { - $tod = gettimeofday(); - $sec = $tod['sec']; - $usec = $tod['usec']; - } else { - $sec = time(); - $usec = 0; - } - return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec); - } - - /** - * Returns a string with the output of var_dump - * - * @param mixed $data The variable to var_dump - * @return string The output of var_dump - * @access public - */ - function varDump($data) { - ob_start(); - var_dump($data); - $ret_val = ob_get_contents(); - ob_end_clean(); - return $ret_val; - } - - /** - * represents the object as a string - * - * @return string - * @access public - */ - function __toString() { - return $this->varDump($this); - } -} - -// XML Schema Datatype Helper Functions - -//xsd:dateTime helpers - -/** -* convert unix timestamp to ISO 8601 compliant date string -* -* @param int $timestamp Unix time stamp -* @param boolean $utc Whether the time stamp is UTC or local -* @return mixed ISO 8601 date string or false -* @access public -*/ -function timestamp_to_iso8601($timestamp,$utc=true){ - $datestr = date('Y-m-d\TH:i:sO',$timestamp); - $pos = strrpos($datestr, "+"); - if ($pos === FALSE) { - $pos = strrpos($datestr, "-"); - } - if ($pos !== FALSE) { - if (strlen($datestr) == $pos + 5) { - $datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2); - } - } - if($utc){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - - if(preg_match($pattern,$datestr,$regs)){ - return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]); - } - return false; - } else { - return $datestr; - } -} - -/** -* convert ISO 8601 compliant date string to unix timestamp -* -* @param string $datestr ISO 8601 compliant date string -* @return mixed Unix timestamp (int) or false -* @access public -*/ -function iso8601_to_timestamp($datestr){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - if(preg_match($pattern,$datestr,$regs)){ - // not utc - if($regs[8] != 'Z'){ - $op = substr($regs[8],0,1); - $h = substr($regs[8],1,2); - $m = substr($regs[8],strlen($regs[8])-2,2); - if($op == '-'){ - $regs[4] = $regs[4] + $h; - $regs[5] = $regs[5] + $m; - } elseif($op == '+'){ - $regs[4] = $regs[4] - $h; - $regs[5] = $regs[5] - $m; - } - } - return gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); -// return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z"); - } else { - return false; - } -} - -/** -* sleeps some number of microseconds -* -* @param string $usec the number of microseconds to sleep -* @access public -* @deprecated -*/ -function usleepWindows($usec) -{ - $start = gettimeofday(); - - do - { - $stop = gettimeofday(); - $timePassed = 1000000 * ($stop['sec'] - $start['sec']) - + $stop['usec'] - $start['usec']; - } - while ($timePassed < $usec); -} - -?> -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_fault extends nusoap_base { - /** - * The fault code (client|server) - * @var string - * @access private - */ - var $faultcode; - /** - * The fault actor - * @var string - * @access private - */ - var $faultactor; - /** - * The fault string, a description of the fault - * @var string - * @access private - */ - var $faultstring; - /** - * The fault detail, typically a string or array of string - * @var mixed - * @access private - */ - var $faultdetail; - - /** - * constructor - * - * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) - * @param string $faultactor only used when msg routed between multiple actors - * @param string $faultstring human readable error message - * @param mixed $faultdetail detail, typically a string or array of string - */ - function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ - parent::nusoap_base(); - $this->faultcode = $faultcode; - $this->faultactor = $faultactor; - $this->faultstring = $faultstring; - $this->faultdetail = $faultdetail; - } - - /** - * serialize a fault - * - * @return string The serialization of the fault instance. - * @access public - */ - function serialize(){ - $ns_string = ''; - foreach($this->namespaces as $k => $v){ - $ns_string .= "\n xmlns:$k=\"$v\""; - } - $return_msg = - 'soap_defencoding.'"?>'. - '\n". - ''. - ''. - $this->serialize_val($this->faultcode, 'faultcode'). - $this->serialize_val($this->faultactor, 'faultactor'). - $this->serialize_val($this->faultstring, 'faultstring'). - $this->serialize_val($this->faultdetail, 'detail'). - ''. - ''. - ''; - return $return_msg; - } -} - -/** - * Backward compatibility - */ -class soap_fault extends nusoap_fault { -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_xmlschema extends nusoap_base { - - // files - var $schema = ''; - var $xml = ''; - // namespaces - var $enclosingNamespaces; - // schema info - var $schemaInfo = array(); - var $schemaTargetNamespace = ''; - // types, elements, attributes defined by the schema - var $attributes = array(); - var $complexTypes = array(); - var $complexTypeStack = array(); - var $currentComplexType = null; - var $elements = array(); - var $elementStack = array(); - var $currentElement = null; - var $simpleTypes = array(); - var $simpleTypeStack = array(); - var $currentSimpleType = null; - // imports - var $imports = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - var $message = array(); - var $defaultNamespace = array(); - - /** - * constructor - * - * @param string $schema schema document URI - * @param string $xml xml document URI - * @param string $namespaces namespaces defined in enclosing XML - * @access public - */ - function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){ - parent::nusoap_base(); - $this->debug('nusoap_xmlschema class instantiated, inside constructor'); - // files - $this->schema = $schema; - $this->xml = $xml; - - // namespaces - $this->enclosingNamespaces = $namespaces; - $this->namespaces = array_merge($this->namespaces, $namespaces); - - // parse schema file - if($schema != ''){ - $this->debug('initial schema file: '.$schema); - $this->parseFile($schema, 'schema'); - } - - // parse xml file - if($xml != ''){ - $this->debug('initial xml file: '.$xml); - $this->parseFile($xml, 'xml'); - } - - } - - /** - * parse an XML file - * - * @param string $xml path/URL to XML file - * @param string $type (schema | xml) - * @return boolean - * @access public - */ - function parseFile($xml,$type){ - // parse xml file - if($xml != ""){ - $xmlStr = @join("",@file($xml)); - if($xmlStr == ""){ - $msg = 'Error reading XML from '.$xml; - $this->setError($msg); - $this->debug($msg); - return false; - } else { - $this->debug("parsing $xml"); - $this->parseString($xmlStr,$type); - $this->debug("done parsing $xml"); - return true; - } - } - return false; - } - - /** - * parse an XML string - * - * @param string $xml path or URL - * @param string $type (schema|xml) - * @access private - */ - function parseString($xml,$type){ - // parse xml string - if($xml != ""){ - - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - - // Set the object for the parser. - xml_set_object($this->parser, $this); - - // Set the element handlers for the parser. - if($type == "schema"){ - xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement'); - xml_set_character_data_handler($this->parser,'schemaCharacterData'); - } elseif($type == "xml"){ - xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement'); - xml_set_character_data_handler($this->parser,'xmlCharacterData'); - } - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $errstr = sprintf('XML error parsing XML schema on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $xml); - $this->setError($errstr); - } - - xml_parser_free($this->parser); - } else{ - $this->debug('no xml passed to parseString()!!'); - $this->setError('no xml passed to parseString()!!'); - } - } - - /** - * gets a type name for an unnamed type - * - * @param string Element name - * @return string A type name for an unnamed type - * @access private - */ - function CreateTypeName($ename) { - $scope = ''; - for ($i = 0; $i < count($this->complexTypeStack); $i++) { - $scope .= $this->complexTypeStack[$i] . '_'; - } - return $scope . $ename . '_ContainedType'; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function schemaStartElement($parser, $name, $attrs) { - - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - if ($depth > 0) { - $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]]; - } else { - $this->defaultNamespace[$pos] = false; - } - - // get element prefix - if($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - - // loop thru attributes, expanding, and registering namespace declarations - if(count($attrs) > 0){ - foreach($attrs as $k => $v){ - // if ns declarations, add to class level array of valid namespaces - if(preg_match('/^xmlns/',$k)){ - //$this->xdebug("$k: $v"); - //$this->xdebug('ns_prefix: '.$this->getPrefix($k)); - if($ns_prefix = substr(strrchr($k,':'),1)){ - //$this->xdebug("Add namespace[$ns_prefix] = $v"); - $this->namespaces[$ns_prefix] = $v; - } else { - $this->defaultNamespace[$pos] = $v; - if (! $this->getPrefixFromNamespace($v)) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $v; - } - } - if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){ - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v.'-instance'; - } - } - } - foreach($attrs as $k => $v){ - // expand each attribute - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // find status, register data - switch($name){ - case 'all': // (optional) compositor content for a complexType - case 'choice': - case 'group': - case 'sequence': - //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement"); - $this->complexTypes[$this->currentComplexType]['compositor'] = $name; - //if($name == 'all' || $name == 'sequence'){ - // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - //} - break; - case 'attribute': // complexType attribute - //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']); - $this->xdebug("parsing attribute:"); - $this->appendDebug($this->varDump($attrs)); - if (!isset($attrs['form'])) { - // TODO: handle globals - $attrs['form'] = $this->schemaInfo['attributeFormDefault']; - } - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - if (!strpos($v, ':')) { - // no namespace in arrayType attribute value... - if ($this->defaultNamespace[$pos]) { - // ...so use the default - $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } - } - } - if(isset($attrs['name'])){ - $this->attributes[$attrs['name']] = $attrs; - $aname = $attrs['name']; - } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){ - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $aname = ''; - } - } elseif(isset($attrs['ref'])){ - $aname = $attrs['ref']; - $this->attributes[$attrs['ref']] = $attrs; - } - - if($this->currentComplexType){ // This should *always* be - $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs; - } - // arrayType attribute - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - $prefix = $this->getPrefix($aname); - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){ - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $v = ''; - } - if(strpos($v,'[,]')){ - $this->complexTypes[$this->currentComplexType]['multidimensional'] = true; - } - $v = substr($v,0,strpos($v,'[')); // clip the [] - if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){ - $v = $this->XMLSchemaVersion.':'.$v; - } - $this->complexTypes[$this->currentComplexType]['arrayType'] = $v; - } - break; - case 'complexContent': // (optional) content for a complexType - $this->xdebug("do nothing for element $name"); - break; - case 'complexType': - array_push($this->complexTypeStack, $this->currentComplexType); - if(isset($attrs['name'])){ - // TODO: what is the scope of named complexTypes that appear - // nested within other c complexTypes? - $this->xdebug('processing named complexType '.$attrs['name']); - //$this->currentElement = false; - $this->currentComplexType = $attrs['name']; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } else { - $name = $this->CreateTypeName($this->currentElement); - $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name); - $this->currentComplexType = $name; - //$this->currentElement = false; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false'; - break; - case 'element': - array_push($this->elementStack, $this->currentElement); - if (!isset($attrs['form'])) { - if ($this->currentComplexType) { - $attrs['form'] = $this->schemaInfo['elementFormDefault']; - } else { - // global - $attrs['form'] = 'qualified'; - } - } - if(isset($attrs['type'])){ - $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']); - if (! $this->getPrefix($attrs['type'])) { - if ($this->defaultNamespace[$pos]) { - $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type']; - $this->xdebug('used default namespace to make type ' . $attrs['type']); - } - } - // This is for constructs like - // - // - // - // - // - if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') { - $this->xdebug('arrayType for unusual array is ' . $attrs['type']); - $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type']; - } - $this->currentElement = $attrs['name']; - $ename = $attrs['name']; - } elseif(isset($attrs['ref'])){ - $this->xdebug("processing element as ref to ".$attrs['ref']); - $this->currentElement = "ref to ".$attrs['ref']; - $ename = $this->getLocalPart($attrs['ref']); - } else { - $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']); - $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type); - $this->currentElement = $attrs['name']; - $attrs['type'] = $this->schemaTargetNamespace . ':' . $type; - $ename = $attrs['name']; - } - if (isset($ename) && $this->currentComplexType) { - $this->xdebug("add element $ename to complexType $this->currentComplexType"); - $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs; - } elseif (!isset($attrs['ref'])) { - $this->xdebug("add element $ename to elements array"); - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - } - break; - case 'enumeration': // restriction value list member - $this->xdebug('enumeration ' . $attrs['value']); - if ($this->currentSimpleType) { - $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value']; - } elseif ($this->currentComplexType) { - $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value']; - } - break; - case 'extension': // simpleContent or complexContent type extension - $this->xdebug('extension ' . $attrs['base']); - if ($this->currentComplexType) { - $ns = $this->getPrefix($attrs['base']); - if ($ns == '') { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base']; - } else { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base']; - } - } else { - $this->xdebug('no current complexType to set extensionBase'); - } - break; - case 'import': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']); - $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('import namespace ' . $attrs['namespace']); - $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - } - break; - case 'include': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']); - $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute'); - } - break; - case 'list': // simpleType value list - $this->xdebug("do nothing for element $name"); - break; - case 'restriction': // simpleType, simpleContent or complexContent value restriction - $this->xdebug('restriction ' . $attrs['base']); - if($this->currentSimpleType){ - $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base']; - } elseif($this->currentComplexType){ - $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base']; - if(strstr($attrs['base'],':') == ':Array'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } - } - break; - case 'schema': - $this->schemaInfo = $attrs; - $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix); - if (isset($attrs['targetNamespace'])) { - $this->schemaTargetNamespace = $attrs['targetNamespace']; - } - if (!isset($attrs['elementFormDefault'])) { - $this->schemaInfo['elementFormDefault'] = 'unqualified'; - } - if (!isset($attrs['attributeFormDefault'])) { - $this->schemaInfo['attributeFormDefault'] = 'unqualified'; - } - break; - case 'simpleContent': // (optional) content for a complexType - if ($this->currentComplexType) { // This should *always* be - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true'; - } else { - $this->xdebug("do nothing for element $name because there is no current complexType"); - } - break; - case 'simpleType': - array_push($this->simpleTypeStack, $this->currentSimpleType); - if(isset($attrs['name'])){ - $this->xdebug("processing simpleType for name " . $attrs['name']); - $this->currentSimpleType = $attrs['name']; - $this->simpleTypes[ $attrs['name'] ] = $attrs; - $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType'; - $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar'; - } else { - $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement); - $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name); - $this->currentSimpleType = $name; - //$this->currentElement = false; - $this->simpleTypes[$this->currentSimpleType] = $attrs; - $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar'; - } - break; - case 'union': // simpleType type list - $this->xdebug("do nothing for element $name"); - break; - default: - $this->xdebug("do not have any logic to process element $name"); - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function schemaEndElement($parser, $name) { - // bring depth down a notch - $this->depth--; - // position of current element is equal to the last value left in depth_array for my depth - if(isset($this->depth_array[$this->depth])){ - $pos = $this->depth_array[$this->depth]; - } - // get element prefix - if ($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - // move on... - if($name == 'complexType'){ - $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)')); - $this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType])); - $this->currentComplexType = array_pop($this->complexTypeStack); - //$this->currentElement = false; - } - if($name == 'element'){ - $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)')); - $this->currentElement = array_pop($this->elementStack); - } - if($name == 'simpleType'){ - $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)')); - $this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType])); - $this->currentSimpleType = array_pop($this->simpleTypeStack); - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function schemaCharacterData($parser, $data){ - $pos = $this->depth_array[$this->depth - 1]; - $this->message[$pos]['cdata'] .= $data; - } - - /** - * serialize the schema - * - * @access public - */ - function serializeSchema(){ - - $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion); - $xml = ''; - // imports - if (sizeof($this->imports) > 0) { - foreach($this->imports as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n"; - } else { - $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n"; - } - } - } - } - // complex types - foreach($this->complexTypes as $typeName => $attrs){ - $contentStr = ''; - // serialize child elements - if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){ - foreach($attrs['elements'] as $element => $eParts){ - if(isset($eParts['ref'])){ - $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n"; - } else { - $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\""; - foreach ($eParts as $aName => $aValue) { - // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable - if ($aName != 'name' && $aName != 'type') { - $contentStr .= " $aName=\"$aValue\""; - } - } - $contentStr .= "/>\n"; - } - } - // compositor wraps elements - if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) { - $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." \n"; - } - } - // attributes - if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){ - foreach($attrs['attrs'] as $attr => $aParts){ - $contentStr .= " <$schemaPrefix:attribute"; - foreach ($aParts as $a => $v) { - if ($a == 'ref' || $a == 'type') { - $contentStr .= " $a=\"".$this->contractQName($v).'"'; - } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') { - $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl']; - $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"'; - } else { - $contentStr .= " $a=\"$v\""; - } - } - $contentStr .= "/>\n"; - } - } - // if restriction - if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){ - $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." \n"; - // complex or simple content - if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){ - $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." \n"; - } - } - // finalize complex type - if($contentStr != ''){ - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." \n"; - } else { - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n"; - } - $xml .= $contentStr; - } - // simple types - if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){ - foreach($this->simpleTypes as $typeName => $eParts){ - $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n"; - if (isset($eParts['enumeration'])) { - foreach ($eParts['enumeration'] as $e) { - $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n"; - } - } - $xml .= " \n "; - } - } - // elements - if(isset($this->elements) && count($this->elements) > 0){ - foreach($this->elements as $element => $eParts){ - $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n"; - } - } - // attributes - if(isset($this->attributes) && count($this->attributes) > 0){ - foreach($this->attributes as $attr => $aParts){ - $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>"; - } - } - // finish 'er up - $attr = ''; - foreach ($this->schemaInfo as $k => $v) { - if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') { - $attr .= " $k=\"$v\""; - } - } - $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n"; - foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) { - $el .= " xmlns:$nsp=\"$ns\""; - } - $xml = $el . ">\n".$xml."\n"; - return $xml; - } - - /** - * adds debug data to the clas level debug string - * - * @param string $string debug data - * @access private - */ - function xdebug($string){ - $this->debug('<' . $this->schemaTargetNamespace . '> '.$string); - } - - /** - * get the PHP type of a user defined type in the schema - * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays - * returns false if no type exists, or not w/ the given namespace - * else returns a string that is either a native php type, or 'struct' - * - * @param string $type name of defined type - * @param string $ns namespace of type - * @return mixed - * @access public - * @deprecated - */ - function getPHPType($type,$ns){ - if(isset($this->typemap[$ns][$type])){ - //print "found type '$type' and ns $ns in typemap
    "; - return $this->typemap[$ns][$type]; - } elseif(isset($this->complexTypes[$type])){ - //print "getting type '$type' and ns $ns from complexTypes array
    "; - return $this->complexTypes[$type]['phpType']; - } - return false; - } - - /** - * returns an associative array of information about a given type - * returns false if no type exists by the given name - * - * For a complexType typeDef = array( - * 'restrictionBase' => '', - * 'phpType' => '', - * 'compositor' => '(sequence|all)', - * 'elements' => array(), // refs to elements array - * 'attrs' => array() // refs to attributes array - * ... and so on (see addComplexType) - * ) - * - * For simpleType or element, the array has different keys. - * - * @param string $type - * @return mixed - * @access public - * @see addComplexType - * @see addSimpleType - * @see addElement - */ - function getTypeDef($type){ - //$this->debug("in getTypeDef for type $type"); - if (substr($type, -1) == '^') { - $is_element = 1; - $type = substr($type, 0, -1); - } else { - $is_element = 0; - } - - if((! $is_element) && isset($this->complexTypes[$type])){ - $this->xdebug("in getTypeDef, found complexType $type"); - return $this->complexTypes[$type]; - } elseif((! $is_element) && isset($this->simpleTypes[$type])){ - $this->xdebug("in getTypeDef, found simpleType $type"); - if (!isset($this->simpleTypes[$type]['phpType'])) { - // get info for type to tack onto the simple type - // TODO: can this ever really apply (i.e. what is a simpleType really?) - $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1); - $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for simpleType $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->simpleTypes[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->simpleTypes[$type]['elements'] = $etype['elements']; - } - } - } - return $this->simpleTypes[$type]; - } elseif(isset($this->elements[$type])){ - $this->xdebug("in getTypeDef, found element $type"); - if (!isset($this->elements[$type]['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1); - $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for element $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->elements[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->elements[$type]['elements'] = $etype['elements']; - } - if (isset($etype['extensionBase'])) { - $this->elements[$type]['extensionBase'] = $etype['extensionBase']; - } - } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') { - $this->xdebug("in getTypeDef, element $type is an XSD type"); - $this->elements[$type]['phpType'] = 'scalar'; - } - } - return $this->elements[$type]; - } elseif(isset($this->attributes[$type])){ - $this->xdebug("in getTypeDef, found attribute $type"); - return $this->attributes[$type]; - } elseif (preg_match('/_ContainedType$/', $type)) { - $this->xdebug("in getTypeDef, have an untyped element $type"); - $typeDef['typeClass'] = 'simpleType'; - $typeDef['phpType'] = 'scalar'; - $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string'; - return $typeDef; - } - $this->xdebug("in getTypeDef, did not find $type"); - return false; - } - - /** - * returns a sample serialization of a given type, or false if no type by the given name - * - * @param string $type name of type - * @return mixed - * @access public - * @deprecated - */ - function serializeTypeDef($type){ - //print "in sTD() for type $type
    "; - if($typeDef = $this->getTypeDef($type)){ - $str .= '<'.$type; - if(is_array($typeDef['attrs'])){ - foreach($typeDef['attrs'] as $attName => $data){ - $str .= " $attName=\"{type = ".$data['type']."}\""; - } - } - $str .= " xmlns=\"".$this->schema['targetNamespace']."\""; - if(count($typeDef['elements']) > 0){ - $str .= ">"; - foreach($typeDef['elements'] as $element => $eData){ - $str .= $this->serializeTypeDef($element); - } - $str .= ""; - } elseif($typeDef['typeClass'] == 'element') { - $str .= ">"; - } else { - $str .= "/>"; - } - return $str; - } - return false; - } - - /** - * returns HTML form elements that allow a user - * to enter values for creating an instance of the given type. - * - * @param string $name name for type instance - * @param string $type name of type - * @return string - * @access public - * @deprecated - */ - function typeToForm($name,$type){ - // get typedef - if($typeDef = $this->getTypeDef($type)){ - // if struct - if($typeDef['phpType'] == 'struct'){ - $buffer .= ''; - foreach($typeDef['elements'] as $child => $childDef){ - $buffer .= " - - "; - } - $buffer .= '
    $childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):
    '; - // if array - } elseif($typeDef['phpType'] == 'array'){ - $buffer .= ''; - for($i=0;$i < 3; $i++){ - $buffer .= " - - "; - } - $buffer .= '
    array item (type: $typeDef[arrayType]):
    '; - // if scalar - } else { - $buffer .= ""; - } - } else { - $buffer .= ""; - } - return $buffer; - } - - /** - * adds a complex type to the schema - * - * example: array - * - * addType( - * 'ArrayOfstring', - * 'complexType', - * 'array', - * '', - * 'SOAP-ENC:Array', - * array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), - * 'xsd:string' - * ); - * - * example: PHP associative array ( SOAP Struct ) - * - * addType( - * 'SOAPStruct', - * 'complexType', - * 'struct', - * 'all', - * array('myVar'=> array('name'=>'myVar','type'=>'string') - * ); - * - * @param name - * @param typeClass (complexType|simpleType|attribute) - * @param phpType: currently supported are array and struct (php assoc array) - * @param compositor (all|sequence|choice) - * @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param elements = array ( name = array(name=>'',type=>'') ) - * @param attrs = array( - * array( - * 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", - * "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" - * ) - * ) - * @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string) - * @access public - * @see getTypeDef - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){ - $this->complexTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'compositor'=> $compositor, - 'restrictionBase' => $restrictionBase, - 'elements' => $elements, - 'attrs' => $attrs, - 'arrayType' => $arrayType - ); - - $this->xdebug("addComplexType $name:"); - $this->appendDebug($this->varDump($this->complexTypes[$name])); - } - - /** - * adds a simple type to the schema - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @access public - * @see nusoap_xmlschema - * @see getTypeDef - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $this->simpleTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'type' => $restrictionBase, - 'enumeration' => $enumeration - ); - - $this->xdebug("addSimpleType $name:"); - $this->appendDebug($this->varDump($this->simpleTypes[$name])); - } - - /** - * adds an element to the schema - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - if (! $this->getPrefix($attrs['type'])) { - $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type']; - } - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - - $this->xdebug("addElement " . $attrs['name']); - $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ])); - } -} - -/** - * Backward compatibility - */ -class XMLSchema extends nusoap_xmlschema { -} - -?> -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class soapval extends nusoap_base { - /** - * The XML element name - * - * @var string - * @access private - */ - var $name; - /** - * The XML type name (string or false) - * - * @var mixed - * @access private - */ - var $type; - /** - * The PHP value - * - * @var mixed - * @access private - */ - var $value; - /** - * The XML element namespace (string or false) - * - * @var mixed - * @access private - */ - var $element_ns; - /** - * The XML type namespace (string or false) - * - * @var mixed - * @access private - */ - var $type_ns; - /** - * The XML element attributes (array or false) - * - * @var mixed - * @access private - */ - var $attributes; - - /** - * constructor - * - * @param string $name optional name - * @param mixed $type optional type name - * @param mixed $value optional value - * @param mixed $element_ns optional namespace of value - * @param mixed $type_ns optional namespace of type - * @param mixed $attributes associative array of attributes to add to element serialization - * @access public - */ - function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) { - parent::nusoap_base(); - $this->name = $name; - $this->type = $type; - $this->value = $value; - $this->element_ns = $element_ns; - $this->type_ns = $type_ns; - $this->attributes = $attributes; - } - - /** - * return serialized value - * - * @param string $use The WSDL use value (encoded|literal) - * @return string XML data - * @access public - */ - function serialize($use='encoded') { - return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true); - } - - /** - * decodes a soapval object into a PHP native type - * - * @return mixed - * @access public - */ - function decode(){ - return $this->value; - } -} - - - -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class soap_transport_http extends nusoap_base { - - var $url = ''; - var $uri = ''; - var $digest_uri = ''; - var $scheme = ''; - var $host = ''; - var $port = ''; - var $path = ''; - var $request_method = 'POST'; - var $protocol_version = '1.0'; - var $encoding = ''; - var $outgoing_headers = array(); - var $incoming_headers = array(); - var $incoming_cookies = array(); - var $outgoing_payload = ''; - var $incoming_payload = ''; - var $response_status_line; // HTTP response status line - var $useSOAPAction = true; - var $persistentConnection = false; - var $ch = false; // cURL handle - var $ch_options = array(); // cURL custom options - var $use_curl = false; // force cURL use - var $proxy = null; // proxy information (associative array) - var $username = ''; - var $password = ''; - var $authtype = ''; - var $digestRequest = array(); - var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) - // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem' - // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem' - // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem' - // passphrase: SSL key password/passphrase - // certpassword: SSL certificate password - // verifypeer: default is 1 - // verifyhost: default is 1 - - /** - * constructor - * - * @param string $url The URL to which to connect - * @param array $curl_options User-specified cURL options - * @param boolean $use_curl Whether to try to force cURL use - * @access public - */ - function soap_transport_http($url, $curl_options = NULL, $use_curl = false){ - parent::nusoap_base(); - $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); - $this->appendDebug($this->varDump($curl_options)); - $this->setURL($url); - if (is_array($curl_options)) { - $this->ch_options = $curl_options; - } - $this->use_curl = $use_curl; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); - } - - /** - * sets a cURL option - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access private - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - curl_setopt($this->ch, $option, $value); - } - - /** - * sets an HTTP header - * - * @param string $name The name of the header - * @param string $value The value of the header - * @access private - */ - function setHeader($name, $value) { - $this->outgoing_headers[$name] = $value; - $this->debug("set header $name: $value"); - } - - /** - * unsets an HTTP header - * - * @param string $name The name of the header - * @access private - */ - function unsetHeader($name) { - if (isset($this->outgoing_headers[$name])) { - $this->debug("unset header $name"); - unset($this->outgoing_headers[$name]); - } - } - - /** - * sets the URL to which to connect - * - * @param string $url The URL to which to connect - * @access private - */ - function setURL($url) { - $this->url = $url; - - $u = parse_url($url); - foreach($u as $k => $v){ - $this->debug("parsed URL $k = $v"); - $this->$k = $v; - } - - // add any GET params to path - if(isset($u['query']) && $u['query'] != ''){ - $this->path .= '?' . $u['query']; - } - - // set default port - if(!isset($u['port'])){ - if($u['scheme'] == 'https'){ - $this->port = 443; - } else { - $this->port = 80; - } - } - - $this->uri = $this->path; - $this->digest_uri = $this->uri; - - // build headers - if (!isset($u['port'])) { - $this->setHeader('Host', $this->host); - } else { - $this->setHeader('Host', $this->host.':'.$this->port); - } - - if (isset($u['user']) && $u['user'] != '') { - $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); - } - } - - /** - * gets the I/O method to use - * - * @return string I/O method to use (socket|curl|unknown) - * @access private - */ - function io_method() { - if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) - return 'curl'; - if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) - return 'socket'; - return 'unknown'; - } - - /** - * establish an HTTP connection - * - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return boolean true if connected, false if not - * @access private - */ - function connect($connection_timeout=0,$response_timeout=30){ - // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like - // "regular" socket. - // TODO: disabled for now because OpenSSL must be *compiled* in (not just - // loaded), and until PHP5 stream_get_wrappers is not available. -// if ($this->scheme == 'https') { -// if (version_compare(phpversion(), '4.3.0') >= 0) { -// if (extension_loaded('openssl')) { -// $this->scheme = 'ssl'; -// $this->debug('Using SSL over OpenSSL'); -// } -// } -// } - $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port"); - if ($this->io_method() == 'socket') { - if (!is_array($this->proxy)) { - $host = $this->host; - $port = $this->port; - } else { - $host = $this->proxy['host']; - $port = $this->proxy['port']; - } - - // use persistent connection - if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ - if (!feof($this->fp)) { - $this->debug('Re-use persistent connection'); - return true; - } - fclose($this->fp); - $this->debug('Closed persistent connection at EOF'); - } - - // munge host if using OpenSSL - if ($this->scheme == 'ssl') { - $host = 'ssl://' . $host; - } - $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); - - // open socket - if($connection_timeout > 0){ - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); - } else { - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); - } - - // test pointer - if(!$this->fp) { - $msg = 'Couldn\'t open socket connection to server ' . $this->url; - if ($this->errno) { - $msg .= ', Error ('.$this->errno.'): '.$this->error_str; - } else { - $msg .= ' prior to connect(). This is often a problem looking up the host name.'; - } - $this->debug($msg); - $this->setError($msg); - return false; - } - - // set response timeout - $this->debug('set response timeout to ' . $response_timeout); - socket_set_timeout( $this->fp, $response_timeout); - - $this->debug('socket connected'); - return true; - } else if ($this->io_method() == 'curl') { - if (!extension_loaded('curl')) { -// $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'); - $this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to include cURL or change php.ini to load the PHP cURL extension.'); - return false; - } - // Avoid warnings when PHP does not have these options - if (defined('CURLOPT_CONNECTIONTIMEOUT')) - $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT; - else - $CURLOPT_CONNECTIONTIMEOUT = 78; - if (defined('CURLOPT_HTTPAUTH')) - $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH; - else - $CURLOPT_HTTPAUTH = 107; - if (defined('CURLOPT_PROXYAUTH')) - $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH; - else - $CURLOPT_PROXYAUTH = 111; - if (defined('CURLAUTH_BASIC')) - $CURLAUTH_BASIC = CURLAUTH_BASIC; - else - $CURLAUTH_BASIC = 1; - if (defined('CURLAUTH_DIGEST')) - $CURLAUTH_DIGEST = CURLAUTH_DIGEST; - else - $CURLAUTH_DIGEST = 2; - if (defined('CURLAUTH_NTLM')) - $CURLAUTH_NTLM = CURLAUTH_NTLM; - else - $CURLAUTH_NTLM = 8; - - $this->debug('connect using cURL'); - // init CURL - $this->ch = curl_init(); - // set url - $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host"; - // add path - $hostURL .= $this->path; - $this->setCurlOption(CURLOPT_URL, $hostURL); - // follow location headers (re-directs) - if (ini_get('safe_mode') || ini_get('open_basedir')) { - $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION'); - $this->debug('safe_mode = '); - $this->appendDebug($this->varDump(ini_get('safe_mode'))); - $this->debug('open_basedir = '); - $this->appendDebug($this->varDump(ini_get('open_basedir'))); - } else { - $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1); - } - // ask for headers in the response output - $this->setCurlOption(CURLOPT_HEADER, 1); - // ask for the response output as the return value - $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1); - // encode - // We manage this ourselves through headers and encoding -// if(function_exists('gzuncompress')){ -// $this->setCurlOption(CURLOPT_ENCODING, 'deflate'); -// } - // persistent connection - if ($this->persistentConnection) { - // I believe the following comment is now bogus, having applied to - // the code when it used CURLOPT_CUSTOMREQUEST to send the request. - // The way we send data, we cannot use persistent connections, since - // there will be some "junk" at the end of our request. - //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true); - $this->persistentConnection = false; - $this->setHeader('Connection', 'close'); - } - // set timeouts - if ($connection_timeout != 0) { - $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout); - } - if ($response_timeout != 0) { - $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); - } - - if ($this->scheme == 'https') { - $this->debug('set cURL SSL verify options'); - // recent versions of cURL turn on peer/host checking by default, - // while PHP binaries are not compiled with a default location for the - // CA cert bundle, so disable peer/host checking. - //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt'); - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0); - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0); - - // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo) - if ($this->authtype == 'certificate') { - $this->debug('set cURL certificate options'); - if (isset($this->certRequest['cainfofile'])) { - $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']); - } - if (isset($this->certRequest['verifypeer'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1); - } - if (isset($this->certRequest['verifyhost'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1); - } - if (isset($this->certRequest['sslcertfile'])) { - $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']); - } - if (isset($this->certRequest['sslkeyfile'])) { - $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']); - } - if (isset($this->certRequest['passphrase'])) { - $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']); - } - if (isset($this->certRequest['certpassword'])) { - $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']); - } - } - } - if ($this->authtype && ($this->authtype != 'certificate')) { - if ($this->username) { - $this->debug('set cURL username/password'); - $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password"); - } - if ($this->authtype == 'basic') { - $this->debug('set cURL for Basic authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC); - } - if ($this->authtype == 'digest') { - $this->debug('set cURL for digest authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST); - } - if ($this->authtype == 'ntlm') { - $this->debug('set cURL for NTLM authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM); - } - } - if (is_array($this->proxy)) { - $this->debug('set cURL proxy options'); - if ($this->proxy['port'] != '') { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']); - } else { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']); - } - if ($this->proxy['username'] || $this->proxy['password']) { - $this->debug('set cURL proxy authentication options'); - $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']); - if ($this->proxy['authtype'] == 'basic') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC); - } - if ($this->proxy['authtype'] == 'ntlm') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM); - } - } - } - $this->debug('cURL connection set up'); - return true; - } else { - $this->setError('Unknown scheme ' . $this->scheme); - $this->debug('Unknown scheme ' . $this->scheme); - return false; - } - } - - /** - * sends the SOAP request and gets the SOAP response via HTTP[S] - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - */ - function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) { - - $this->debug('entered send() with data of length: '.strlen($data)); - - $this->tryagain = true; - $tries = 0; - while ($this->tryagain) { - $this->tryagain = false; - if ($tries++ < 2) { - // make connnection - if (!$this->connect($timeout, $response_timeout)){ - return false; - } - - // send request - if (!$this->sendRequest($data, $cookies)){ - return false; - } - - // get response - $respdata = $this->getResponse(); - } else { - $this->setError("Too many tries to get an OK response ($this->response_status_line)"); - } - } - $this->debug('end of send()'); - return $respdata; - } - - - /** - * sends the SOAP request and gets the SOAP response via HTTPS using CURL - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - * @deprecated - */ - function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) { - return $this->send($data, $timeout, $response_timeout, $cookies); - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $digestRequest (keys must be nonce, nc, realm, qop) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype digestRequest="); - $this->appendDebug($this->varDump($digestRequest)); - $this->debug("certRequest="); - $this->appendDebug($this->varDump($certRequest)); - // cf. RFC 2617 - if ($authtype == 'basic') { - $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); - } elseif ($authtype == 'digest') { - if (isset($digestRequest['nonce'])) { - $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; - - // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) - - // A1 = unq(username-value) ":" unq(realm-value) ":" passwd - $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; - - // H(A1) = MD5(A1) - $HA1 = md5($A1); - - // A2 = Method ":" digest-uri-value - $A2 = $this->request_method . ':' . $this->digest_uri; - - // H(A2) - $HA2 = md5($A2); - - // KD(secret, data) = H(concat(secret, ":", data)) - // if qop == auth: - // request-digest = <"> < KD ( H(A1), unq(nonce-value) - // ":" nc-value - // ":" unq(cnonce-value) - // ":" unq(qop-value) - // ":" H(A2) - // ) <"> - // if qop is missing, - // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> - - $unhashedDigest = ''; - $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; - $cnonce = $nonce; - if ($digestRequest['qop'] != '') { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; - } else { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; - } - - $hashedDigest = md5($unhashedDigest); - - $opaque = ''; - if (isset($digestRequest['opaque'])) { - $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; - } - - $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"'); - } - } elseif ($authtype == 'certificate') { - $this->certRequest = $certRequest; - $this->debug('Authorization header not set for certificate'); - } elseif ($authtype == 'ntlm') { - // do nothing - $this->debug('Authorization header not set for ntlm'); - } - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->digestRequest = $digestRequest; - } - - /** - * set the soapaction value - * - * @param string $soapaction - * @access public - */ - function setSOAPAction($soapaction) { - $this->setHeader('SOAPAction', '"' . $soapaction . '"'); - } - - /** - * use http encoding - * - * @param string $enc encoding style. supported values: gzip, deflate, or both - * @access public - */ - function setEncoding($enc='gzip, deflate') { - if (function_exists('gzdeflate')) { - $this->protocol_version = '1.1'; - $this->setHeader('Accept-Encoding', $enc); - if (!isset($this->outgoing_headers['Connection'])) { - $this->setHeader('Connection', 'close'); - $this->persistentConnection = false; - } - // deprecated as of PHP 5.3.0 - //set_magic_quotes_runtime(0); - $this->encoding = $enc; - } - } - - /** - * set proxy info here - * - * @param string $proxyhost use an empty string to remove proxy - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param string $proxyauthtype (basic|ntlm) - * @access public - */ - function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') { - if ($proxyhost) { - $this->proxy = array( - 'host' => $proxyhost, - 'port' => $proxyport, - 'username' => $proxyusername, - 'password' => $proxypassword, - 'authtype' => $proxyauthtype - ); - if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') { - $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)); - } - } else { - $this->debug('remove proxy'); - $proxy = null; - unsetHeader('Proxy-Authorization'); - } - } - - - /** - * Test if the given string starts with a header that is to be skipped. - * Skippable headers result from chunked transfer and proxy requests. - * - * @param string $data The string to check. - * @returns boolean Whether a skippable header was found. - * @access private - */ - function isSkippableCurlHeader(&$data) { - $skipHeaders = array( 'HTTP/1.1 100', - 'HTTP/1.0 301', - 'HTTP/1.1 301', - 'HTTP/1.0 302', - 'HTTP/1.1 302', - 'HTTP/1.0 401', - 'HTTP/1.1 401', - 'HTTP/1.0 200 Connection established'); - foreach ($skipHeaders as $hd) { - $prefix = substr($data, 0, strlen($hd)); - if ($prefix == $hd) return true; - } - - return false; - } - - /** - * decode a string that is encoded w/ "chunked' transfer encoding - * as defined in RFC2068 19.4.6 - * - * @param string $buffer - * @param string $lb - * @returns string - * @access public - * @deprecated - */ - function decodeChunked($buffer, $lb){ - // length := 0 - $length = 0; - $new = ''; - - // read chunk-size, chunk-extension (if any) and CRLF - // get the position of the linebreak - $chunkend = strpos($buffer, $lb); - if ($chunkend == FALSE) { - $this->debug('no linebreak found in decodeChunked'); - return $new; - } - $temp = substr($buffer,0,$chunkend); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend + strlen($lb); - // while (chunk-size > 0) { - while ($chunk_size > 0) { - $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); - $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); - - // Just in case we got a broken connection - if ($chunkend == FALSE) { - $chunk = substr($buffer,$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - $length += strlen($chunk); - break; - } - - // read chunk-data and CRLF - $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - // length := length + chunk-size - $length += strlen($chunk); - // read chunk-size and CRLF - $chunkstart = $chunkend + strlen($lb); - - $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb); - if ($chunkend == FALSE) { - break; //Just in case we got a broken connection - } - $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend; - } - return $new; - } - - /** - * Writes the payload, including HTTP headers, to $this->outgoing_payload. - * - * @param string $data HTTP body - * @param string $cookie_str data for HTTP Cookie header - * @return void - * @access private - */ - function buildPayload($data, $cookie_str = '') { - // Note: for cURL connections, $this->outgoing_payload is ignored, - // as is the Content-Length header, but these are still created as - // debugging guides. - - // add content-length header - if ($this->request_method != 'GET') { - $this->setHeader('Content-Length', strlen($data)); - } - - // start building outgoing payload: - if ($this->proxy) { - $uri = $this->url; - } else { - $uri = $this->uri; - } - $req = "$this->request_method $uri HTTP/$this->protocol_version"; - $this->debug("HTTP request: $req"); - $this->outgoing_payload = "$req\r\n"; - - // loop thru headers, serializing - foreach($this->outgoing_headers as $k => $v){ - $hdr = $k.': '.$v; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // add any cookies - if ($cookie_str != '') { - $hdr = 'Cookie: '.$cookie_str; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // header/body separator - $this->outgoing_payload .= "\r\n"; - - // add data - $this->outgoing_payload .= $data; - } - - /** - * sends the SOAP request via HTTP[S] - * - * @param string $data message data - * @param array $cookies cookies to send - * @return boolean true if OK, false if problem - * @access private - */ - function sendRequest($data, $cookies = NULL) { - // build cookie string - $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https'))); - - // build payload - $this->buildPayload($data, $cookie_str); - - if ($this->io_method() == 'socket') { - // send payload - if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { - $this->setError('couldn\'t write message data to socket'); - $this->debug('couldn\'t write message data to socket'); - return false; - } - $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); - return true; - } else if ($this->io_method() == 'curl') { - // set payload - // cURL does say this should only be the verb, and in fact it - // turns out that the URI and HTTP version are appended to this, which - // some servers refuse to work with (so we no longer use this method!) - //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); - $curl_headers = array(); - foreach($this->outgoing_headers as $k => $v){ - if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { - $this->debug("Skip cURL header $k: $v"); - } else { - $curl_headers[] = "$k: $v"; - } - } - if ($cookie_str != '') { - $curl_headers[] = 'Cookie: ' . $cookie_str; - } - $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); - $this->debug('set cURL HTTP headers'); - if ($this->request_method == "POST") { - $this->setCurlOption(CURLOPT_POST, 1); - $this->setCurlOption(CURLOPT_POSTFIELDS, $data); - $this->debug('set cURL POST data'); - } else { - } - // insert custom user-set cURL options - foreach ($this->ch_options as $key => $val) { - $this->setCurlOption($key, $val); - } - - $this->debug('set cURL payload'); - return true; - } - } - - /** - * gets the SOAP response via HTTP[S] - * - * @return string the response (also sets member variables like incoming_payload) - * @access private - */ - function getResponse(){ - $this->incoming_payload = ''; - - if ($this->io_method() == 'socket') { - // loop until headers have been retrieved - $data = ''; - while (!isset($lb)){ - - // We might EOF during header read. - if(feof($this->fp)) { - $this->incoming_payload = $data; - $this->debug('found no headers before EOF after length ' . strlen($data)); - $this->debug("received before EOF:\n" . $data); - $this->setError('server failed to send headers'); - return false; - } - - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read line of $tmplen bytes: " . trim($tmp)); - - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of headers timed out after length ' . strlen($data)); - $this->debug("read before timeout: " . $data); - $this->setError('socket read of headers timed out'); - return false; - } - - $data .= $tmp; - $pos = strpos($data,"\r\n\r\n"); - if($pos > 1){ - $lb = "\r\n"; - } else { - $pos = strpos($data,"\n\n"); - if($pos > 1){ - $lb = "\n"; - } - } - // remove 100 headers - if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) { - unset($lb); - $data = ''; - }// - } - // store header data - $this->incoming_payload .= $data; - $this->debug('found end of headers after length ' . strlen($data)); - // process headers - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $this->incoming_headers = array(); - $this->incoming_cookies = array(); - foreach($header_array as $header_line){ - $arr = explode(':',$header_line, 2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - - // loop until msg has been received - if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { - $content_length = 2147483647; // ignore any content-length header - $chunked = true; - $this->debug("want to read chunked content"); - } elseif (isset($this->incoming_headers['content-length'])) { - $content_length = $this->incoming_headers['content-length']; - $chunked = false; - $this->debug("want to read content of length $content_length"); - } else { - $content_length = 2147483647; - $chunked = false; - $this->debug("want to read content to EOF"); - } - $data = ''; - do { - if ($chunked) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk line of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk length timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk length timed out'); - return false; - } - $content_length = hexdec(trim($tmp)); - $this->debug("chunk length $content_length"); - } - $strlen = 0; - while (($strlen < $content_length) && (!feof($this->fp))) { - $readlen = min(8192, $content_length - $strlen); - $tmp = fread($this->fp, $readlen); - $tmplen = strlen($tmp); - $this->debug("read buffer of $tmplen bytes"); - if (($tmplen == 0) && (!feof($this->fp))) { - $this->incoming_payload = $data; - $this->debug('socket read of body timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of body timed out'); - return false; - } - $strlen += $tmplen; - $data .= $tmp; - } - if ($chunked && ($content_length > 0)) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk terminator of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk terminator timed out'); - return false; - } - } - } while ($chunked && ($content_length > 0) && (!feof($this->fp))); - if (feof($this->fp)) { - $this->debug('read to EOF'); - } - $this->debug('read body of length ' . strlen($data)); - $this->incoming_payload .= $data; - $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); - - // close filepointer - if( - (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || - (! $this->persistentConnection) || feof($this->fp)){ - fclose($this->fp); - $this->fp = false; - $this->debug('closed socket'); - } - - // connection was closed unexpectedly - if($this->incoming_payload == ''){ - $this->setError('no response from server'); - return false; - } - - // decode transfer-encoding -// if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){ -// if(!$data = $this->decodeChunked($data, $lb)){ -// $this->setError('Decoding of chunked data failed'); -// return false; -// } - //print "
    \nde-chunked:\n---------------\n$data\n\n---------------\n
    "; - // set decoded payload -// $this->incoming_payload = $header_data.$lb.$lb.$data; -// } - - } else if ($this->io_method() == 'curl') { - // send and receive - $this->debug('send and receive with cURL'); - $this->incoming_payload = curl_exec($this->ch); - $data = $this->incoming_payload; - - $cErr = curl_error($this->ch); - if ($cErr != '') { - $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'
    '; - // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE - foreach(curl_getinfo($this->ch) as $k => $v){ - $err .= "$k: $v
    "; - } - $this->debug($err); - $this->setError($err); - curl_close($this->ch); - return false; - } else { - //echo '
    ';
    -			//var_dump(curl_getinfo($this->ch));
    -			//echo '
    '; - } - // close curl - $this->debug('No cURL error, closing cURL'); - curl_close($this->ch); - - // try removing skippable headers - $savedata = $data; - while ($this->isSkippableCurlHeader($data)) { - $this->debug("Found HTTP header to skip"); - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - - if ($data == '') { - // have nothing left; just remove 100 header(s) - $data = $savedata; - while (preg_match('/^HTTP\/1.1 100/',$data)) { - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - } - - // separate content from HTTP headers - if ($pos = strpos($data,"\r\n\r\n")) { - $lb = "\r\n"; - } elseif( $pos = strpos($data,"\n\n")) { - $lb = "\n"; - } else { - $this->debug('no proper separation of headers and document'); - $this->setError('no proper separation of headers and document'); - return false; - } - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $data = ltrim(substr($data,$pos)); - $this->debug('found proper separation of headers and document'); - $this->debug('cleaned data, stringlen: '.strlen($data)); - // clean headers - foreach ($header_array as $header_line) { - $arr = explode(':',$header_line,2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - } - - $this->response_status_line = $header_array[0]; - $arr = explode(' ', $this->response_status_line, 3); - $http_version = $arr[0]; - $http_status = intval($arr[1]); - $http_reason = count($arr) > 2 ? $arr[2] : ''; - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { - $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); - $this->setURL($this->incoming_headers['location']); - $this->tryagain = true; - return false; - } - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { - $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); - if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { - $this->debug('Server wants digest authentication'); - // remove "Digest " from our elements - $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']); - - // parse elements into array - $digestElements = explode(',', $digestString); - foreach ($digestElements as $val) { - $tempElement = explode('=', trim($val), 2); - $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]); - } - - // should have (at least) qop, realm, nonce - if (isset($digestRequest['nonce'])) { - $this->setCredentials($this->username, $this->password, 'digest', $digestRequest); - $this->tryagain = true; - return false; - } - } - $this->debug('HTTP authentication failed'); - $this->setError('HTTP authentication failed'); - return false; - } - - if ( - ($http_status >= 300 && $http_status <= 307) || - ($http_status >= 400 && $http_status <= 417) || - ($http_status >= 501 && $http_status <= 505) - ) { - $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)"); - return false; - } - - // decode content-encoding - if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ - if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ - // if decoding works, use it. else assume data wasn't gzencoded - if(function_exists('gzinflate')){ - //$timer->setMarker('starting decoding of gzip/deflated content'); - // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) - // this means there are no Zlib headers, although there should be - $this->debug('The gzinflate function exists'); - $datalen = strlen($data); - if ($this->incoming_headers['content-encoding'] == 'deflate') { - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The inflated payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to inflate the payload'); - $this->setError('Error using gzinflate to inflate the payload'); - } - } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { - if ($degzdata = @gzinflate(substr($data, 10))) { // do our best - $data = $degzdata; - $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate(substr($data, 10))) { - $data = $degzdata; - $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to un-gzip the payload'); - $this->setError('Error using gzinflate to un-gzip the payload'); - } - } - //$timer->setMarker('finished decoding of gzip/deflated content'); - //print "\nde-inflated:\n---------------\n$data\n-------------\n"; - // set decoded payload - $this->incoming_payload = $header_data.$lb.$lb.$data; - } else { - $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - } - } else { - $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - } - } else { - $this->debug('No Content-Encoding header'); - } - - if(strlen($data) == 0){ - $this->debug('no data after headers!'); - $this->setError('no data present after HTTP headers'); - return false; - } - - return $data; - } - - /** - * sets the content-type for the SOAP message to be sent - * - * @param string $type the content type, MIME style - * @param mixed $charset character set used for encoding (or false) - * @access public - */ - function setContentType($type, $charset = false) { - $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); - } - - /** - * specifies that an HTTP persistent connection should be used - * - * @return boolean whether the request was honored by this method. - * @access public - */ - function usePersistentConnection(){ - if (isset($this->outgoing_headers['Accept-Encoding'])) { - return false; - } - $this->protocol_version = '1.1'; - $this->persistentConnection = true; - $this->setHeader('Connection', 'Keep-Alive'); - return true; - } - - /** - * parse an incoming Cookie into it's parts - * - * @param string $cookie_str content of cookie - * @return array with data of that cookie - * @access private - */ - /* - * TODO: allow a Set-Cookie string to be parsed into multiple cookies - */ - function parseCookie($cookie_str) { - $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; - $data = preg_split('/;/', $cookie_str); - $value_str = $data[0]; - - $cookie_param = 'domain='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $domain = substr($cookie_str, $start + strlen($cookie_param)); - $domain = substr($domain, 0, strpos($domain, ';')); - } else { - $domain = ''; - } - - $cookie_param = 'expires='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $expires = substr($cookie_str, $start + strlen($cookie_param)); - $expires = substr($expires, 0, strpos($expires, ';')); - } else { - $expires = ''; - } - - $cookie_param = 'path='; - $start = strpos($cookie_str, $cookie_param); - if ( $start > 0 ) { - $path = substr($cookie_str, $start + strlen($cookie_param)); - $path = substr($path, 0, strpos($path, ';')); - } else { - $path = '/'; - } - - $cookie_param = ';secure;'; - if (strpos($cookie_str, $cookie_param) !== FALSE) { - $secure = true; - } else { - $secure = false; - } - - $sep_pos = strpos($value_str, '='); - - if ($sep_pos) { - $name = substr($value_str, 0, $sep_pos); - $value = substr($value_str, $sep_pos + 1); - $cookie= array( 'name' => $name, - 'value' => $value, - 'domain' => $domain, - 'path' => $path, - 'expires' => $expires, - 'secure' => $secure - ); - return $cookie; - } - return false; - } - - /** - * sort out cookies for the current request - * - * @param array $cookies array with all cookies - * @param boolean $secure is the send-content secure or not? - * @return string for Cookie-HTTP-Header - * @access private - */ - function getCookiesForRequest($cookies, $secure=false) { - $cookie_str = ''; - if ((! is_null($cookies)) && (is_array($cookies))) { - foreach ($cookies as $cookie) { - if (! is_array($cookie)) { - continue; - } - $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) <= time()) { - $this->debug('cookie has expired'); - continue; - } - } - if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { - $domain = preg_quote($cookie['domain']); - if (! preg_match("'.*$domain$'i", $this->host)) { - $this->debug('cookie has different domain'); - continue; - } - } - if ((isset($cookie['path'])) && (! empty($cookie['path']))) { - $path = preg_quote($cookie['path']); - if (! preg_match("'^$path.*'i", $this->path)) { - $this->debug('cookie is for a different path'); - continue; - } - } - if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { - $this->debug('cookie is secure, transport is not'); - continue; - } - $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; - $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); - } - } - return $cookie_str; - } -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_server extends nusoap_base { - /** - * HTTP headers of request - * @var array - * @access private - */ - var $headers = array(); - /** - * HTTP request - * @var string - * @access private - */ - var $request = ''; - /** - * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $requestHeaders = ''; - /** - * SOAP Headers from request (parsed) - * @var mixed - * @access public - */ - var $requestHeader = NULL; - /** - * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $document = ''; - /** - * SOAP payload for request (text) - * @var string - * @access public - */ - var $requestSOAP = ''; - /** - * requested method namespace URI - * @var string - * @access private - */ - var $methodURI = ''; - /** - * name of method requested - * @var string - * @access private - */ - var $methodname = ''; - /** - * method parameters from request - * @var array - * @access private - */ - var $methodparams = array(); - /** - * SOAP Action from request - * @var string - * @access private - */ - var $SOAPAction = ''; - /** - * character set encoding of incoming (request) messages - * @var string - * @access public - */ - var $xml_encoding = ''; - /** - * toggles whether the parser decodes element content w/ utf8_decode() - * @var boolean - * @access public - */ - var $decode_utf8 = true; - - /** - * HTTP headers of response - * @var array - * @access public - */ - var $outgoing_headers = array(); - /** - * HTTP response - * @var string - * @access private - */ - var $response = ''; - /** - * SOAP headers for response (text or array of soapval or associative array) - * @var mixed - * @access public - */ - var $responseHeaders = ''; - /** - * SOAP payload for response (text) - * @var string - * @access private - */ - var $responseSOAP = ''; - /** - * method return value to place in response - * @var mixed - * @access private - */ - var $methodreturn = false; - /** - * whether $methodreturn is a string of literal XML - * @var boolean - * @access public - */ - var $methodreturnisliteralxml = false; - /** - * SOAP fault for response (or false) - * @var mixed - * @access private - */ - var $fault = false; - /** - * text indication of result (for debugging) - * @var string - * @access private - */ - var $result = 'successful'; - - /** - * assoc array of operations => opData; operations are added by the register() - * method or by parsing an external WSDL definition - * @var array - * @access private - */ - var $operations = array(); - /** - * wsdl instance (if one) - * @var mixed - * @access private - */ - var $wsdl = false; - /** - * URL for WSDL (if one) - * @var mixed - * @access private - */ - var $externalWSDLURL = false; - /** - * whether to append debug to response as XML comment - * @var boolean - * @access public - */ - var $debug_flag = false; - - - /** - * constructor - * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to. - * - * @param mixed $wsdl file path or URL (string), or wsdl instance (object) - * @access public - */ - function nusoap_server($wsdl=false){ - parent::nusoap_base(); - // turn on debugging? - global $debug; - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $this->debug("_SERVER is defined:"); - $this->appendDebug($this->varDump($_SERVER)); - } elseif (isset($HTTP_SERVER_VARS)) { - $this->debug("HTTP_SERVER_VARS is defined:"); - $this->appendDebug($this->varDump($HTTP_SERVER_VARS)); - } else { - $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined."); - } - - if (isset($debug)) { - $this->debug("In nusoap_server, set debug_flag=$debug based on global flag"); - $this->debug_flag = $debug; - } elseif (isset($_SERVER['QUERY_STRING'])) { - $qs = explode('&', $_SERVER['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1"); - $this->debug_flag = substr($v, 6); - } - } - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2"); - $this->debug_flag = substr($v, 6); - } - } - } - - // wsdl - if($wsdl){ - $this->debug("In nusoap_server, WSDL is specified"); - if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) { - $this->wsdl = $wsdl; - $this->externalWSDLURL = $this->wsdl->wsdl; - $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL); - } else { - $this->debug('Create wsdl from ' . $wsdl); - $this->wsdl = new wsdl($wsdl); - $this->externalWSDLURL = $wsdl; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($err = $this->wsdl->getError()){ - die('WSDL ERROR: '.$err); - } - } - } - - /** - * processes request and returns response - * - * @param string $data usually is the value of $HTTP_RAW_POST_DATA - * @access public - */ - function service($data){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER['REQUEST_METHOD'])) { - $rm = $_SERVER['REQUEST_METHOD']; - } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) { - $rm = $HTTP_SERVER_VARS['REQUEST_METHOD']; - } else { - $rm = ''; - } - - if (isset($_SERVER['QUERY_STRING'])) { - $qs = $_SERVER['QUERY_STRING']; - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = $HTTP_SERVER_VARS['QUERY_STRING']; - } else { - $qs = ''; - } - $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data)); - - if ($rm == 'POST') { - $this->debug("In service, invoke the request"); - $this->parse_request($data); - if (! $this->fault) { - $this->invoke_method(); - } - if (! $this->fault) { - $this->serialize_return(); - } - $this->send_response(); - } elseif (preg_match('/wsdl/', $qs) ){ - $this->debug("In service, this is a request for WSDL"); - if ($this->externalWSDLURL){ - if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL - $this->debug("In service, re-direct for WSDL"); - header('Location: '.$this->externalWSDLURL); - } else { // assume file - $this->debug("In service, use file passthru for WSDL"); - header("Content-Type: text/xml\r\n"); - $pos = strpos($this->externalWSDLURL, "file://"); - if ($pos === false) { - $filename = $this->externalWSDLURL; - } else { - $filename = substr($this->externalWSDLURL, $pos + 7); - } - $fp = fopen($this->externalWSDLURL, 'r'); - fpassthru($fp); - } - } elseif ($this->wsdl) { - $this->debug("In service, serialize WSDL"); - header("Content-Type: text/xml; charset=ISO-8859-1\r\n"); - print $this->wsdl->serialize($this->debug_flag); - if ($this->debug_flag) { - $this->debug('wsdl:'); - $this->appendDebug($this->varDump($this->wsdl)); - print $this->getDebugAsXMLComment(); - } - } else { - $this->debug("In service, there is no WSDL"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide WSDL"; - } - } elseif ($this->wsdl) { - $this->debug("In service, return Web description"); - print $this->wsdl->webDescription(); - } else { - $this->debug("In service, no Web description"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide a Web description"; - } - } - - /** - * parses HTTP request headers. - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * - * @access private - */ - function parse_http_headers() { - global $HTTP_SERVER_VARS; - - $this->request = ''; - $this->SOAPAction = ''; - if(function_exists('getallheaders')){ - $this->debug("In parse_http_headers, use getallheaders"); - $headers = getallheaders(); - foreach($headers as $k=>$v){ - $k = strtolower($k); - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - // get SOAPAction header - if(isset($this->headers['soapaction'])){ - $this->SOAPAction = str_replace('"','',$this->headers['soapaction']); - } - // get the character encoding of the incoming request - if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){ - $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1)); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } elseif(isset($_SERVER) && is_array($_SERVER)){ - $this->debug("In parse_http_headers, use _SERVER"); - foreach ($_SERVER as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } elseif (is_array($HTTP_SERVER_VARS)) { - $this->debug("In parse_http_headers, use HTTP_SERVER_VARS"); - foreach ($HTTP_SERVER_VARS as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5)); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } else { - $this->debug("In parse_http_headers, HTTP headers not accessible"); - $this->setError("HTTP headers not accessible"); - } - } - - /** - * parses a request - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * request - * requestSOAP - * methodURI - * methodname - * methodparams - * requestHeaders - * document - * - * This sets the fault field on error - * - * @param string $data XML string - * @access private - */ - function parse_request($data='') { - $this->debug('entering parse_request()'); - $this->parse_http_headers(); - $this->debug('got character encoding: '.$this->xml_encoding); - // uncompress if necessary - if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') { - $this->debug('got content encoding: ' . $this->headers['content-encoding']); - if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') { - // if decoding works, use it. else assume data wasn't gzencoded - if (function_exists('gzuncompress')) { - if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { - $data = $degzdata; - } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) { - $data = $degzdata; - } else { - $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data'); - return; - } - } else { - $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data'); - return; - } - } - } - $this->request .= "\r\n".$data; - $data = $this->parseRequest($this->headers, $data); - $this->requestSOAP = $data; - $this->debug('leaving parse_request'); - } - - /** - * invokes a PHP function for the requested SOAP method - * - * The following fields are set by this function (when successful) - * - * methodreturn - * - * Note that the PHP function that is called may also set the following - * fields to affect the response sent to the client - * - * responseHeaders - * outgoing_headers - * - * This sets the fault field on error - * - * @access private - */ - function invoke_method() { - $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction); - - // - // if you are debugging in this area of the code, your service uses a class to implement methods, - // you use SOAP RPC, and the client is .NET, please be aware of the following... - // when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the - // method name. that is fine for naming the .NET methods. it is not fine for properly constructing - // the XML request and reading the XML response. you need to add the RequestElementName and - // ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe - // generates for the method. these parameters are used to specify the correct XML element names - // for .NET to use, i.e. the names with the '.' in them. - // - $orig_methodname = $this->methodname; - if ($this->wsdl) { - if ($this->opData = $this->wsdl->getOperationData($this->methodname)) { - $this->debug('in invoke_method, found WSDL operation=' . $this->methodname); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) { - // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element - $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - $this->methodname = $this->opData['name']; - } else { - $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname); - $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service"); - return; - } - } else { - $this->debug('in invoke_method, no WSDL to validate method'); - } - - // if a . is present in $this->methodname, we see if there is a class in scope, - // which could be referred to. We will also distinguish between two deliminators, - // to allow methods to be called a the class or an instance - if (strpos($this->methodname, '..') > 0) { - $delim = '..'; - } else if (strpos($this->methodname, '.') > 0) { - $delim = '.'; - } else { - $delim = ''; - } - $this->debug("in invoke_method, delim=$delim"); - - $class = ''; - $method = ''; - if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) { - $try_class = substr($this->methodname, 0, strpos($this->methodname, $delim)); - if (class_exists($try_class)) { - // get the class and method name - $class = $try_class; - $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim)); - $this->debug("in invoke_method, class=$class method=$method delim=$delim"); - } else { - $this->debug("in invoke_method, class=$try_class not found"); - } - } else { - $try_class = ''; - $this->debug("in invoke_method, no class to try"); - } - - // does method exist? - if ($class == '') { - if (!function_exists($this->methodname)) { - $this->debug("in invoke_method, function '$this->methodname' not found!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')"); - return; - } - } else { - $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method; - if (!in_array($method_to_compare, get_class_methods($class))) { - $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')"); - return; - } - } - - // evaluate message, getting back parameters - // verify that request parameters match the method's signature - if(! $this->verify_method($this->methodname,$this->methodparams)){ - // debug - $this->debug('ERROR: request not verified against method signature'); - $this->result = 'fault: request failed validation against method signature'; - // return fault - $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service."); - return; - } - - // if there are parameters to pass - $this->debug('in invoke_method, params:'); - $this->appendDebug($this->varDump($this->methodparams)); - $this->debug("in invoke_method, calling '$this->methodname'"); - if (!function_exists('call_user_func_array')) { - if ($class == '') { - $this->debug('in invoke_method, calling function using eval()'); - $funcCall = "\$this->methodreturn = $this->methodname("; - } else { - if ($delim == '..') { - $this->debug('in invoke_method, calling class method using eval()'); - $funcCall = "\$this->methodreturn = ".$class."::".$method."("; - } else { - $this->debug('in invoke_method, calling instance method using eval()'); - // generate unique instance name - $instname = "\$inst_".time(); - $funcCall = $instname." = new ".$class."(); "; - $funcCall .= "\$this->methodreturn = ".$instname."->".$method."("; - } - } - if ($this->methodparams) { - foreach ($this->methodparams as $param) { - if (is_array($param) || is_object($param)) { - $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available'); - return; - } - $funcCall .= "\"$param\","; - } - $funcCall = substr($funcCall, 0, -1); - } - $funcCall .= ');'; - $this->debug('in invoke_method, function call: '.$funcCall); - @eval($funcCall); - } else { - if ($class == '') { - $this->debug('in invoke_method, calling function using call_user_func_array()'); - $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array() - } elseif ($delim == '..') { - $this->debug('in invoke_method, calling class method using call_user_func_array()'); - $call_arg = array ($class, $method); - } else { - $this->debug('in invoke_method, calling instance method using call_user_func_array()'); - $instance = new $class (); - $call_arg = array(&$instance, $method); - } - if (is_array($this->methodparams)) { - $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams)); - } else { - $this->methodreturn = call_user_func_array($call_arg, array()); - } - } - $this->debug('in invoke_method, methodreturn:'); - $this->appendDebug($this->varDump($this->methodreturn)); - $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn)); - } - - /** - * serializes the return value from a PHP function into a full SOAP Envelope - * - * The following fields are set by this function (when successful) - * - * responseSOAP - * - * This sets the fault field on error - * - * @access private - */ - function serialize_return() { - $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI); - // if fault - if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { - $this->debug('got a fault object from method'); - $this->fault = $this->methodreturn; - return; - } elseif ($this->methodreturnisliteralxml) { - $return_val = $this->methodreturn; - // returned value(s) - } else { - $this->debug('got a(n) '.gettype($this->methodreturn).' from method'); - $this->debug('serializing return value'); - if($this->wsdl){ - if (sizeof($this->opData['output']['parts']) > 1) { - $this->debug('more than one output part, so use the method return unchanged'); - $opParams = $this->methodreturn; - } elseif (sizeof($this->opData['output']['parts']) == 1) { - $this->debug('exactly one output part, so wrap the method return in a simple array'); - // TODO: verify that it is not already wrapped! - //foreach ($this->opData['output']['parts'] as $name => $type) { - // $this->debug('wrap in element named ' . $name); - //} - $opParams = array($this->methodreturn); - } - $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams); - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($errstr = $this->wsdl->getError()){ - $this->debug('got wsdl error: '.$errstr); - $this->fault('SOAP-ENV:Server', 'unable to serialize result'); - return; - } - } else { - if (isset($this->methodreturn)) { - $return_val = $this->serialize_val($this->methodreturn, 'return'); - } else { - $return_val = ''; - $this->debug('in absence of WSDL, assume void return for backward compatibility'); - } - } - } - $this->debug('return value:'); - $this->appendDebug($this->varDump($return_val)); - - $this->debug('serializing response'); - if ($this->wsdl) { - $this->debug('have WSDL for serialization: style is ' . $this->opData['style']); - if ($this->opData['style'] == 'rpc') { - $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']); - if ($this->opData['output']['use'] == 'literal') { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } else { - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } - } else { - $this->debug('style is not rpc for serialization: assume document'); - $payload = $return_val; - } - } else { - $this->debug('do not have WSDL for serialization: assume rpc/encoded'); - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } - $this->result = 'successful'; - if($this->wsdl){ - //if($this->debug_flag){ - $this->appendDebug($this->wsdl->getDebug()); - // } - if (isset($this->opData['output']['encodingStyle'])) { - $encodingStyle = $this->opData['output']['encodingStyle']; - } else { - $encodingStyle = ''; - } - // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces. - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle); - } else { - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders); - } - $this->debug("Leaving serialize_return"); - } - - /** - * sends an HTTP response - * - * The following fields are set by this function (when successful) - * - * outgoing_headers - * response - * - * @access private - */ - function send_response() { - $this->debug('Enter send_response'); - if ($this->fault) { - $payload = $this->fault->serialize(); - $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error"; - $this->outgoing_headers[] = "Status: 500 Internal Server Error"; - } else { - $payload = $this->responseSOAP; - // Some combinations of PHP+Web server allow the Status - // to come through as a header. Since OK is the default - // just do nothing. - // $this->outgoing_headers[] = "HTTP/1.0 200 OK"; - // $this->outgoing_headers[] = "Status: 200 OK"; - } - // add debug data if in debug mode - if(isset($this->debug_flag) && $this->debug_flag){ - $payload .= $this->getDebugAsXMLComment(); - } - $this->outgoing_headers[] = "Server: $this->title Server v$this->version"; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")"; - // Let the Web server decide about this - //$this->outgoing_headers[] = "Connection: Close\r\n"; - $payload = $this->getHTTPBody($payload); - $type = $this->getHTTPContentType(); - $charset = $this->getHTTPContentTypeCharset(); - $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : ''); - //begin code to compress payload - by John - // NOTE: there is no way to know whether the Web server will also compress - // this data. - if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) { - if (strstr($this->headers['accept-encoding'], 'gzip')) { - if (function_exists('gzencode')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: gzip"; - $payload = gzencode($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } elseif (strstr($this->headers['accept-encoding'], 'deflate')) { - // Note: MSIE requires gzdeflate output (no Zlib header and checksum), - // instead of gzcompress output, - // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5) - if (function_exists('gzdeflate')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: deflate"; - $payload = gzdeflate($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } - } - //end code - $this->outgoing_headers[] = "Content-Length: ".strlen($payload); - reset($this->outgoing_headers); - foreach($this->outgoing_headers as $hdr){ - header($hdr, false); - } - print $payload; - $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload; - } - - /** - * takes the value that was created by parsing the request - * and compares to the method's signature, if available. - * - * @param string $operation The operation to be invoked - * @param array $request The array of parameter values - * @return boolean Whether the operation was found - * @access private - */ - function verify_method($operation,$request){ - if(isset($this->wsdl) && is_object($this->wsdl)){ - if($this->wsdl->getOperationData($operation)){ - return true; - } - } elseif(isset($this->operations[$operation])){ - return true; - } - return false; - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Request not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Request not of type text/xml'); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - // parse response, get soap parser obj - $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8); - // parser debug - $this->debug("parser debug: \n".$parser->getDebug()); - // if fault occurred during message parsing - if($err = $parser->getError()){ - $this->result = 'fault: error in msg parsing: '.$err; - $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err); - // else successfully parsed request into soapval object - } else { - // get/set methodname - $this->methodURI = $parser->root_struct_namespace; - $this->methodname = $parser->root_struct_name; - $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI); - $this->debug('calling parser->get_soapbody()'); - $this->methodparams = $parser->get_soapbody(); - // get SOAP headers - $this->requestHeaders = $parser->getHeaders(); - // get SOAP Header - $this->requestHeader = $parser->get_soapheader(); - // add document for doclit support - $this->document = $parser->document; - } - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /** - * add a method to the dispatch map (this has been replaced by the register method) - * - * @param string $methodname - * @param string $in array of input values - * @param string $out array of output values - * @access public - * @deprecated - */ - function add_to_map($methodname,$in,$out){ - $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out); - } - - /** - * register a service function with the server - * - * @param string $name the name of the PHP function, class.method or class..method - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param mixed $namespace the element namespace for the method or false - * @param mixed $soapaction the soapaction for the method or false - * @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param mixed $use optional (encoded|literal) or false - * @param string $documentation optional Description to include in WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){ - global $HTTP_SERVER_VARS; - - if($this->externalWSDLURL){ - die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); - } - if (! $name) { - die('You must specify a name when you register an operation'); - } - if (!is_array($in)) { - die('You must provide an array for operation inputs'); - } - if (!is_array($out)) { - die('You must provide an array for operation outputs'); - } - if(false == $namespace) { - } - if(false == $soapaction) { - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; - } - if(false == $style) { - $style = "rpc"; - } - if(false == $use) { - $use = "encoded"; - } - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - $this->operations[$name] = array( - 'name' => $name, - 'in' => $in, - 'out' => $out, - 'namespace' => $namespace, - 'soapaction' => $soapaction, - 'style' => $style); - if($this->wsdl){ - $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle); - } - return true; - } - - /** - * Specify a fault to be returned to the client. - * This also acts as a flag to the server that a fault has occured. - * - * @param string $faultcode - * @param string $faultstring - * @param string $faultactor - * @param string $faultdetail - * @access public - */ - function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){ - if ($faultdetail == '' && $this->debug_flag) { - $faultdetail = $this->getDebug(); - } - $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail); - $this->fault->soap_defencoding = $this->soap_defencoding; - } - - /** - * Sets up wsdl object. - * Acts as a flag to enable internal WSDL generation - * - * @param string $serviceName, name of the service - * @param mixed $namespace optional 'tns' service namespace or false - * @param mixed $endpoint optional URL of service endpoint or false - * @param string $style optional (rpc|document) WSDL style (also specified by operation) - * @param string $transport optional SOAP transport - * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false - */ - function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) - { - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SERVER_PORT = $_SERVER['SERVER_PORT']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI) - $colon = strpos($SERVER_NAME,":"); - if ($colon) { - $SERVER_NAME = substr($SERVER_NAME, 0, $colon); - } - if ($SERVER_PORT == 80) { - $SERVER_PORT = ''; - } else { - $SERVER_PORT = ':' . $SERVER_PORT; - } - if(false == $namespace) { - $namespace = "http://$SERVER_NAME/soap/$serviceName"; - } - - if(false == $endpoint) { - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME"; - } - - if(false == $schemaTargetNamespace) { - $schemaTargetNamespace = $namespace; - } - - $this->wsdl = new wsdl; - $this->wsdl->serviceName = $serviceName; - $this->wsdl->endpoint = $endpoint; - $this->wsdl->namespaces['tns'] = $namespace; - $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/'; - $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/'; - if ($schemaTargetNamespace != $namespace) { - $this->wsdl->namespaces['types'] = $schemaTargetNamespace; - } - $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces); - if ($style == 'document') { - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified'; - } - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace; - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->bindings[$serviceName.'Binding'] = array( - 'name'=>$serviceName.'Binding', - 'style'=>$style, - 'transport'=>$transport, - 'portType'=>$serviceName.'PortType'); - $this->wsdl->ports[$serviceName.'Port'] = array( - 'binding'=>$serviceName.'Binding', - 'location'=>$endpoint, - 'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/'); - } -} - -/** - * Backward compatibility - */ -class soap_server extends nusoap_server { -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class wsdl extends nusoap_base { - // URL or filename of the root of this WSDL - var $wsdl; - // define internal arrays of bindings, ports, operations, messages, etc. - var $schemas = array(); - var $currentSchema; - var $message = array(); - var $complexTypes = array(); - var $messages = array(); - var $currentMessage; - var $currentOperation; - var $portTypes = array(); - var $currentPortType; - var $bindings = array(); - var $currentBinding; - var $ports = array(); - var $currentPort; - var $opData = array(); - var $status = ''; - var $documentation = false; - var $endpoint = ''; - // array of wsdl docs to import - var $import = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - // for getting wsdl - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $timeout = 0; - var $response_timeout = 30; - var $curl_options = array(); // User-specified cURL options - var $use_curl = false; // whether to always try to use cURL - // for HTTP authentication - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - - /** - * constructor - * - * @param string $wsdl WSDL document URL - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param array $curl_options user-specified cURL options - * @param boolean $use_curl try to use cURL - * @access public - */ - function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ - parent::nusoap_base(); - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - if (is_array($curl_options)) - $this->curl_options = $curl_options; - $this->use_curl = $use_curl; - $this->fetchWSDL($wsdl); - } - - /** - * fetches the WSDL document and parses it - * - * @access public - */ - function fetchWSDL($wsdl) { - $this->debug("parse and process WSDL path=$wsdl"); - $this->wsdl = $wsdl; - // parse wsdl file - if ($this->wsdl != "") { - $this->parseWSDL($this->wsdl); - } - // imports - // TODO: handle imports more properly, grabbing them in-line and nesting them - $imported_urls = array(); - $imported = 1; - while ($imported > 0) { - $imported = 0; - // Schema imports - foreach ($this->schemas as $ns => $list) { - foreach ($list as $ilist => $xs) { - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($xs->imports as $ns2 => $list2) { - for ($ii = 0; $ii < count($list2); $ii++) { - if (! $list2[$ii]['loaded']) { - $this->schemas[$ns][$ilist]->imports[$ns2][$ii]['loaded'] = true; - $url = $list2[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - } - // WSDL imports - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($this->import as $ns => $list) { - for ($ii = 0; $ii < count($list); $ii++) { - if (! $list[$ii]['loaded']) { - $this->import[$ns][$ii]['loaded'] = true; - $url = $list[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - // add new data to operation data - foreach($this->bindings as $binding => $bindingData) { - if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { - foreach($bindingData['operations'] as $operation => $data) { - $this->debug('post-parse data gathering for ' . $operation); - $this->bindings[$binding]['operations'][$operation]['input'] = - isset($this->bindings[$binding]['operations'][$operation]['input']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; - $this->bindings[$binding]['operations'][$operation]['output'] = - isset($this->bindings[$binding]['operations'][$operation]['output']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; - } - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; - } - // Set operation style if necessary, but do not override one already provided - if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { - $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; - } - $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; - $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; - } - } - } - } - - /** - * parses the wsdl document - * - * @param string $wsdl path or URL - * @access private - */ - function parseWSDL($wsdl = '') { - $this->debug("parse WSDL at path=$wsdl"); - - if ($wsdl == '') { - $this->debug('no wsdl passed to parseWSDL()!!'); - $this->setError('no wsdl passed to parseWSDL()!!'); - return false; - } - - // parse $wsdl for url format - $wsdl_props = parse_url($wsdl); - - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { - $this->debug('getting WSDL http(s) URL ' . $wsdl); - // get wsdl - $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); - $tr->request_method = 'GET'; - $tr->useSOAPAction = false; - if($this->proxyhost && $this->proxyport){ - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if ($this->authtype != '') { - $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - $tr->setEncoding('gzip, deflate'); - $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); - //$this->debug("WSDL request\n" . $tr->outgoing_payload); - //$this->debug("WSDL response\n" . $tr->incoming_payload); - $this->appendDebug($tr->getDebug()); - // catch errors - if($err = $tr->getError() ){ - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; - $this->debug($errstr); - $this->setError($errstr); - unset($tr); - return false; - } - unset($tr); - $this->debug("got WSDL URL"); - } else { - // $wsdl is not http(s), so treat it as a file URL or plain file path - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; - } else { - $path = $wsdl; - } - $this->debug('getting WSDL file ' . $path); - if ($fp = @fopen($path, 'r')) { - $wsdl_string = ''; - while ($data = fread($fp, 32768)) { - $wsdl_string .= $data; - } - fclose($fp); - } else { - $errstr = "Bad path to WSDL file $path"; - $this->debug($errstr); - $this->setError($errstr); - return false; - } - } - $this->debug('Parse WSDL'); - // end new code added - // Create an XML parser. - $this->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($this->parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element', 'end_element'); - xml_set_character_data_handler($this->parser, 'character_data'); - // Parse the XML file. - if (!xml_parse($this->parser, $wsdl_string, true)) { - // Display an error message. - $errstr = sprintf( - 'XML error parsing WSDL from %s on line %d: %s', - $wsdl, - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $wsdl_string); - $this->setError($errstr); - return false; - } - // free the parser - xml_parser_free($this->parser); - $this->debug('Parsing WSDL done'); - // catch wsdl parse errors - if($this->getError()){ - return false; - } - return true; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) - { - if ($this->status == 'schema') { - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } elseif (preg_match('/schema$/', $name)) { - $this->debug('Parsing WSDL schema'); - // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")"); - $this->status = 'schema'; - $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } else { - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - // process attributes - if (count($attrs) > 0) { - // register namespace declarations - foreach($attrs as $k => $v) { - if (preg_match('/^xmlns/',$k)) { - if ($ns_prefix = substr(strrchr($k, ':'), 1)) { - $this->namespaces[$ns_prefix] = $v; - } else { - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; - } - if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v . '-instance'; - } - } - } - // expand each attribute prefix to its namespace - foreach($attrs as $k => $v) { - $k = strpos($k, ':') ? $this->expandQname($k) : $k; - if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { - $v = strpos($v, ':') ? $this->expandQname($v) : $v; - } - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // get element prefix, namespace and name - if (preg_match('/:/', $name)) { - // get ns prefix - $prefix = substr($name, 0, strpos($name, ':')); - // get ns - $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; - // get unqualified name - $name = substr(strstr($name, ':'), 1); - } - // process attributes, expanding any prefixes to namespaces - // find status, register data - switch ($this->status) { - case 'message': - if ($name == 'part') { - if (isset($attrs['type'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; - } - if (isset($attrs['element'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; - } - } - break; - case 'portType': - switch ($name) { - case 'operation': - $this->currentPortOperation = $attrs['name']; - $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); - if (isset($attrs['parameterOrder'])) { - $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; - } - break; - case 'documentation': - $this->documentation = true; - break; - // merge input/output data - default: - $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; - $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; - break; - } - break; - case 'binding': - switch ($name) { - case 'binding': - // get ns prefix - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['prefix'] = $prefix; - } - $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); - break; - case 'header': - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; - break; - case 'operation': - if (isset($attrs['soapAction'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; - } - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; - } - if (isset($attrs['name'])) { - $this->currentOperation = $attrs['name']; - $this->debug("current binding operation: $this->currentOperation"); - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; - } - break; - case 'input': - $this->opStatus = 'input'; - break; - case 'output': - $this->opStatus = 'output'; - break; - case 'body': - if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); - } else { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; - } - break; - } - break; - case 'service': - switch ($name) { - case 'port': - $this->currentPort = $attrs['name']; - $this->debug('current port: ' . $this->currentPort); - $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); - - break; - case 'address': - $this->ports[$this->currentPort]['location'] = $attrs['location']; - $this->ports[$this->currentPort]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; - break; - } - break; - } - // set status - switch ($name) { - case 'import': - if (isset($attrs['location'])) { - $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); - } else { - $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); - } - break; - //wait for schema - //case 'types': - // $this->status = 'schema'; - // break; - case 'message': - $this->status = 'message'; - $this->messages[$attrs['name']] = array(); - $this->currentMessage = $attrs['name']; - break; - case 'portType': - $this->status = 'portType'; - $this->portTypes[$attrs['name']] = array(); - $this->currentPortType = $attrs['name']; - break; - case "binding": - if (isset($attrs['name'])) { - // get binding name - if (strpos($attrs['name'], ':')) { - $this->currentBinding = $this->getLocalPart($attrs['name']); - } else { - $this->currentBinding = $attrs['name']; - } - $this->status = 'binding'; - $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); - } - break; - case 'service': - $this->serviceName = $attrs['name']; - $this->status = 'service'; - $this->debug('current service: ' . $this->serviceName); - break; - case 'definitions': - foreach ($attrs as $name => $value) { - $this->wsdl_info[$name] = $value; - } - break; - } - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name){ - // unset schema status - if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { - $this->status = ""; - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; - $this->debug('Parsing WSDL schema done'); - } - if ($this->status == 'schema') { - $this->currentSchema->schemaEndElement($parser, $name); - } else { - // bring depth down a notch - $this->depth--; - } - // end documentation - if ($this->documentation) { - //TODO: track the node to which documentation should be assigned; it can be a part, message, etc. - //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation; - $this->documentation = false; - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data) - { - $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0; - if (isset($this->message[$pos]['cdata'])) { - $this->message[$pos]['cdata'] .= $data; - } - if ($this->documentation) { - $this->documentation .= $data; - } - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - function getBindingData($binding) - { - if (is_array($this->bindings[$binding])) { - return $this->bindings[$binding]; - } - } - - /** - * returns an assoc array of operation names => operation data - * - * @param string $portName WSDL port name - * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) - * @return array - * @access public - */ - function getOperations($portName = '', $bindingType = 'soap') { - $ops = array(); - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } else { - $this->debug("getOperations bindingType $bindingType may not be supported"); - } - $this->debug("getOperations for port '$portName' bindingType $bindingType"); - // loop thru ports - foreach($this->ports as $port => $portData) { - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); - if ($portName == '' || $port == $portName) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - $this->debug("getOperations found port $port bindingType $bindingType"); - //$this->debug("port data: " . $this->varDump($portData)); - //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); - // merge bindings - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); - } - } - } - } - if (count($ops) == 0) { - $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); - } - return $ops; - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $operation name of operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationData($operation, $bindingType = 'soap') - { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // get binding - //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { - // note that we could/should also check the namespace here - if ($operation == $bOperation) { - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; - return $opData; - } - } - } - } - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $soapAction soapAction for operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // loop through operations for the binding - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - if ($opData['soapAction'] == $soapAction) { - return $opData; - } - } - } - } - } - - /** - * returns an array of information about a given type - * returns false if no type exists by the given name - * - * typeDef = array( - * 'elements' => array(), // refs to elements array - * 'restrictionBase' => '', - * 'phpType' => '', - * 'order' => '(sequence|all)', - * 'attrs' => array() // refs to attributes array - * ) - * - * @param string $type the type - * @param string $ns namespace (not prefix) of the type - * @return mixed - * @access public - * @see nusoap_xmlschema - */ - function getTypeDef($type, $ns) { - $this->debug("in getTypeDef: type=$type, ns=$ns"); - if ((! $ns) && isset($this->namespaces['tns'])) { - $ns = $this->namespaces['tns']; - $this->debug("in getTypeDef: type namespace forced to $ns"); - } - if (!isset($this->schemas[$ns])) { - foreach ($this->schemas as $ns0 => $schema0) { - if (strcasecmp($ns, $ns0) == 0) { - $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0"); - $ns = $ns0; - break; - } - } - } - if (isset($this->schemas[$ns])) { - $this->debug("in getTypeDef: have schema for namespace $ns"); - for ($i = 0; $i < count($this->schemas[$ns]); $i++) { - $xs = &$this->schemas[$ns][$i]; - $t = $xs->getTypeDef($type); - $this->appendDebug($xs->getDebug()); - $xs->clearDebug(); - if ($t) { - $this->debug("in getTypeDef: found type $type"); - if (!isset($t['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($t['type'], strrpos($t['type'], ':') + 1); - $ns = substr($t['type'], 0, strrpos($t['type'], ':')); - $etype = $this->getTypeDef($uqType, $ns); - if ($etype) { - $this->debug("found type for [element] $type:"); - $this->debug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $t['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $t['elements'] = $etype['elements']; - } - if (isset($etype['attrs'])) { - $t['attrs'] = $etype['attrs']; - } - } else { - $this->debug("did not find type for [element] $type"); - } - } - return $t; - } - } - $this->debug("in getTypeDef: did not find type $type"); - } else { - $this->debug("in getTypeDef: do not have schema for namespace $ns"); - } - return false; - } - - /** - * prints html description of services - * - * @access private - */ - function webDescription(){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $PHP_SELF = $_SERVER['PHP_SELF']; - } elseif (isset($HTTP_SERVER_VARS)) { - $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - - $b = ' - NuSOAP: '.$this->serviceName.' - - - - -
    -

    -
    '.$this->serviceName.'
    - -
    '; - return $b; - } - - /** - * serialize the parsed wsdl - * - * @param mixed $debug whether to put debug=1 in endpoint URL - * @return string serialization of WSDL - * @access public - */ - function serialize($debug = 0) - { - $xml = ''; - $xml .= "\nnamespaces as $k => $v) { - $xml .= " xmlns:$k=\"$v\""; - } - // 10.9.02 - add poulter fix for wsdl and tns declarations - if (isset($this->namespaces['wsdl'])) { - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; - } - if (isset($this->namespaces['tns'])) { - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; - } - $xml .= '>'; - // imports - if (sizeof($this->import) > 0) { - foreach($this->import as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= ''; - } else { - $xml .= ''; - } - } - } - } - // types - if (count($this->schemas)>=1) { - $xml .= "\n\n"; - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $xml .= $xs->serializeSchema(); - } - } - $xml .= ''; - } - // messages - if (count($this->messages) >= 1) { - foreach($this->messages as $msgName => $msgParts) { - $xml .= "\n'; - if(is_array($msgParts)){ - foreach($msgParts as $partName => $partType) { - // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'
    '; - if (strpos($partType, ':')) { - $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); - } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { - // print 'checking typemap: '.$this->XMLSchemaVersion.'
    '; - $typePrefix = 'xsd'; - } else { - foreach($this->typemap as $ns => $types) { - if (isset($types[$partType])) { - $typePrefix = $this->getPrefixFromNamespace($ns); - } - } - if (!isset($typePrefix)) { - die("$partType has no namespace!"); - } - } - $ns = $this->getNamespaceFromPrefix($typePrefix); - $localPart = $this->getLocalPart($partType); - $typeDef = $this->getTypeDef($localPart, $ns); - if ($typeDef['typeClass'] == 'element') { - $elementortype = 'element'; - if (substr($localPart, -1) == '^') { - $localPart = substr($localPart, 0, -1); - } - } else { - $elementortype = 'type'; - } - $xml .= "\n" . ' '; - } - } - $xml .= '
    '; - } - } - // bindings & porttypes - if (count($this->bindings) >= 1) { - $binding_xml = ''; - $portType_xml = ''; - foreach($this->bindings as $bindingName => $attrs) { - $binding_xml .= "\n'; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n'; - foreach($attrs['operations'] as $opName => $opParts) { - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' ' . htmlspecialchars($opParts['documentation']) . ''; - } - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - } - $portType_xml .= "\n" . ''; - $binding_xml .= "\n" . ''; - } - $xml .= $portType_xml . $binding_xml; - } - // services - $xml .= "\nserviceName . '">'; - if (count($this->ports) >= 1) { - foreach($this->ports as $pName => $attrs) { - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - } - } - $xml .= "\n" . ''; - return $xml . "\n"; - } - - /** - * determine whether a set of parameters are unwrapped - * when they are expect to be wrapped, Microsoft-style. - * - * @param string $type the type (element name) of the wrapper - * @param array $parameters the parameter values for the SOAP call - * @return boolean whether they parameters are unwrapped (and should be wrapped) - * @access private - */ - function parametersMatchWrapped($type, &$parameters) { - $this->debug("in parametersMatchWrapped type=$type, parameters="); - $this->appendDebug($this->varDump($parameters)); - - // split type into namespace:unqualified-type - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns"); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in parametersMatchWrapped: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - - // get the type information - if (!$typeDef = $this->getTypeDef($uqType, $ns)) { - $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type."); - return false; - } - $this->debug("in parametersMatchWrapped: found typeDef="); - $this->appendDebug($this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - $phpType = $typeDef['phpType']; - $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''); - $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType"); - - // we expect a complexType or element of complexType - if ($phpType != 'struct') { - $this->debug("in parametersMatchWrapped: not a struct"); - return false; - } - - // see whether the parameter names match the elements - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $elements = 0; - $matches = 0; - foreach ($typeDef['elements'] as $name => $attrs) { - if (isset($parameters[$name])) { - $this->debug("in parametersMatchWrapped: have parameter named $name"); - $matches++; - } else { - $this->debug("in parametersMatchWrapped: do not have parameter named $name"); - } - $elements++; - } - - $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names"); - if ($matches == 0) { - return false; - } - return true; - } - - // since there are no elements for the type, if the user passed no - // parameters, the parameters match wrapped. - $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType"); - return count($parameters) == 0; - } - - /** - * serialize PHP values according to a WSDL message definition - * contrary to the method name, this is not limited to RPC - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @param string $bindingType (soap|soap12) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - */ - function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { - $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation, $bindingType)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - return false; - } - $this->debug('in serializeRPCParameters: opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - $parts = &$opData[$direction]['parts']; - $part_count = sizeof($parts); - $style = $opData['style']; - $use = $opData[$direction]['use']; - $this->debug("have $part_count part(s) to serialize using $style/$use"); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $parameter_count = count($parameters); - $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize"); - // check for Microsoft-style wrapped parameters - if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) { - $this->debug('check whether the caller has wrapped the parameters'); - if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) { - // TODO: consider checking here for double-wrapping, when - // service function wraps, then NuSOAP wraps again - $this->debug("change simple array to associative with 'parameters' element"); - $parameters['parameters'] = $parameters[0]; - unset($parameters[0]); - } - if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) { - $this->debug('check whether caller\'s parameters match the wrapped ones'); - if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) { - $this->debug('wrap the parameters for the caller'); - $parameters = array('parameters' => $parameters); - $parameter_count = 1; - } - } - } - foreach ($parts as $name => $type) { - $this->debug("serializing part $name of type $type"); - // Track encoding style - if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeRPCParameters returning: $xml"); - return $xml; - } - - /** - * serialize a PHP value according to a WSDL message definition - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - * @deprecated - */ - function serializeParameters($operation, $direction, $parameters) - { - $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); - return false; - } - $this->debug('opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - - $use = $opData[$direction]['use']; - $this->debug("use=$use"); - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $this->debug('have ' . $parametersArrayType . ' parameters'); - foreach($opData[$direction]['parts'] as $name => $type) { - $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); - // Track encoding style - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeParameters returning: $xml"); - return $xml; - } - - /** - * serializes a PHP value according a given type definition - * - * @param string $name name of value (part or element) - * @param string $type XML schema type of value (type or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @param boolean $unqualified a kludge for what should be XML namespace form handling - * @return string value serialized as an XML string - * @access private - */ - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) - { - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); - $this->appendDebug("value=" . $this->varDump($value)); - if($use == 'encoded' && $encodingStyle) { - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; - } - - // if a soapval has been supplied, let its type override the WSDL - if (is_object($value) && get_class($value) == 'soapval') { - if ($value->type_ns) { - $type = $value->type_ns . ':' . $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } elseif ($value->type) { - $type = $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } else { - $forceType = false; - $this->debug("in serializeType: soapval does not override type"); - } - $attrs = $value->attributes; - $value = $value->value; - $this->debug("in serializeType: soapval overrides value to $value"); - if ($attrs) { - if (!is_array($value)) { - $value['!'] = $value; - } - foreach ($attrs as $n => $v) { - $value['!' . $n] = $v; - } - $this->debug("in serializeType: soapval provides attributes"); - } - } else { - $forceType = false; - } - - $xml = ''; - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in serializeType: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); - } - - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ - $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); - if ($unqualified && $use == 'literal') { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - // TODO: depends on nillable, which should be checked before calling this method - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if ($uqType == 'Array') { - // JBoss/Axis does this sometimes - return $this->serialize_val($value, $name, false, false, false, false, $use); - } - if ($uqType == 'boolean') { - if ((is_string($value) && $value == 'false') || (! $value)) { - $value = 'false'; - } else { - $value = 'true'; - } - } - if ($uqType == 'string' && gettype($value) == 'string') { - $value = $this->expandEntities($value); - } - if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') { - $value = sprintf("%.0lf", $value); - } - // it's a scalar - // TODO: what about null/nil values? - // check type isn't a custom type extending xmlschema namespace - if (!$this->getTypeDef($uqType, $ns)) { - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)'); - } else if ($ns == 'http://xml.apache.org/xml-soap') { - $this->debug('in serializeType: appears to be Apache SOAP type'); - if ($uqType == 'Map') { - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - if (! $tt_prefix) { - $this->debug('in serializeType: Add namespace for Apache SOAP type'); - $tt_prefix = 'ns' . rand(1000, 9999); - $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; - // force this to be added to usedNamespaces - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - } - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing map element: key $k, value $v"); - $contents .= ''; - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); - $contents .= ''; - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents"; - } else { - $xml = "<$name>$contents"; - } - } else { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('in serializeType: Apache SOAP type, but only support Map'); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in serializeType: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ - $this->setError("$type ($uqType) is not a supported type."); - $this->debug("in serializeType: $type ($uqType) is not a supported type."); - return false; - } else { - $this->debug("in serializeType: found typeDef"); - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - } - if (!isset($typeDef['phpType'])) { - $this->setError("$type ($uqType) has no phpType."); - $this->debug("in serializeType: $type ($uqType) has no phpType."); - return false; - } - $phpType = $typeDef['phpType']; - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); - // if php type == struct, map value to the element names - if ($phpType == 'struct') { - if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { - $elementName = $uqType; - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - $elementNS = " xmlns=\"\""; - } - } else { - $elementName = $name; - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs and nillable - $xml = "<$elementName$elementNS/>"; - } else { - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (is_object($value)) { - $value = get_object_vars($value); - } - if (is_array($value)) { - $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); - if ($use == 'literal') { - if ($forceType) { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; - } else { - $xml = "<$elementName$elementNS$elementAttrs>"; - } - } else { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; - } - - if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { - if (isset($value['!'])) { - $xml .= $value['!']; - $this->debug("in serializeType: serialized simpleContent for type $type"); - } else { - $this->debug("in serializeType: no simpleContent to serialize for type $type"); - } - } else { - // complexContent - $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle); - } - $xml .= ""; - } else { - $this->debug("in serializeType: phpType is struct, but value is not an array"); - $this->setError("phpType is struct, but value is not an array: see debug output for details"); - $xml = ''; - } - } elseif ($phpType == 'array') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ":Array\" " . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ':arrayType="' . - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . - ':' . - $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (isset($typeDef['multidimensional'])) { - $nv = array(); - foreach($value as $v) { - $cols = ',' . sizeof($v); - $nv = array_merge($nv, $v); - } - $value = $nv; - } else { - $cols = ''; - } - if (is_array($value) && sizeof($value) >= 1) { - $rows = sizeof($value); - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); - //if (strpos($typeDef['arrayType'], ':') ) { - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { - $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); - } else { - $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); - } - } - } else { - $rows = 0; - $contents = null; - } - // TODO: for now, an empty value will be serialized as a zero element - // array. Revisit this when coding the handling of null/nil values. - if ($use == 'literal') { - $xml = "<$name$elementNS>" - .$contents - .""; - } else { - $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') - .':arrayType="' - .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) - .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" - .$contents - .""; - } - } elseif ($phpType == 'scalar') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - - /** - * serializes the attributes for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) { - $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize attributes for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) { - $this->debug("serialize attributes for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - foreach ($typeDef['attrs'] as $aName => $attrs) { - if (isset($xvalue['!' . $aName])) { - $xname = '!' . $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($xvalue[$aName])) { - $xname = $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($attrs['default'])) { - $xname = '!' . $aName; - $xvalue[$xname] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); - } else { - $xname = ''; - $this->debug("no value provided for attribute $aName"); - } - if ($xname) { - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; - } - } - } else { - $this->debug("no attributes to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * serializes the elements for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { - $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize elements for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - // toggle whether all elements are present - ideally should validate against schema - if (count($typeDef['elements']) != count($xvalue)){ - $optionals = true; - } - foreach ($typeDef['elements'] as $eName => $attrs) { - if (!isset($xvalue[$eName])) { - if (isset($attrs['default'])) { - $xvalue[$eName] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); - } - } - // if user took advantage of a minOccurs=0, then only serialize named parameters - if (isset($optionals) - && (!isset($xvalue[$eName])) - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') - ){ - if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); - } - // do nothing - $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); - } else { - // get value - if (isset($xvalue[$eName])) { - $v = $xvalue[$eName]; - } else { - $v = null; - } - if (isset($attrs['form'])) { - $unqualified = ($attrs['form'] == 'unqualified'); - } else { - $unqualified = false; - } - if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') { - $vv = $v; - foreach ($vv as $k => $v) { - if (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } else { - if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { - // do nothing - } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { - // TODO: serialize a nil correctly, but for now serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } elseif (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } - } - } else { - $this->debug("no elements to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * adds an XML Schema complex type to the WSDL types - * - * @param string $name - * @param string $typeClass (complexType|simpleType|attribute) - * @param string $phpType currently supported are array and struct (php assoc array) - * @param string $compositor (all|sequence|choice) - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) - * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) - * @param string $arrayType as namespace:name (xsd:string) - * @see nusoap_xmlschema - * @access public - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { - if (count($elements) > 0) { - $eElements = array(); - foreach($elements as $n => $e){ - // expand each element - $ee = array(); - foreach ($e as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $ee[$k] = $v; - } - $eElements[$n] = $ee; - } - $elements = $eElements; - } - - if (count($attrs) > 0) { - foreach($attrs as $n => $a){ - // expand each attribute - foreach ($a as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $aa[$k] = $v; - } - $eAttrs[$n] = $aa; - } - $attrs = $eAttrs; - } - - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); - } - - /** - * adds an XML Schema simple type to the WSDL types - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @see nusoap_xmlschema - * @access public - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); - } - - /** - * adds an element to the WSDL types - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addElement($attrs); - } - - /** - * register an operation with the server - * - * @param string $name operation (method) name - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param string $namespace optional The namespace for the operation - * @param string $soapaction optional The soapaction for the operation - * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) - * @param string $documentation optional The description to include in the WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - if ($style == 'document') { - $elements = array(); - foreach ($in as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); - $in = array('parameters' => 'tns:' . $name . '^'); - - $elements = array(); - foreach ($out as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); - } - - // get binding - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = - array( - 'name' => $name, - 'binding' => $this->serviceName . 'Binding', - 'endpoint' => $this->endpoint, - 'soapAction' => $soapaction, - 'style' => $style, - 'input' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Request', - 'parts' => $in), - 'output' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Response', - 'parts' => $out), - 'namespace' => $namespace, - 'transport' => 'http://schemas.xmlsoap.org/soap/http', - 'documentation' => $documentation); - // add portTypes - // add messages - if($in) - { - foreach($in as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Request'][$pName] = $pType; - } - } else { - $this->messages[$name.'Request']= '0'; - } - if($out) - { - foreach($out as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Response'][$pName] = $pType; - } - } else { - $this->messages[$name.'Response']= '0'; - } - return true; - } -} -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_parser extends nusoap_base { - - var $xml = ''; - var $xml_encoding = ''; - var $method = ''; - var $root_struct = ''; - var $root_struct_name = ''; - var $root_struct_namespace = ''; - var $root_header = ''; - var $document = ''; // incoming SOAP body (text) - // determines where in the message we are (envelope,header,body,method) - var $status = ''; - var $position = 0; - var $depth = 0; - var $default_namespace = ''; - var $namespaces = array(); - var $message = array(); - var $parent = ''; - var $fault = false; - var $fault_code = ''; - var $fault_str = ''; - var $fault_detail = ''; - var $depth_array = array(); - var $debug_flag = true; - var $soapresponse = NULL; // parsed SOAP Body - var $soapheader = NULL; // parsed SOAP Header - var $responseHeaders = ''; // incoming SOAP headers (text) - var $body_position = 0; - // for multiref parsing: - // array of id => pos - var $ids = array(); - // array of id => hrefs => pos - var $multirefs = array(); - // toggle for auto-decoding element content - var $decode_utf8 = true; - - /** - * constructor that actually does the parsing - * - * @param string $xml SOAP message - * @param string $encoding character encoding scheme of message - * @param string $method method for which XML is parsed (unused?) - * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1 - * @access public - */ - function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ - parent::nusoap_base(); - $this->xml = $xml; - $this->xml_encoding = $encoding; - $this->method = $method; - $this->decode_utf8 = $decode_utf8; - - // Check whether content has been read. - if(!empty($xml)){ - // Check XML encoding - $pos_xml = strpos($xml, '', $pos_xml + 2) - $pos_xml + 1); - if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) { - $xml_encoding = $res[1]; - if (strtoupper($xml_encoding) != $encoding) { - $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'"; - $this->debug($err); - if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { - $this->setError($err); - return; - } - // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed - } else { - $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration'); - } - } else { - $this->debug('No encoding specified in XML declaration'); - } - } else { - $this->debug('No XML declaration'); - } - $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding); - // Create an XML parser - why not xml_parser_create_ns? - $this->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($this->parser, XML_OPTION_CASE_FOLDING, 0); - xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element','end_element'); - xml_set_character_data_handler($this->parser,'character_data'); - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $err = sprintf('XML error parsing SOAP payload on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser))); - $this->debug($err); - $this->debug("XML payload:\n" . $xml); - $this->setError($err); - } else { - $this->debug('in nusoap_parser ctor, message:'); - $this->appendDebug($this->varDump($this->message)); - $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name); - // get final value - $this->soapresponse = $this->message[$this->root_struct]['result']; - // get header value - if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){ - $this->soapheader = $this->message[$this->root_header]['result']; - } - // resolve hrefs/ids - if(sizeof($this->multirefs) > 0){ - foreach($this->multirefs as $id => $hrefs){ - $this->debug('resolving multirefs for id: '.$id); - $idVal = $this->buildVal($this->ids[$id]); - if (is_array($idVal) && isset($idVal['!id'])) { - unset($idVal['!id']); - } - foreach($hrefs as $refPos => $ref){ - $this->debug('resolving href at pos '.$refPos); - $this->multirefs[$id][$refPos] = $idVal; - } - } - } - } - xml_parser_free($this->parser); - } else { - $this->debug('xml was empty, didn\'t parse!'); - $this->setError('xml was empty, didn\'t parse!'); - } - } - - /** - * start-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @param array $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) { - // position in a total number of elements, starting from 0 - // update class level pos - $pos = $this->position++; - // and set mine - $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>''); - // depth = how many levels removed from root? - // set mine as current global depth and increment global depth value - $this->message[$pos]['depth'] = $this->depth++; - - // else add self as child to whoever the current parent is - if($pos != 0){ - $this->message[$this->parent]['children'] .= '|'.$pos; - } - // set my parent - $this->message[$pos]['parent'] = $this->parent; - // set self as current parent - $this->parent = $pos; - // set self as current value for this depth - $this->depth_array[$this->depth] = $pos; - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - // set status - if ($name == 'Envelope' && $this->status == '') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'envelope') { - $this->root_header = $pos; - $this->status = 'header'; - } elseif ($name == 'Body' && $this->status == 'envelope'){ - $this->status = 'body'; - $this->body_position = $pos; - // set method - } elseif($this->status == 'body' && $pos == ($this->body_position+1)) { - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->message[$pos]['type'] = 'struct'; - $this->debug("found root struct $this->root_struct_name, pos $this->root_struct"); - } - // set my status - $this->message[$pos]['status'] = $this->status; - // set name - $this->message[$pos]['name'] = htmlspecialchars($name); - // set attrs - $this->message[$pos]['attrs'] = $attrs; - - // loop through atts, logging ns and type declarations - $attstr = ''; - foreach($attrs as $key => $value){ - $key_prefix = $this->getPrefix($key); - $key_localpart = $this->getLocalPart($key); - // if ns declarations, add to class level array of valid namespaces - if($key_prefix == 'xmlns'){ - if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){ - $this->XMLSchemaVersion = $value; - $this->namespaces['xsd'] = $this->XMLSchemaVersion; - $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance'; - } - $this->namespaces[$key_localpart] = $value; - // set method namespace - if($name == $this->root_struct_name){ - $this->methodNamespace = $value; - } - // if it's a type declaration, set type - } elseif($key_localpart == 'type'){ - if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') { - // do nothing: already processed arrayType - } else { - $value_prefix = $this->getPrefix($value); - $value_localpart = $this->getLocalPart($value); - $this->message[$pos]['type'] = $value_localpart; - $this->message[$pos]['typePrefix'] = $value_prefix; - if(isset($this->namespaces[$value_prefix])){ - $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; - } else if(isset($attrs['xmlns:'.$value_prefix])) { - $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix]; - } - // should do something here with the namespace of specified type? - } - } elseif($key_localpart == 'arrayType'){ - $this->message[$pos]['type'] = 'array'; - /* do arrayType ereg here - [1] arrayTypeValue ::= atype asize - [2] atype ::= QName rank* - [3] rank ::= '[' (',')* ']' - [4] asize ::= '[' length~ ']' - [5] length ::= nextDimension* Digit+ - [6] nextDimension ::= Digit+ ',' - */ - $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/'; - if(preg_match($expr,$value,$regs)){ - $this->message[$pos]['typePrefix'] = $regs[1]; - $this->message[$pos]['arrayTypePrefix'] = $regs[1]; - if (isset($this->namespaces[$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]]; - } else if (isset($attrs['xmlns:'.$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]]; - } - $this->message[$pos]['arrayType'] = $regs[2]; - $this->message[$pos]['arraySize'] = $regs[3]; - $this->message[$pos]['arrayCols'] = $regs[4]; - } - // specifies nil value (or not) - } elseif ($key_localpart == 'nil'){ - $this->message[$pos]['nil'] = ($value == 'true' || $value == '1'); - // some other attribute - } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') { - $this->message[$pos]['xattrs']['!' . $key] = $value; - } - - if ($key == 'xmlns') { - $this->default_namespace = $value; - } - // log id - if($key == 'id'){ - $this->ids[$value] = $pos; - } - // root - if($key_localpart == 'root' && $value == 1){ - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->debug("found root struct $this->root_struct_name, pos $pos"); - } - // for doclit - $attstr .= " $key=\"$value\""; - } - // get namespace - must be done after namespace atts are processed - if(isset($prefix)){ - $this->message[$pos]['namespace'] = $this->namespaces[$prefix]; - $this->default_namespace = $this->namespaces[$prefix]; - } else { - $this->message[$pos]['namespace'] = $this->default_namespace; - } - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } elseif($this->root_struct_name != ''){ - $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } - - /** - * end-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name) { - // position of current element is equal to the last value left in depth_array for my depth - $pos = $this->depth_array[$this->depth--]; - - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - - // build to native type - if(isset($this->body_position) && $pos > $this->body_position){ - // deal w/ multirefs - if(isset($this->message[$pos]['attrs']['href'])){ - // get id - $id = substr($this->message[$pos]['attrs']['href'],1); - // add placeholder to href array - $this->multirefs[$id][$pos] = 'placeholder'; - // add set a reference to it as the result value - $this->message[$pos]['result'] =& $this->multirefs[$id][$pos]; - // build complexType values - } elseif($this->message[$pos]['children'] != ''){ - // if result has already been generated (struct/array) - if(!isset($this->message[$pos]['result'])){ - $this->message[$pos]['result'] = $this->buildVal($pos); - } - // build complexType values of attributes and possibly simpleContent - } elseif (isset($this->message[$pos]['xattrs'])) { - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - if (isset($this->message[$pos]['type'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata']; - } - } - } - $this->message[$pos]['result'] = $this->message[$pos]['xattrs']; - // set value of simpleType (or nil complexType) - } else { - //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']); - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['type'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['result'] = $this->message[$pos]['cdata']; - } - } - - /* add value to parent's result, if parent is struct/array - $parent = $this->message[$pos]['parent']; - if($this->message[$parent]['type'] != 'map'){ - if(strtolower($this->message[$parent]['type']) == 'array'){ - $this->message[$parent]['result'][] = $this->message[$pos]['result']; - } else { - $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result']; - } - } - */ - } - } - - // for doclit - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= ""; - } - } elseif($pos >= $this->root_struct){ - $this->document .= ""; - } - // switch status - if ($pos == $this->root_struct){ - $this->status = 'body'; - $this->root_struct_namespace = $this->message[$pos]['namespace']; - } elseif ($pos == $this->root_header) { - $this->status = 'envelope'; - } elseif ($name == 'Body' && $this->status == 'body') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'header') { // will never happen - $this->status = 'envelope'; - } elseif ($name == 'Envelope' && $this->status == 'envelope') { - $this->status = ''; - } - // set parent back to my parent - $this->parent = $this->message[$pos]['parent']; - } - - /** - * element content handler - * - * @param resource $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data){ - $pos = $this->depth_array[$this->depth]; - if ($this->xml_encoding=='UTF-8'){ - // TODO: add an option to disable this for folks who want - // raw UTF-8 that, e.g., might not map to iso-8859-1 - // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); - if($this->decode_utf8){ - $data = utf8_decode($data); - } - } - $this->message[$pos]['cdata'] .= $data; - // for doclit - if($this->status == 'header'){ - $this->responseHeaders .= $data; - } else { - $this->document .= $data; - } - } - - /** - * get the parsed message (SOAP Body) - * - * @return mixed - * @access public - * @deprecated use get_soapbody instead - */ - function get_response(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Body (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapbody(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Header (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapheader(){ - return $this->soapheader; - } - - /** - * get the unparsed SOAP Header - * - * @return string XML or empty if no Header - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * decodes simple types into PHP variables - * - * @param string $value value to decode - * @param string $type XML type to decode - * @param string $typens XML type namespace to decode - * @return mixed PHP value - * @access private - */ - function decodeSimple($value, $type, $typens) { - // TODO: use the namespace! - if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') { - return (string) $value; - } - if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') { - return (int) $value; - } - if ($type == 'float' || $type == 'double' || $type == 'decimal') { - return (double) $value; - } - if ($type == 'boolean') { - if (strtolower($value) == 'false' || strtolower($value) == 'f') { - return false; - } - return (boolean) $value; - } - if ($type == 'base64' || $type == 'base64Binary') { - $this->debug('Decode base64 value'); - return base64_decode($value); - } - // obscure numeric types - if ($type == 'nonPositiveInteger' || $type == 'negativeInteger' - || $type == 'nonNegativeInteger' || $type == 'positiveInteger' - || $type == 'unsignedInt' - || $type == 'unsignedShort' || $type == 'unsignedByte') { - return (int) $value; - } - // bogus: parser treats array with no elements as a simple type - if ($type == 'array') { - return array(); - } - // everything else - return (string) $value; - } - - /** - * builds response structures for compound values (arrays/structs) - * and scalars - * - * @param integer $pos position in node tree - * @return mixed PHP value - * @access private - */ - function buildVal($pos){ - if(!isset($this->message[$pos]['type'])){ - $this->message[$pos]['type'] = ''; - } - $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']); - // if there are children... - if($this->message[$pos]['children'] != ''){ - $this->debug('in buildVal, there are children'); - $children = explode('|',$this->message[$pos]['children']); - array_shift($children); // knock off empty - // md array - if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){ - $r=0; // rowcount - $c=0; // colcount - foreach($children as $child_pos){ - $this->debug("in buildVal, got an MD array element: $r, $c"); - $params[$r][] = $this->message[$child_pos]['result']; - $c++; - if($c == $this->message[$pos]['arrayCols']){ - $c = 0; - $r++; - } - } - // array - } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){ - $this->debug('in buildVal, adding array '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $params[] = &$this->message[$child_pos]['result']; - } - // apache Map type: java hashtable - } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){ - $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $kv = explode("|",$this->message[$child_pos]['children']); - $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result']; - } - // generic compound type - //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') { - } else { - // Apache Vector type: treat as an array - $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']); - if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') { - $notstruct = 1; - } else { - $notstruct = 0; - } - // - foreach($children as $child_pos){ - if($notstruct){ - $params[] = &$this->message[$child_pos]['result']; - } else { - if (isset($params[$this->message[$child_pos]['name']])) { - // de-serialize repeated element name into an array - if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) { - $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]); - } - $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result']; - } else { - $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result']; - } - } - } - } - if (isset($this->message[$pos]['xattrs'])) { - $this->debug('in buildVal, handling attributes'); - foreach ($this->message[$pos]['xattrs'] as $n => $v) { - $params[$n] = $v; - } - } - // handle simpleContent - if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - $this->debug('in buildVal, handling simpleContent'); - if (isset($this->message[$pos]['type'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $params['!'] = $this->message[$pos]['cdata']; - } - } - } - $ret = is_array($params) ? $params : array(); - $this->debug('in buildVal, return:'); - $this->appendDebug($this->varDump($ret)); - return $ret; - } else { - $this->debug('in buildVal, no children, building scalar'); - $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : ''; - if (isset($this->message[$pos]['type'])) { - $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $ret = $this->message[$pos]['cdata']; - $this->debug("in buildVal, return: $ret"); - return $ret; - } - } -} - -/** - * Backward compatibility - */ -class soap_parser extends nusoap_parser { -} - -?>call( string methodname [ ,array parameters] ); -* -* // bye bye client -* unset($soapclient); -* -* @author Dietrich Ayala -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_client extends nusoap_base { - - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - var $requestHeaders = false; // SOAP headers in request (text) - var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) - var $responseHeader = NULL; // SOAP Header from response (parsed) - var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) - var $endpoint; - var $forceEndpoint = ''; // overrides WSDL endpoint - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $portName = ''; // port name to use in WSDL - var $xml_encoding = ''; // character set encoding of incoming (response) messages - var $http_encoding = false; - var $timeout = 0; // HTTP connection timeout - var $response_timeout = 30; // HTTP response timeout - var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error - var $persistentConnection = false; - var $defaultRpcParams = false; // This is no longer used - var $request = ''; // HTTP request - var $response = ''; // HTTP response - var $responseData = ''; // SOAP payload of response - var $cookies = array(); // Cookies from response or for request - var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() - var $operations = array(); // WSDL operations, empty for WSDL initialization error - var $curl_options = array(); // User-specified cURL options - var $bindingType = ''; // WSDL operation binding type - var $use_curl = false; // whether to always try to use cURL - - /* - * fault related variables - */ - /** - * @var fault - * @access public - */ - var $fault; - /** - * @var faultcode - * @access public - */ - var $faultcode; - /** - * @var faultstring - * @access public - */ - var $faultstring; - /** - * @var faultdetail - * @access public - */ - var $faultdetail; - - /** - * constructor - * - * @param mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object) - * @param mixed $wsdl optional, set to 'wsdl' or true if using WSDL - * @param string $proxyhost optional - * @param string $proxyport optional - * @param string $proxyusername optional - * @param string $proxypassword optional - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param string $portName optional portName in WSDL document - * @access public - */ - function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){ - parent::nusoap_base(); - $this->endpoint = $endpoint; - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - $this->portName = $portName; - - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->appendDebug('endpoint=' . $this->varDump($endpoint)); - - // make values - if($wsdl){ - if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) { - $this->wsdl = $endpoint; - $this->endpoint = $this->wsdl->wsdl; - $this->wsdlFile = $this->endpoint; - $this->debug('existing wsdl instance created from ' . $this->endpoint); - $this->checkWSDL(); - } else { - $this->wsdlFile = $this->endpoint; - $this->wsdl = null; - $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint); - } - $this->endpointType = 'wsdl'; - } else { - $this->debug("instantiate SOAP with endpoint at $endpoint"); - $this->endpointType = 'soap'; - } - } - - /** - * calls method, returns PHP native type - * - * @param string $operation SOAP server URL or path - * @param mixed $params An array, associative or simple, of the parameters - * for the method call, or a string that is the XML - * for the call. For rpc style, this call will - * wrap the XML in a tag named after the method, as - * well as the SOAP Envelope and Body. For document - * style, this will only wrap with the Envelope and Body. - * IMPORTANT: when using an array with document style, - * in which case there - * is really one parameter, the root of the fragment - * used in the call, which encloses what programmers - * normally think of parameters. A parameter array - * *must* include the wrapper. - * @param string $namespace optional method namespace (WSDL can override) - * @param string $soapAction optional SOAPAction value (WSDL can override) - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param boolean $rpcParams optional (no longer used) - * @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override) - * @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override) - * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors - * @access public - */ - function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){ - $this->operation = $operation; - $this->fault = false; - $this->setError(''); - $this->request = ''; - $this->response = ''; - $this->responseData = ''; - $this->faultstring = ''; - $this->faultcode = ''; - $this->opData = array(); - - $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); - $this->appendDebug('params=' . $this->varDump($params)); - $this->appendDebug('headers=' . $this->varDump($headers)); - if ($headers) { - $this->requestHeaders = $headers; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - // serialize parameters - if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){ - // use WSDL for operation - $this->opData = $opData; - $this->debug("found operation"); - $this->appendDebug('opData=' . $this->varDump($opData)); - if (isset($opData['soapAction'])) { - $soapAction = $opData['soapAction']; - } - if (! $this->forceEndpoint) { - $this->endpoint = $opData['endpoint']; - } else { - $this->endpoint = $this->forceEndpoint; - } - $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; - $style = $opData['style']; - $use = $opData['input']['use']; - // add ns to ns array - if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){ - $nsPrefix = 'ns' . rand(1000, 9999); - $this->wsdl->namespaces[$nsPrefix] = $namespace; - } - $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace); - // serialize payload - if (is_string($params)) { - $this->debug("serializing param string for WSDL operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for WSDL operation $operation"); - $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType); - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = $this->wsdl->usedNamespaces; - if (isset($opData['input']['encodingStyle'])) { - $encodingStyle = $opData['input']['encodingStyle']; - } else { - $encodingStyle = ''; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if ($errstr = $this->wsdl->getError()) { - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - return false; - } - } elseif($this->endpointType == 'wsdl') { - // operation not in WSDL - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->setError('operation '.$operation.' not present in WSDL.'); - $this->debug("operation '$operation' not present in WSDL."); - return false; - } else { - // no WSDL - //$this->namespaces['ns1'] = $namespace; - $nsPrefix = 'ns' . rand(1000, 9999); - // serialize - $payload = ''; - if (is_string($params)) { - $this->debug("serializing param string for operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for operation $operation"); - foreach($params as $k => $v){ - $payload .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = array(); - if ($use == 'encoded') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } else { - $encodingStyle = ''; - } - } - // wrap RPC calls with method element - if ($style == 'rpc') { - if ($use == 'literal') { - $this->debug("wrapping RPC request with literal method element"); - if ($namespace) { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . $payload . ""; - } - } else { - $this->debug("wrapping RPC request with encoded method element"); - if ($namespace) { - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . - $payload . - ""; - } - } - } - // serialize envelope - $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle); - $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle"); - $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000)); - // send - $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout); - if($errstr = $this->getError()){ - $this->debug('Error: '.$errstr); - return false; - } else { - $this->return = $return; - $this->debug('sent message successfully and got a(n) '.gettype($return)); - $this->appendDebug('return=' . $this->varDump($return)); - - // fault? - if(is_array($return) && isset($return['faultcode'])){ - $this->debug('got fault'); - $this->setError($return['faultcode'].': '.$return['faultstring']); - $this->fault = true; - foreach($return as $k => $v){ - $this->$k = $v; - $this->debug("$k = $v
    "); - } - return $return; - } elseif ($style == 'document') { - // NOTE: if the response is defined to have multiple parts (i.e. unwrapped), - // we are only going to return the first part here...sorry about that - return $return; - } else { - // array of return values - if(is_array($return)){ - // multiple 'out' parameters, which we return wrapped up - // in the array - if(sizeof($return) > 1){ - return $return; - } - // single 'out' parameter (normally the return value) - $return = array_shift($return); - $this->debug('return shifted value: '); - $this->appendDebug($this->varDump($return)); - return $return; - // nothing returned (ie, echoVoid) - } else { - return ""; - } - } - } - } - - /** - * check WSDL passed as an instance or pulled from an endpoint - * - * @access private - */ - function checkWSDL() { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('checkWSDL'); - // catch errors - if ($errstr = $this->wsdl->getError()) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap12'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************'); - } else { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('getOperations returned false'); - $this->setError('no operations defined in the WSDL document!'); - } - } - - /** - * instantiate wsdl object and parse wsdl file - * - * @access public - */ - function loadWSDL() { - $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile); - $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl); - $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest); - $this->wsdl->fetchWSDL($this->wsdlFile); - $this->checkWSDL(); - } - - /** - * get available data pertaining to an operation - * - * @param string $operation operation name - * @return array array of data pertaining to the operation - * @access public - */ - function getOperationData($operation){ - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - if(isset($this->operations[$operation])){ - return $this->operations[$operation]; - } - $this->debug("No data for operation: $operation"); - } - - /** - * send the SOAP message - * - * Note: if the operation has multiple return values - * the return value of this method will be an array - * of those values. - * - * @param string $msg a SOAPx4 soapmsg object - * @param string $soapaction SOAPAction value - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return mixed native PHP types. - * @access private - */ - function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) { - $this->checkCookies(); - // detect transport - switch(true){ - // http(s) - case preg_match('/^http/',$this->endpoint): - $this->debug('transporting via HTTP'); - if($this->persistentConnection == true && is_object($this->persistentConnection)){ - $http =& $this->persistentConnection; - } else { - $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl); - if ($this->persistentConnection) { - $http->usePersistentConnection(); - } - } - $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset()); - $http->setSOAPAction($soapaction); - if($this->proxyhost && $this->proxyport){ - $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if($this->authtype != '') { - $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - if($this->http_encoding != ''){ - $http->setEncoding($this->http_encoding); - } - $this->debug('sending message, length='.strlen($msg)); - if(preg_match('/^http:/',$this->endpoint)){ - //if(strpos($this->endpoint,'http:')){ - $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies); - } elseif(preg_match('/^https/',$this->endpoint)){ - //} elseif(strpos($this->endpoint,'https:')){ - //if(phpversion() == '4.3.0-dev'){ - //$response = $http->send($msg,$timeout,$response_timeout); - //$this->request = $http->outgoing_payload; - //$this->response = $http->incoming_payload; - //} else - $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies); - } else { - $this->setError('no http/s in endpoint url'); - } - $this->request = $http->outgoing_payload; - $this->response = $http->incoming_payload; - $this->appendDebug($http->getDebug()); - $this->UpdateCookies($http->incoming_cookies); - - // save transport object if using persistent connections - if ($this->persistentConnection) { - $http->clearDebug(); - if (!is_object($this->persistentConnection)) { - $this->persistentConnection = $http; - } - } - - if($err = $http->getError()){ - $this->setError('HTTP Error: '.$err); - return false; - } elseif($this->getError()){ - return false; - } else { - $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']); - return $this->parseResponse($http->incoming_headers, $this->responseData); - } - break; - default: - $this->setError('no transport found, or selected transport is not yet supported!'); - return false; - break; - } - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Response not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Response not of type text/xml: ' . $headers['content-type']); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8); - // add parser debug data to our debug - $this->appendDebug($parser->getDebug()); - // if parse errors - if($errstr = $parser->getError()){ - $this->setError( $errstr); - // destroy the parser object - unset($parser); - return false; - } else { - // get SOAP headers - $this->responseHeaders = $parser->getHeaders(); - // get SOAP headers - $this->responseHeader = $parser->get_soapheader(); - // get decoded message - $return = $parser->get_soapbody(); - // add document for doclit support - $this->document = $parser->document; - // destroy the parser object - unset($parser); - // return decode message - return $return; - } - } - - /** - * sets user-specified cURL options - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access public - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - $this->curl_options[$option] = $value; - } - - /** - * sets the SOAP endpoint, which can override WSDL - * - * @param string $endpoint The endpoint URL to use, or empty string or false to prevent override - * @access public - */ - function setEndpoint($endpoint) { - $this->debug("setEndpoint(\"$endpoint\")"); - $this->forceEndpoint = $endpoint; - } - - /** - * set the SOAP headers - * - * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers - * @access public - */ - function setHeaders($headers){ - $this->debug("setHeaders headers="); - $this->appendDebug($this->varDump($headers)); - $this->requestHeaders = $headers; - } - - /** - * get the SOAP response headers (namespace resolution incomplete) - * - * @return string - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * get the SOAP response Header (parsed) - * - * @return mixed - * @access public - */ - function getHeader(){ - return $this->responseHeader; - } - - /** - * set proxy info here - * - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @access public - */ - function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') { - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - /** - * use HTTP encoding - * - * @param string $enc HTTP encoding - * @access public - */ - function setHTTPEncoding($enc='gzip, deflate'){ - $this->debug("setHTTPEncoding(\"$enc\")"); - $this->http_encoding = $enc; - } - - /** - * Set whether to try to use cURL connections if possible - * - * @param boolean $use Whether to try to use cURL - * @access public - */ - function setUseCURL($use) { - $this->debug("setUseCURL($use)"); - $this->use_curl = $use; - } - - /** - * use HTTP persistent connections if possible - * - * @access public - */ - function useHTTPPersistentConnection(){ - $this->debug("useHTTPPersistentConnection"); - $this->persistentConnection = true; - } - - /** - * gets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style. - * Each call() can override this value. - * - * This is no longer used. - * - * @return boolean - * @access public - * @deprecated - */ - function getDefaultRpcParams() { - return $this->defaultRpcParams; - } - - /** - * sets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style - * Each call() can override this value. - * - * This is no longer used. - * - * @param boolean $rpcParams - * @access public - * @deprecated - */ - function setDefaultRpcParams($rpcParams) { - $this->defaultRpcParams = $rpcParams; - } - - /** - * dynamically creates an instance of a proxy class, - * allowing user to directly call methods from wsdl - * - * @return object soap_proxy object - * @access public - */ - function getProxy() { - $r = rand(); - $evalStr = $this->_getProxyClassCode($r); - //$this->debug("proxy class: $evalStr"); - if ($this->getError()) { - $this->debug("Error from _getProxyClassCode, so return NULL"); - return null; - } - // eval the class - eval($evalStr); - // instantiate proxy object - eval("\$proxy = new nusoap_proxy_$r('');"); - // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice - $proxy->endpointType = 'wsdl'; - $proxy->wsdlFile = $this->wsdlFile; - $proxy->wsdl = $this->wsdl; - $proxy->operations = $this->operations; - $proxy->defaultRpcParams = $this->defaultRpcParams; - // transfer other state - $proxy->soap_defencoding = $this->soap_defencoding; - $proxy->username = $this->username; - $proxy->password = $this->password; - $proxy->authtype = $this->authtype; - $proxy->certRequest = $this->certRequest; - $proxy->requestHeaders = $this->requestHeaders; - $proxy->endpoint = $this->endpoint; - $proxy->forceEndpoint = $this->forceEndpoint; - $proxy->proxyhost = $this->proxyhost; - $proxy->proxyport = $this->proxyport; - $proxy->proxyusername = $this->proxyusername; - $proxy->proxypassword = $this->proxypassword; - $proxy->http_encoding = $this->http_encoding; - $proxy->timeout = $this->timeout; - $proxy->response_timeout = $this->response_timeout; - $proxy->persistentConnection = &$this->persistentConnection; - $proxy->decode_utf8 = $this->decode_utf8; - $proxy->curl_options = $this->curl_options; - $proxy->bindingType = $this->bindingType; - $proxy->use_curl = $this->use_curl; - return $proxy; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access private - */ - function _getProxyClassCode($r) { - $this->debug("in getProxy endpointType=$this->endpointType"); - $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); - if ($this->endpointType != 'wsdl') { - $evalStr = 'A proxy can only be created for a WSDL client'; - $this->setError($evalStr); - $evalStr = "echo \"$evalStr\";"; - return $evalStr; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) { - return "echo \"" . $this->getError() . "\";"; - } - } - $evalStr = ''; - foreach ($this->operations as $operation => $opData) { - if ($operation != '') { - // create param string and param comment string - if (sizeof($opData['input']['parts']) > 0) { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = ''; - foreach ($opData['input']['parts'] as $name => $type) { - $paramStr .= "\$$name, "; - $paramArrayStr .= "'$name' => \$$name, "; - $paramCommentStr .= "$type \$$name, "; - } - $paramStr = substr($paramStr, 0, strlen($paramStr)-2); - $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2); - $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2); - } else { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = 'void'; - } - $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; - $evalStr .= "// $paramCommentStr - function " . str_replace('.', '__', $operation) . "($paramStr) { - \$params = array($paramArrayStr); - return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."'); - } - "; - unset($paramStr); - unset($paramCommentStr); - } - } - $evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client { - '.$evalStr.' -}'; - return $evalStr; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access public - */ - function getProxyClassCode() { - $r = rand(); - return $this->_getProxyClassCode($r); - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /* - * whether or not parser should decode utf8 element content - * - * @return always returns true - * @access public - */ - function decodeUTF8($bool){ - $this->decode_utf8 = $bool; - return true; - } - - /** - * adds a new Cookie into $this->cookies array - * - * @param string $name Cookie Name - * @param string $value Cookie Value - * @return boolean if cookie-set was successful returns true, else false - * @access public - */ - function setCookie($name, $value) { - if (strlen($name) == 0) { - return false; - } - $this->cookies[] = array('name' => $name, 'value' => $value); - return true; - } - - /** - * gets all Cookies - * - * @return array with all internal cookies - * @access public - */ - function getCookies() { - return $this->cookies; - } - - /** - * checks all Cookies and delete those which are expired - * - * @return boolean always return true - * @access private - */ - function checkCookies() { - if (sizeof($this->cookies) == 0) { - return true; - } - $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies'); - $curr_cookies = $this->cookies; - $this->cookies = array(); - foreach ($curr_cookies as $cookie) { - if (! is_array($cookie)) { - $this->debug('Remove cookie that is not an array'); - continue; - } - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) > time()) { - $this->cookies[] = $cookie; - } else { - $this->debug('Remove expired cookie ' . $cookie['name']); - } - } else { - $this->cookies[] = $cookie; - } - } - $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array'); - return true; - } - - /** - * updates the current cookies with a new set - * - * @param array $cookies new cookies with which to update current ones - * @return boolean always return true - * @access private - */ - function UpdateCookies($cookies) { - if (sizeof($this->cookies) == 0) { - // no existing cookies: take whatever is new - if (sizeof($cookies) > 0) { - $this->debug('Setting new cookie(s)'); - $this->cookies = $cookies; - } - return true; - } - if (sizeof($cookies) == 0) { - // no new cookies: keep what we've got - return true; - } - // merge - foreach ($cookies as $newCookie) { - if (!is_array($newCookie)) { - continue; - } - if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) { - continue; - } - $newName = $newCookie['name']; - - $found = false; - for ($i = 0; $i < count($this->cookies); $i++) { - $cookie = $this->cookies[$i]; - if (!is_array($cookie)) { - continue; - } - if (!isset($cookie['name'])) { - continue; - } - if ($newName != $cookie['name']) { - continue; - } - $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN'; - $domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN'; - if ($newDomain != $domain) { - continue; - } - $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH'; - $path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH'; - if ($newPath != $path) { - continue; - } - $this->cookies[$i] = $newCookie; - $found = true; - $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); - break; - } - if (! $found) { - $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); - $this->cookies[] = $newCookie; - } - } - return true; - } -} - -if (!extension_loaded('soap')) { - /** - * For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded. - */ - class soapclient extends nusoap_client { - } -} -?> diff --git a/lib/nusoap/nusoapmime.php b/lib/nusoap/nusoapmime.php deleted file mode 100644 index 649386306..000000000 --- a/lib/nusoap/nusoapmime.php +++ /dev/null @@ -1,501 +0,0 @@ - -* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list -* @version $Id: nusoapmime.php,v 1.13 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_client_mime extends nusoap_client { - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $requestAttachments = array(); - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $responseAttachments; - /** - * @var string - * @access private - */ - var $mimeContentType; - - /** - * adds a MIME attachment to the current request. - * - * If the $data parameter contains an empty string, this method will read - * the contents of the file named by the $filename parameter. - * - * If the $cid parameter is false, this method will generate the cid. - * - * @param string $data The data of the attachment - * @param string $filename The filename of the attachment (default is empty string) - * @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream) - * @param string $cid The content-id (cid) of the attachment (default is false) - * @return string The content-id (cid) of the attachment - * @access public - */ - function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) { - if (! $cid) { - $cid = md5(uniqid(time())); - } - - $info['data'] = $data; - $info['filename'] = $filename; - $info['contenttype'] = $contenttype; - $info['cid'] = $cid; - - $this->requestAttachments[] = $info; - - return $cid; - } - - /** - * clears the MIME attachments for the current request. - * - * @access public - */ - function clearAttachments() { - $this->requestAttachments = array(); - } - - /** - * gets the MIME attachments from the current response. - * - * Each array element in the return is an associative array with keys - * data, filename, contenttype, cid. These keys correspond to the parameters - * for addAttachment. - * - * @return array The attachments. - * @access public - */ - function getAttachments() { - return $this->responseAttachments; - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - if (count($this->requestAttachments) > 0) { - $params['content_type'] = 'multipart/related; type="text/xml"'; - $mimeMessage = new Mail_mimePart('', $params); - unset($params); - - $params['content_type'] = 'text/xml'; - $params['encoding'] = '8bit'; - $params['charset'] = $this->soap_defencoding; - $mimeMessage->addSubpart($soapmsg, $params); - - foreach ($this->requestAttachments as $att) { - unset($params); - - $params['content_type'] = $att['contenttype']; - $params['encoding'] = 'base64'; - $params['disposition'] = 'attachment'; - $params['dfilename'] = $att['filename']; - $params['cid'] = $att['cid']; - - if ($att['data'] == '' && $att['filename'] <> '') { - if ($fd = fopen($att['filename'], 'rb')) { - $data = fread($fd, filesize($att['filename'])); - fclose($fd); - } else { - $data = ''; - } - $mimeMessage->addSubpart($data, $params); - } else { - $mimeMessage->addSubpart($att['data'], $params); - } - } - - $output = $mimeMessage->encode(); - $mimeHeaders = $output['headers']; - - foreach ($mimeHeaders as $k => $v) { - $this->debug("MIME header $k: $v"); - if (strtolower($k) == 'content-type') { - // PHP header() seems to strip leading whitespace starting - // the second line, so force everything to one line - $this->mimeContentType = str_replace("\r\n", " ", $v); - } - } - - return $output['body']; - } - - return parent::getHTTPBody($soapmsg); - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - if (count($this->requestAttachments) > 0) { - return $this->mimeContentType; - } - return parent::getHTTPContentType(); - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - if (count($this->requestAttachments) > 0) { - return false; - } - return parent::getHTTPContentTypeCharset(); - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); - $this->responseAttachments = array(); - if (strstr($headers['content-type'], 'multipart/related')) { - $this->debug('Decode multipart/related'); - $input = ''; - foreach ($headers as $k => $v) { - $input .= "$k: $v\r\n"; - } - $params['input'] = $input . "\r\n" . $data; - $params['include_bodies'] = true; - $params['decode_bodies'] = true; - $params['decode_headers'] = true; - - $structure = Mail_mimeDecode::decode($params); - - foreach ($structure->parts as $part) { - if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) { - $this->debug('Have root part of type ' . $part->headers['content-type']); - $root = $part->body; - $return = parent::parseResponse($part->headers, $part->body); - } else { - $this->debug('Have an attachment of type ' . $part->headers['content-type']); - $info['data'] = $part->body; - $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; - $info['contenttype'] = $part->headers['content-type']; - $info['cid'] = $part->headers['content-id']; - $this->responseAttachments[] = $info; - } - } - - if (isset($return)) { - $this->responseData = $root; - return $return; - } - - $this->setError('No root part found in multipart/related content'); - return ''; - } - $this->debug('Not multipart/related'); - return parent::parseResponse($headers, $data); - } -} - -/* - * For backwards compatiblity, define soapclientmime unless the PHP SOAP extension is loaded. - */ -if (!extension_loaded('soap')) { - class soapclientmime extends nusoap_client_mime { - } -} - -/** -* nusoap_server_mime server supporting MIME attachments defined at -* http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -* -* @author Scott Nichol -* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list -* @version $Id: nusoapmime.php,v 1.13 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_server_mime extends nusoap_server { - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $requestAttachments = array(); - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $responseAttachments; - /** - * @var string - * @access private - */ - var $mimeContentType; - - /** - * adds a MIME attachment to the current response. - * - * If the $data parameter contains an empty string, this method will read - * the contents of the file named by the $filename parameter. - * - * If the $cid parameter is false, this method will generate the cid. - * - * @param string $data The data of the attachment - * @param string $filename The filename of the attachment (default is empty string) - * @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream) - * @param string $cid The content-id (cid) of the attachment (default is false) - * @return string The content-id (cid) of the attachment - * @access public - */ - function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) { - if (! $cid) { - $cid = md5(uniqid(time())); - } - - $info['data'] = $data; - $info['filename'] = $filename; - $info['contenttype'] = $contenttype; - $info['cid'] = $cid; - - $this->responseAttachments[] = $info; - - return $cid; - } - - /** - * clears the MIME attachments for the current response. - * - * @access public - */ - function clearAttachments() { - $this->responseAttachments = array(); - } - - /** - * gets the MIME attachments from the current request. - * - * Each array element in the return is an associative array with keys - * data, filename, contenttype, cid. These keys correspond to the parameters - * for addAttachment. - * - * @return array The attachments. - * @access public - */ - function getAttachments() { - return $this->requestAttachments; - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - if (count($this->responseAttachments) > 0) { - $params['content_type'] = 'multipart/related; type="text/xml"'; - $mimeMessage = new Mail_mimePart('', $params); - unset($params); - - $params['content_type'] = 'text/xml'; - $params['encoding'] = '8bit'; - $params['charset'] = $this->soap_defencoding; - $mimeMessage->addSubpart($soapmsg, $params); - - foreach ($this->responseAttachments as $att) { - unset($params); - - $params['content_type'] = $att['contenttype']; - $params['encoding'] = 'base64'; - $params['disposition'] = 'attachment'; - $params['dfilename'] = $att['filename']; - $params['cid'] = $att['cid']; - - if ($att['data'] == '' && $att['filename'] <> '') { - if ($fd = fopen($att['filename'], 'rb')) { - $data = fread($fd, filesize($att['filename'])); - fclose($fd); - } else { - $data = ''; - } - $mimeMessage->addSubpart($data, $params); - } else { - $mimeMessage->addSubpart($att['data'], $params); - } - } - - $output = $mimeMessage->encode(); - $mimeHeaders = $output['headers']; - - foreach ($mimeHeaders as $k => $v) { - $this->debug("MIME header $k: $v"); - if (strtolower($k) == 'content-type') { - // PHP header() seems to strip leading whitespace starting - // the second line, so force everything to one line - $this->mimeContentType = str_replace("\r\n", " ", $v); - } - } - - return $output['body']; - } - - return parent::getHTTPBody($soapmsg); - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - if (count($this->responseAttachments) > 0) { - return $this->mimeContentType; - } - return parent::getHTTPContentType(); - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - if (count($this->responseAttachments) > 0) { - return false; - } - return parent::getHTTPContentTypeCharset(); - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); - $this->requestAttachments = array(); - if (strstr($headers['content-type'], 'multipart/related')) { - $this->debug('Decode multipart/related'); - $input = ''; - foreach ($headers as $k => $v) { - $input .= "$k: $v\r\n"; - } - $params['input'] = $input . "\r\n" . $data; - $params['include_bodies'] = true; - $params['decode_bodies'] = true; - $params['decode_headers'] = true; - - $structure = Mail_mimeDecode::decode($params); - - foreach ($structure->parts as $part) { - if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) { - $this->debug('Have root part of type ' . $part->headers['content-type']); - $return = parent::parseRequest($part->headers, $part->body); - } else { - $this->debug('Have an attachment of type ' . $part->headers['content-type']); - $info['data'] = $part->body; - $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; - $info['contenttype'] = $part->headers['content-type']; - $info['cid'] = $part->headers['content-id']; - $this->requestAttachments[] = $info; - } - } - - if (isset($return)) { - return $return; - } - - $this->setError('No root part found in multipart/related content'); - return; - } - $this->debug('Not multipart/related'); - return parent::parseRequest($headers, $data); - } -} - -/* - * For backwards compatiblity - */ -class nusoapservermime extends nusoap_server_mime { -} - -?>