0

How do I convert SOAP response like this to php array using SimpleXML?

<?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:Header> <eWAYHeader xmlns="http://www.eway.com.au/gateway/rebill/manageRebill"> <eWAYCustomerID>9******5</eWAYCustomerID> <Username>ac****@si****.com.sand</Username> <Password>*******</Password> </eWAYHeader> </soap:Header> <soap:Body> <CreateRebillCustomerResponse xmlns="http://www.eway.com.au/gateway/rebill/manageRebill"> <CreateRebillCustomerResult> <Result>Success</Result> <ErrorSeverity /> <ErrorDetails /> <RebillCustomerID>60066328</RebillCustomerID> </CreateRebillCustomerResult> </CreateRebillCustomerResponse> </soap:Body> </soap:Envelope> 
6
  • Can you please explain how you got this and what you intend to do with it, cause i smell a bad case of "Not using technologies correctly" here Commented Jun 20, 2012 at 19:32
  • I'm developing a application using Eway payment gateway API. I'm getting this after I send SOAP request using CURL in php. This is come as response. Commented Jun 20, 2012 at 19:34
  • 1
    @AchinthaSamindika, any reason you want it to be associative array? The SOAP response you get can be pretty easily parsed/traversed with XPath (see some good point here), also using SOAP extension seems a better choice. Commented Jun 20, 2012 at 19:38
  • I'm newbie and still not got how to traverse. If you can it in using this xml it will great help. Thanks Commented Jun 20, 2012 at 19:41
  • @AchinthaSamindika, loork a bit within linker/related questions in the right sidebar and you'll figure way how to do it ;) Commented Jun 20, 2012 at 19:43

1 Answer 1

3

You might want to look at SoapClient class then? It'll save HEAPS of trouble.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.