使用REST创建WSDL

时间:2016-05-13 16:19:15

标签: php rest

我有几个问题需要在PHP中使用REST创建WSDL。我读了一下这个,据说REST使用WADL。我需要一个生成WADL的库或框架,或者我的代码PHP(类,方法,变量)的类型WSDL。
非常感谢!

我用php创建了一个模拟,但这没有得到返回值

      ... Class
      ... Methods
      ... Vars

      if(isset($_GET['wadl'])):
            header('Content-Type: text/xml');

            $foo = new proveedores();
            $get_class = get_class($foo);

            // create the new XML document
            $dom = new DOMDocument('1.0', 'iso-8859-1');

            // create the root element
            $list_of_teams = $dom->createElement($get_class);
            $dom->appendChild($list_of_teams);

            $class = new ReflectionClass($get_class);
            $methods = $class->getMethods();

            foreach ($methods as $m) {
                $method = $class->getMethod($m->name);

                // create the first element
                    $team = $dom->createElement($m->name);
                    $list_of_teams->appendChild($team);
                $parameters = $method -> getParameters();

                if(!empty($parameters)):
                foreach ($parameters as $p) {
                    $name = $team->appendChild($dom->createElement('parameters'));
                            $name->appendChild($dom->createTextNode($p -> name));
                }
                endif;
            }

            print $xml_result = $dom->saveXML();
      endif;

0 个答案:

没有答案