| 1 |
<?xml version="1.0" encoding='ISO-8859-1'?> |
|---|
| 2 |
<Database xmlns="http://www.midgard-project.org/repligard/1.4"> |
|---|
| 3 |
<host id="fd1f86f884f8ee89cdf5a468a2b87ac2" changed="20021112191121"> |
|---|
| 4 |
<info>auth</info> |
|---|
| 5 |
<style>5676b2f1795977dc468cd16126a371d7</style> |
|---|
| 6 |
<port>0</port> |
|---|
| 7 |
<prefix><![CDATA[/soap]]></prefix> |
|---|
| 8 |
<online>1</online> |
|---|
| 9 |
<name>localhost</name> |
|---|
| 10 |
<root>e39e203c3a2ae953eea5fb5f8cac320f</root> |
|---|
| 11 |
<sitegroup></sitegroup> |
|---|
| 12 |
<owner></owner> |
|---|
| 13 |
</host> |
|---|
| 14 |
<page id="e39e203c3a2ae953eea5fb5f8cac320f" changed="20021112191121"> |
|---|
| 15 |
<title><![CDATA[SOAP]]></title> |
|---|
| 16 |
<up></up> |
|---|
| 17 |
<info>auth</info> |
|---|
| 18 |
<style></style> |
|---|
| 19 |
<author>b404dbef6bcef981665e7e50db3a9617</author> |
|---|
| 20 |
<changed>2002-10-31</changed> |
|---|
| 21 |
<name><![CDATA[SOAP-Root]]></name> |
|---|
| 22 |
<content><![CDATA[<? |
|---|
| 23 |
|
|---|
| 24 |
mgd_include_snippet("/MidgardSOAP/Server"); |
|---|
| 25 |
|
|---|
| 26 |
require_once 'SOAP/Server.php'; |
|---|
| 27 |
|
|---|
| 28 |
$server = new SOAP_Server(); |
|---|
| 29 |
$server->_auto_translation = false; |
|---|
| 30 |
$server->addObjectMap(new MidgardSOAPServer(),'urn:MidgardServer'); |
|---|
| 31 |
$server->service($HTTP_RAW_POST_DATA); |
|---|
| 32 |
|
|---|
| 33 |
?>]]></content> |
|---|
| 34 |
<sitegroup></sitegroup> |
|---|
| 35 |
</page> |
|---|
| 36 |
<style id="5676b2f1795977dc468cd16126a371d7" changed="20021112191121"> |
|---|
| 37 |
<up></up> |
|---|
| 38 |
<name><![CDATA[SOAP-Style]]></name> |
|---|
| 39 |
<sitegroup></sitegroup> |
|---|
| 40 |
<owner></owner> |
|---|
| 41 |
</style> |
|---|
| 42 |
<snippetdir id="909ba8cc07770fcd0de58cc28bc1ceec" changed="20021112191121"> |
|---|
| 43 |
<up></up> |
|---|
| 44 |
<description/> |
|---|
| 45 |
<name><![CDATA[MidgardSOAP]]></name> |
|---|
| 46 |
<sitegroup></sitegroup> |
|---|
| 47 |
<owner></owner> |
|---|
| 48 |
</snippetdir> |
|---|
| 49 |
<person id="b404dbef6bcef981665e7e50db3a9617" changed="20021112191121"> |
|---|
| 50 |
<birthdate><![CDATA[0000-00-00]]></birthdate> |
|---|
| 51 |
<city/> |
|---|
| 52 |
<department></department> |
|---|
| 53 |
<office>0</office> |
|---|
| 54 |
<topic></topic> |
|---|
| 55 |
<img></img> |
|---|
| 56 |
<info/> |
|---|
| 57 |
<homepage/> |
|---|
| 58 |
<email/> |
|---|
| 59 |
<extra/> |
|---|
| 60 |
<creator></creator> |
|---|
| 61 |
<lastname><![CDATA[Midgard]]></lastname> |
|---|
| 62 |
<firstname><![CDATA[Administrator]]></firstname> |
|---|
| 63 |
<handphone/> |
|---|
| 64 |
<homephone/> |
|---|
| 65 |
<pgpkey/> |
|---|
| 66 |
<postcode/> |
|---|
| 67 |
<workphone/> |
|---|
| 68 |
<subtopic></subtopic> |
|---|
| 69 |
<created>0000-00-00 00:00:00</created> |
|---|
| 70 |
<username/> |
|---|
| 71 |
<sitegroup></sitegroup> |
|---|
| 72 |
<password/> |
|---|
| 73 |
<street/> |
|---|
| 74 |
</person> |
|---|
| 75 |
<element id="154e58f83f2e97664df2aee803944a42" changed="20021112191121"> |
|---|
| 76 |
<value><![CDATA[<(content)>]]></value> |
|---|
| 77 |
<style>5676b2f1795977dc468cd16126a371d7</style> |
|---|
| 78 |
<name><![CDATA[ROOT]]></name> |
|---|
| 79 |
<sitegroup></sitegroup> |
|---|
| 80 |
</element> |
|---|
| 81 |
<snippet id="95f2520232c49332079a74136ceb4f25" changed="20021112191121"> |
|---|
| 82 |
<code><![CDATA[<? |
|---|
| 83 |
|
|---|
| 84 |
/* TODO: |
|---|
| 85 |
* - define error codes and errno() |
|---|
| 86 |
* - our own errstr() function |
|---|
| 87 |
* - rename mgd_err(no|str) to err(no|str) |
|---|
| 88 |
* - method for retrieving error codes?! |
|---|
| 89 |
*/ |
|---|
| 90 |
|
|---|
| 91 |
class MidgardResultSOAP { |
|---|
| 92 |
var $value; |
|---|
| 93 |
var $type; |
|---|
| 94 |
var $mgd_errno; |
|---|
| 95 |
var $mgd_errstr; |
|---|
| 96 |
|
|---|
| 97 |
function MidgardResultSOAP ($value = NULL, $errno = NULL, $errstr = NULL) { |
|---|
| 98 |
$this->value = $value ? $value : ""; |
|---|
| 99 |
$this->type = is_object($value) ? get_class($value) : get_class($this); |
|---|
| 100 |
$this->mgd_errno = $errno ? $errno : mgd_errno(); |
|---|
| 101 |
$this->mgd_errstr = $errstr ? $errstr : mgd_errstr($this->mgd_errno); |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
function to_soap () { |
|---|
| 105 |
return new SOAP_Value("Midgard", "{MidgardSOAP}" . "MidgardResultSOAP", $this); |
|---|
| 106 |
} |
|---|
| 107 |
|
|---|
| 108 |
} |
|---|
| 109 |
|
|---|
| 110 |
class MidgardSOAPServer { |
|---|
| 111 |
|
|---|
| 112 |
function func ($func, $param, $n = 1) { |
|---|
| 113 |
$call_func = "mgd_${func}"; |
|---|
| 114 |
if (!function_exists($call_func)) |
|---|
| 115 |
return $this->__fail($call_func, -11, "Function does not exist"); |
|---|
| 116 |
|
|---|
| 117 |
$ret = array(); |
|---|
| 118 |
|
|---|
| 119 |
$object = call_user_func_array($call_func, $param); |
|---|
| 120 |
if (!$object) return $this->__fail($object, -5); |
|---|
| 121 |
|
|---|
| 122 |
if (isset($object->__res__)) { |
|---|
| 123 |
while ($n && $object->fetch()) { |
|---|
| 124 |
array_push($ret, $this->__ok($object)); |
|---|
| 125 |
$n--; |
|---|
| 126 |
} |
|---|
| 127 |
} else { |
|---|
| 128 |
$ret = $this->__ok($object); |
|---|
| 129 |
} |
|---|
| 130 |
|
|---|
| 131 |
return $ret; |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|
| 134 |
function meth ($meth, $object, $param = NULL) { |
|---|
| 135 |
if (!is_object($object)) |
|---|
| 136 |
return $this->__fail($object, -13, "Not an Object"); |
|---|
| 137 |
|
|---|
| 138 |
if (!array_key_exists('type', get_object_vars($object))) |
|---|
| 139 |
return $this->__fail("", -14, "No type"); |
|---|
| 140 |
|
|---|
| 141 |
if (!array_key_exists('value', get_object_vars($object))) |
|---|
| 142 |
return $this->__fail("", -15, "No value"); |
|---|
| 143 |
|
|---|
| 144 |
// MidgardTopic => _topic |
|---|
| 145 |
// MidgardPageElement => _page_element |
|---|
| 146 |
$type = preg_replace( |
|---|
| 147 |
array("/^Midgard/", "/([A-Z])/e"), |
|---|
| 148 |
array("", "'_' . strtolower('\\1')"), |
|---|
| 149 |
$object->type); |
|---|
| 150 |
|
|---|
| 151 |
$call_func = "mgd_get${type}"; // Fetch pure object for this type |
|---|
| 152 |
if (!function_exists($call_func)) |
|---|
| 153 |
return $this->__fail($call_func, -11, "Function does not exist"); |
|---|
| 154 |
$o = call_user_func($call_func); |
|---|
| 155 |
|
|---|
| 156 |
if ($object->value) { |
|---|
| 157 |
foreach ($object->value as $key => $val) { |
|---|
| 158 |
$o->$key = $val; // copy |
|---|
| 159 |
} |
|---|
| 160 |
} |
|---|
| 161 |
if (!method_exists($o, $meth)) |
|---|
| 162 |
return $this->__fail($meth, -12, "Method does not exist"); |
|---|
| 163 |
$ret = call_user_func_array(array($o, $meth), $param); |
|---|
| 164 |
|
|---|
| 165 |
return $this->__ok($ret); |
|---|
| 166 |
} |
|---|
| 167 |
|
|---|
| 168 |
function ping () { |
|---|
| 169 |
return $this->__ok('pong'); |
|---|
| 170 |
} |
|---|
| 171 |
|
|---|
| 172 |
function __ok ($value = NULL) { |
|---|
| 173 |
$ms = new MidgardResultSOAP($value); |
|---|
| 174 |
return $ms->to_soap(); |
|---|
| 175 |
} |
|---|
| 176 |
|
|---|
| 177 |
function __fail ($value = NULL, $errno = -10, $errstr = NULL) { |
|---|
| 178 |
$ms = new MidgardResultSOAP($value, $errno, $errstr); |
|---|
| 179 |
return $ms->to_soap(); |
|---|
| 180 |
} |
|---|
| 181 |
} |
|---|
| 182 |
?>]]></code> |
|---|
| 183 |
<up>909ba8cc07770fcd0de58cc28bc1ceec</up> |
|---|
| 184 |
<creator>b404dbef6bcef981665e7e50db3a9617</creator> |
|---|
| 185 |
<revised>2002-11-12 19:10:30</revised> |
|---|
| 186 |
<revision>139</revision> |
|---|
| 187 |
<author><![CDATA[Peter Suschlik]]></author> |
|---|
| 188 |
<doc/> |
|---|
| 189 |
<revisor>4b02b5d0f52538b85215dbe79dc857df</revisor> |
|---|
| 190 |
<name><![CDATA[Server]]></name> |
|---|
| 191 |
<created>2002-10-28 17:49:24</created> |
|---|
| 192 |
<sitegroup></sitegroup> |
|---|
| 193 |
</snippet> |
|---|
| 194 |
<person id="4b02b5d0f52538b85215dbe79dc857df" changed="20021112191121"> |
|---|
| 195 |
<birthdate><![CDATA[0000-00-00]]></birthdate> |
|---|
| 196 |
<city/> |
|---|
| 197 |
<department></department> |
|---|
| 198 |
<office>0</office> |
|---|
| 199 |
<topic></topic> |
|---|
| 200 |
<img></img> |
|---|
| 201 |
<info>homepage,email,extra</info> |
|---|
| 202 |
<homepage><![CDATA[http://www.midgard-project.org/]]></homepage> |
|---|
| 203 |
<email><![CDATA[midgard@greywolves.org]]></email> |
|---|
| 204 |
<extra><![CDATA[Default administrator account for Midgard]]></extra> |
|---|
| 205 |
<creator></creator> |
|---|
| 206 |
<lastname><![CDATA[Administrator]]></lastname> |
|---|
| 207 |
<firstname><![CDATA[Midgard]]></firstname> |
|---|
| 208 |
<handphone/> |
|---|
| 209 |
<homephone/> |
|---|
| 210 |
<pgpkey/> |
|---|
| 211 |
<postcode/> |
|---|
| 212 |
<workphone/> |
|---|
| 213 |
<subtopic></subtopic> |
|---|
| 214 |
<created>0000-00-00 00:00:00</created> |
|---|
| 215 |
<username></username> |
|---|
| 216 |
<sitegroup></sitegroup> |
|---|
| 217 |
<password></password> |
|---|
| 218 |
<street/> |
|---|
| 219 |
</person> |
|---|
| 220 |
</Database> |
|---|