0

WSDL を使用してプロジェクトの Java コードから PHP に XML SOAP 応答でオブジェクトの配列を送信しています。

プロジェクトの php に値を保存したいと考えています。

私は多くの方法を試しましたが、xml を解析して値を読み取る方法を見つけることができませんでした。私はxml領域でエクスポートしていません。

値から値を読み取るために誰か助けてください。

私の 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');
    }                       
}

前もって感謝します...

4

1 に答える 1

0
 $client = new SoapClient('http://url.com?wsdl');
 $params = array(Java arg => php value);
 $result = $client->Function( $parms );
 print_r($result);
于 2013-06-17T12:02:40.137 に答える