Hakim12 Posted January 17, 2022 Share Posted January 17, 2022 On 10/16/2020 at 5:38 AM, requinix said: If all you want is the isokresult then you can get it... well, I won't say "easily" because SOAP just loves using namespaces, but it is a one-liner. Kinda. Don't need XPath. (string)$xml ->children("http://schemas.xmlsoap.org/soap/envelope/") // switch to soap namespace ->body // <soap:body> ->children("http://tempuri.org/") // switch to this isokwhatever namespace ->isokresponse // <isokresponse> ->isokresult // <isokresult> (still in the isok namespace) I'm going to parse my res XML to find responseCode tag value, but stuck for a while. How can I get responseCode from this xml using PHP. Can someone help me?? My response: $res = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <ns:doFinacleTransactionResponse xmlns:ns="http://ws.apache.org/axis2"> <ns:return xsi:type="ax226:doSomethingTTResponse" xmlns:ax226="http://fi/xsd" xmlns:ax228="http://companyname/xsd" xmlns:ax230="http://somename.act.acc.fi/xsd" xmlns:ax232="http://UnFreeze.acc.fi/xsd" xmlns:ax234="http://Acctli.fi/xsd" xmlns:ax236="http://Freeze.acc.fi/xsd" xmlns:ax238="http://something.Chequebook.fi/xsd" xmlns:ax241="http://coll.fi/xsd" xmlns:ax243="http://Scheme.fi/xsd" xmlns:ax245="http://Update.somedepartmentCustomer.Customer.fi/xsd" xmlns:ax247="http://onedepartmentname.Customer.fi/xsd" xmlns:ax252="http://Custom.acc.fi/xsd" xmlns:ax254="http://Acknow.Chequebook.fi/xsd" xmlns:ax257="http://Create.department.Customer.fi/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ax226:responseCode>100</ax226:responseCode> <ax226:responseMessage>Operation Successful.</ax226:responseMessage> <ax226:transactionDate>2020-03-18T00:00:00.000</ax226:transactionDate> <ax226:transactionId>CB78490</ax226:transactionId> </ns:return> </ns:doFinacleTransactionResponse> </soapenv:Body> </soapenv:Envelope>'; Quote Link to comment https://forums.phpfreaks.com/topic/314423-parse-soap-response/ Share on other sites More sharing options...
requinix Posted January 17, 2022 Share Posted January 17, 2022 Don't hijack threads. What code have you tried so far, what has it done, and what did you expect it to do? Quote Link to comment https://forums.phpfreaks.com/topic/314423-parse-soap-response/#findComment-1593390 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.