在PHP中使用名称空间从WSDL XML读取数组对象


Read Array Object from WSDL XML with namespaces in PHP

我正在使用WSDL将XML Soap响应中的对象数组从我的java代码发送到我的项目中的php。

我想在php中为我的项目存储值。

我尝试了很多方法,但无法找到如何解析我的xml和读取值。我不是在xml区域导出。

谁来帮我从values中读出我的values

我的SOAP响应体:

<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:body>
<getactualtimerequestresponse xmlns="http://impl.sample.com">
        <getactualtimereturn>.
            <ns1:projectlist xmlns:ns1="http://response.sample.com">
                <item>
                    <ns2:userid xmlns:ns2="http://request.sample.com">4</ns2:userid>
                    <ns3:username xmlns:ns3="http://request.sample.com">Manoj Arun</ns3:username>
                </item>
                <item>
                    <ns5:userid xmlns:ns5="http://request.sample.com">5</ns5:userid>
                    <ns6:username xmlns:ns6="http://request.sample.com">Sethu Raman</ns6:username>
                </item>
            </ns1:projectlist>              
            <ns10:message xsi:nil="true" xmlns:ns10="http://response.sample.com"></ns10:message>
        </getactualtimereturn>
    </getactualtimerequestresponse>
</soapenv:body>
</soapenv:envelope>

projectList是我在java中创建的对象。

PHP:

我试着阅读下面的内容,但是我没有得到任何东西。

foreach($xml->xpath('//ns:projectList') as $header)
{
    foreach($header->item as $userIds)
    {
         echo $userIds->xpath('//ns:userId');
    }                       
}

 $client = new SoapClient('http://url.com?wsdl');
 $params = array(Java arg => php value);
 $result = $client->Function( $parms );
 print_r($result);