Jump to content

Parse SOAP Response


Hakim12

Recommended Posts

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>';

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.