Reputation: 6908
I'm trying to figure it out how to parse a XML reponse, but have no luck, what I needs is the record sections:
<env:envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:header/>
<env:body>
<ns2:getcalllogreportresponse xmlns:ns2="http://service.admin.ws.five9.com/">
<return>
<header>
<values>
<data>DATE</data>
<data>TIME</data>
<data>DNIS</data>
<data>ANI</data>
<data>CALL TYPE</data>
<data>CAMPAIGN</data>
<data>AGENT</data>
<data>DISPOSITION</data>
<data>SKILL</data>
<data>DURATION</data>
<data>BILL TIME (ROUNDED)</data>
<data>HOLD TIME</data>
<data>QUEUE WAIT TIME</data>
<data>HANDLE TIME</data>
<data>RATE</data>
<data>COST</data>
</values>
</header>
<records>
<values>
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true">...</data>
</values>
</records>
<records>...</records>
<records>...</records>
<!--...-->
I am using PHP, but totally new to XML and SOAP. Thanks.
Upvotes: 0
Views: 646
Reputation: 11154
That's because you shouldn't do soap requests or responses manually. You use a library like SoapClient by giving it a WSDL file (which should be made available to you by whatever service you are trying to access). SoapClient takes this WSDL file and returns an object to you that has pretty little methods which you can call to interact with the service. If soap seems hard, manual or stupid, then (as you suspected) you are doing it wrong. I'm glad you asked though, as I've come across teams of developers who made this mistake and spent 6 months building classes to manually interface with a SOAP service.
Upvotes: 2