将数组解析为php soap服务器的输入
我陷入了一个PHP漏洞,我似乎无法用谷歌搜索自己。我有一个PHP soap服务器,其中一个函数将int数组作为输入。如何正确解析它 当输入为一个int时,它工作。当它是数组时,它解析字符串“array” 服务器在我的Synology NAS上运行。我一直在试图找到某种PHP日志,soap服务器可能会在其中尖叫其潜在的解析问题,但我没有找到任何这样的日志 这是我的简化服务器:将数组解析为php soap服务器的输入,php,arrays,soap,wsdl,Php,Arrays,Soap,Wsdl,我陷入了一个PHP漏洞,我似乎无法用谷歌搜索自己。我有一个PHP soap服务器,其中一个函数将int数组作为输入。如何正确解析它 当输入为一个int时,它工作。当它是数组时,它解析字符串“array” 服务器在我的Synology NAS上运行。我一直在试图找到某种PHP日志,soap服务器可能会在其中尖叫其潜在的解析问题,但我没有找到任何这样的日志 这是我的简化服务器: <?php if(!extension_loaded("soap")){ dl("php_soap.dll");
<?php
if(!extension_loaded("soap")){
dl("php_soap.dll");
}
ini_set("soap.wsdl_cache_enabled","0");
$server = new SoapServer("input_array_debug.wsdl");
function createProduct($content_refs){
$debugVar = "outside";
foreach ($content_refs as $reference) {
$debugVar = "inside";
error_log("Item:'".$reference."'\n ", 3, "/var/tmp/my-errors.log");
$debugVar = "after";
}
return $debugVar;
}
$server->AddFunction("createProduct");
$server->handle();
soap请求的基础是从soapUI 4.0.1生成和发送的:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:FoodContent">
<soapenv:Header/>
<soapenv:Body>
<urn:createProduct soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<content_refs xsi:type="urn:ArrayOfInt">
<!--1 or more repetitions:-->
<reference xsi:type="xsd:int">3</reference>
<reference xsi:type="xsd:int">7</reference>
</content_refs>
</urn:createProduct>
</soapenv:Body>
</soapenv:Envelope>
3.
7.
响应看起来不错Kevin,我手工创建了wsdl。我还使用Visual Studio从Web服务创建了另一个wsdl。在那里,请求从未进入foreach循环。createProduct响应应该是时间字符串吗?如果是这种情况,我将尝试创建一个wsdl和伪函数来反映这一点(办公室很忙)Kevin,响应应该是int,但出于调试目的,当前是字符串。
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:FoodContent">
<soapenv:Header/>
<soapenv:Body>
<urn:createProduct soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<content_refs xsi:type="urn:ArrayOfInt">
<!--1 or more repetitions:-->
<reference xsi:type="xsd:int">3</reference>
<reference xsi:type="xsd:int">7</reference>
</content_refs>
</urn:createProduct>
</soapenv:Body>
</soapenv:Envelope>