Soap Server的PHP页面(我见过):
http://www.php.net/manual/en/soapserver.soapserver.php http://www.php.net/manual/en/soapserver.soapserver.php
但对于我自己的问题,我缺少一个重要的文档:
我需要知道是否可以使用 XML 字符串直接实例化服务器,例如SimpleXML
类的作用是:
//From var (the one I want):
$movies = new SimpleXMLElement($xmlstr);
or
//From file and from string (the one I want):
$xml = simplexml_load_file('test.xml');
$xml = simplexml_load_string($string);
所以我想做这样的事情:
$wsdl_cont = file_get_contents("../xmls/mywsdl.wsdl");
$server = new SoapServer($wsdl_cont);
是否可以?
原因是,因为我有一些不同的 URL 必须使用相同的 XML,所以我需要对模板 URL 进行动态替换,并将其更改为正确的 URL,然后加载 WSDL。但我不想将立即生成的 WSDL 保存在 HDD 上,以便在读取后立即将其删除。
是否可以在 PHP 上创建某种“虚拟文件”并像磁盘读取文件一样使用它?某种流缓冲区?或者某种动态文件描述符?
是的,可以通过创建一个DATA URI http://php.net/manual/en/wrappers.data.php从文件内容中取出并将其用作“文件”。
$name = 'mywsdl.wsdl';
$path = '/path-to-file/'.$name;
$data = file_get_contents($path);
$file = 'data://text/plain;base64,'.base64_encode($data);
$server = new SoapServer($file);
这应该可以满足您的要求。 A相关答案 https://stackoverflow.com/questions/5946963/handle-xml-catalogs-by-php/5947149#5947149.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)