I have been wracking my brain to figure this out. I have an XML that get from a soap call. I can echo the result but I can't figure out how to get in there and loop through the data. I'm new to soap (as you might tell).
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header> <ActivityId xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics" CorrelationId="18b2719b-e13a-41d7-ab1c-eb3319a2fd64">a588ead5-ecce-42bb-bcb3-b6f13ddc3846</ActivityId> </s:Header> <s:Body> <GetMBDataResponse xmlns="http://blah.com/APO"> <GetMBDataResult xmlns:a="http://blah.com/APO/GetGuestData" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:Project> <a:ProjectId>12345</a:ProjectId> <a:AlternateId/> <a:Name>Summer Vacation</a:Name> <a:Date>2014-05-17T00:00:00</a:Date> <a:ProjectType/> <a:Organization>My Org</a:Organization> </a:Project> <a:DeletedProject i:nil="true"/> <a:Guests> <a:MBData.BData> <a:ProjectId>12345</a:ProjectId> <a:BId>11979066</a:BId> <a:Name>John Smith</a:Name> <a:Number>101</a:Number> <a:First>John</a:First> <a:Last>Smith</a:Last> </a:MBDData.BData> <a:MBData.BData> <a:ProjectId>12345</a:ProjectId> <a:BId>11979067</a:BId> <a:Name>Nancy Wilson</a:Name> <a:Number>102</a:Number> <a:First i:nil="true"/> <a:Last i:nil="true"/> </a:MBData.BData> </a:Guests> </GetMBDataResult> ... </GetMBDataResponse> </s:Envelope> I've tried to simplexml_load_string($xml) after it's returned from the cURL but I can't figure out how to get in there and loop through the MBData and get the details. I'm sure it's obvious but I just can seem to get it.
UPDATE
This is part of the WSDL:
<xs:complexType name="Authentication"> <xs:sequence> <xs:element name="PartnerId" nillable="true" type="xs:string"/> <xs:element name="UserName" nillable="true" type="xs:string"/> <xs:element name="Password" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> How would you build your SoapClient authentication. I keep getting: Fatal error: Uncaught SoapFault exception: [a:InternalServiceFault] Object reference not set to an instance of an object. in /var/www/cron-gg-update.php:36 Stack trace: #0 /var/www/cron-gg-update.php(36): SoapClient->__soapCall('GetMBData', Array).
SoapClientclass that does it all for you :)