Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在没有soap客户端php的情况下解析此soap xml响应_Php_Xml_Soap - Fatal编程技术网

如何在没有soap客户端php的情况下解析此soap xml响应

如何在没有soap客户端php的情况下解析此soap xml响应,php,xml,soap,Php,Xml,Soap,我必须解析这个xml并检索用户名和密码值 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&

我必须解析这个xml并检索
用户名
密码

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <ProcessResponse
            xmlns="http://api.securecrmsite.com/">
            <ProcessResult>
                <RequestID>5666290</RequestID>
                <PrimaryKeyID>0</PrimaryKeyID>
                <Success>true</Success>
                <Message>Process completed. Found 1 records.</Message>
                <Records>1</Records>
                <ProcessData>
                    <xs:schema id="NewDataSet"
                        xmlns=""
                        xmlns:xs="http://www.w3.org/2001/XMLSchema"
                        xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
                        <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
                            <xs:complexType>
                                <xs:choice minOccurs="0" maxOccurs="unbounded">
                                    <xs:element name="Results">
                                        <xs:complexType>
                                            <xs:sequence>
                                                <xs:element name="CustomerID" type="xs:int" minOccurs="0" />
                                                <xs:element name="Username" type="xs:string" minOccurs="0" />
                                                <xs:element name="Password" type="xs:string" minOccurs="0" />
                                            </xs:sequence>
                                        </xs:complexType>
                                    </xs:element>
                                </xs:choice>
                            </xs:complexType>
                        </xs:element>
                    </xs:schema>
                    <diffgr:diffgram
                        xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
                        xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
                        <NewDataSet
                            xmlns="">
                            <Results diffgr:id="Results1" msdata:rowOrder="0">
                                <CustomerID>2465266</CustomerID>
                                <Username>tamimanother1</Username>
                                <Password>4565AA</Password>
                            </Results>
                        </NewDataSet>
                    </diffgr:diffgram>
                </ProcessData>
                <XmlRequest>&amp;lt;soap:Envelope
                    xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;
                    xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;
                    xmlns:soap=&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&amp;gt;&amp;lt;soap:Body&amp;gt;&amp;lt;Process
                    xmlns=&amp;quot;http://api.securecrmsite.com/&amp;quot;&amp;gt;&amp;lt;Credentials&amp;gt;&amp;lt;CompanyKey&amp;gt;3785&amp;lt;/CompanyKey&amp;gt;&amp;lt;APIKey&amp;gt;7ca9d84b-e7c9-4d19-aae1-218d109eab6f&amp;lt;/APIKey&amp;gt;&amp;lt;/Credentials&amp;gt;&amp;lt;ProcessName&amp;gt;CustomerInsert&amp;lt;/ProcessName&amp;gt;&amp;lt;Parameters&amp;gt;&amp;lt;ApiParams&amp;gt;&amp;lt;Name&amp;gt;FirstName&amp;lt;/Name&amp;gt;&amp;lt;Value&amp;gt;tamim&amp;lt;/Value&amp;gt;&amp;lt;/ApiParams&amp;gt;&amp;lt;ApiParams&amp;gt;&amp;lt;Name&amp;gt;LastName&amp;lt;/Name&amp;gt;&amp;lt;Value&amp;gt;another&amp;lt;/Value&amp;gt;&amp;lt;/ApiParams&amp;gt;&amp;lt;ApiParams&amp;gt;&amp;lt;Name&amp;gt;Email&amp;lt;/Name&amp;gt;&amp;lt;Value&amp;gt;test@test.com&amp;lt;/Value&amp;gt;&amp;lt;/ApiParams&amp;gt;&amp;lt;/Parameters&amp;gt;&amp;lt;/Process&amp;gt;&amp;lt;/soap:Body&amp;gt;&amp;lt;/soap:Envelope&amp;gt;
                </XmlRequest>
            </ProcessResult>
        </ProcessResponse>
    </soap:Body>
</soap:Envelope>

如果需要xpath,请尝试以下方法

concat(//Results/Username,"|",//Results/Password) 
结果
String='tamimanother1 | 4565AA'

concat(//Results/Username,"|",//Results/Password)