PHP Soap-使用nusoap保存xml服务器端


PHP Soap - Save an xml server-side using nusoap

所以我在Soap web服务的服务器上保存XML文件时遇到问题。我使用的是nusoap,我想加载一个现有的xml文件,编辑一些节点,然后保存它。这个函数被剥夺了大部分功能,但它仍然无法保存文件。

require_once 'nusoap/lib/nusoap.php';
function saveXML()
{
    $xml = simplexml_load_file('file.xml') or die(); //file is loaded successfully 
    $xml->asXml('newFile.xml'); // returns false (doesn't save the file)
    $dom = dom_import_simplexml($xml)->ownerDocument; 
    $dom->formatOutput = true;
    $dom->save('newFile.xml'); // returns false (doesn't save the file)
    return $dom->saveXML(); // after printing client-side I get the correct XML
}
$server = new soap_server();
$server->register('saveXML');
$server->service($HTTP_RAW_POST_DATA);
exit();

所以我在这里真的毫无头绪。我尝试在public_html中设置一些文件夹和文件的写入权限,但没有成功。或者在服务器端执行soapweb服务时实际上不可能编写文件?

我解决了这个问题,不仅为web服务本身和我想要保存XML的路径添加了写权限,还为所有nusoap库文件添加了写许可。