Another SOAP question - I have a large multidimensional array, which echo's out fine when using print_r (eg you can see all of the data). The problem arises when I use
SOAPClient->__soapCall('Function', array('paramaters' => $feedUpload));
This actually returns an xml that looks like this: (using __getLastRequest)
<soap-env:envelope xmlns:ns1="http://www.property24.com/prosol/P24Feed" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:body>
<ns1:uploadlistings>
<ns1:feedupload>
<ns1:version>1</ns1:version>
<ns1:usertoken>
<ns1:token>3c7b39ea-c10b-451f-95bf-5118d84fb089</ns1:token>
</ns1:usertoken>
<ns1:command>UPLOAD</ns1:command>
<ns1:compress>None</ns1:compress>
<ns1:listings>
<ns1:listing>
<ns1:listingnumber>361000001</ns1:listingnumber>
<ns1:propertycategory>SR</ns1:propertycategory>
<ns1:listingdata>Array</ns1:listingdata>
<ns1:listingtype>A</ns1:listingtype>
</ns1:listing>
</ns1:listings>
</ns1:feedupload>
</ns1:uploadlistings>
</soap-env:body>
</soap-env:envelope>
As you can see, for ListingData it returns "Array". Here is the array schema:
Array
(
[parameters] => Array
(
[FeedUpload] => Array
(
[Version] => 1
[UserToken] => Array
(
[Token] => 5ece25e7-77d9-4dbf-8b8f-e047759ab8f4
)
[Command] => UPLOAD
[Compress] => None
[Listings] => Array
(
[Listing] => Array
(
[PropertyCategory] => SR
[ListingNumber] => 361000001
[ListingType] => A
[ListingData] => Array
(
[MandateDetails] => Array
(
[ListingNumber] => 361000001
[ListingType] => A
[MandateType] => O
[ClosedUserGroup] => C
[MarketCode] => A
[ListPrice] => 111000
[OccupationDate] =>
[OffMarketDate] =>
[OnMarketSince] =>
[ExpiryDate] => 2011-07-13T09:56:14Z
[ListDate] => 2011-07-13T09:51:14Z
[UpdateDate] => 2011-07-13T09:51:14Z
[VirtualTourUrl] =>
[ActualDirections] =>
[ShowHouseDirection] =>
[ViewComments] =>
[InternetComments] => Excellent stand situated on the flood plane with large riverine trees and great mountain views. The estate is situated along the world renowned Blyde River and is 394 ha in extent with only 154 sites on 4000 square metres. The estate has an array of plains game such as antelope, giraffe and wildebeest as well as hippo and crocodile. The riverine flood plain provides great birding opportunities such as the Pels fishing owl. There is a restaurant and clubhouse that serves meals and cocktails and offers
)
[PropertyDetails] => Array
(
[PropertyCategory] => SR
[PropertyType] => SRX
[Status] => ACTV
[Province] => Eastern Cape
[Town] => Aberdeen
[Suburb] => Balvinie
[StreetName] => Test Street
[StreetNumber] => 5
[PostalCode] => 0123
[ErfSize] => 1200
[HouseSize] =>
[Age] =>
[OwnerType] => G
[VATRegistered] => false
[MunicipalRatesAndTaxes] => 0
[MunicipalImprovementsValue] => 0
[MunicipalLandValue] => 0
[MunicipalTotalValue] => 0
[StandNumber] =>
[StandNumberSubdivided] =>
[PortionNumber] =>
[OwnerShipType] =>
)
[ResidentialDetails] => Array
(
[NoOfBathrooms] => 2
[BathroomDescription] =>
[NoOfBedrooms] => 6
[BedroomDescription] =>
[NoOfKitchens] => 2
[KitchenDescription] =>
[NoOfReceptionRooms] => 2
[ReceptionRoomDescription] =>
[NoOfStudies] => 1
[StudiesDescription] =>
[NoOfDomesticBathrooms] => 2
[NoOfDomesticRooms] => 0
[DomesticRoomsDescription] =>
[NoOfGarages] => 0
[GarageDescription] =>
[NoOfOutsideToilets] => 0
[Coverage] => 0
[Pool] => false
[PoolDescription] =>
[Flatlet] =>
[FlatletDescription] =>
[FlatletSize] =>
[EstablishedGarden] =>
[OutBuildingSize] =>
[NoOfCarports] => 0
[CarportsDescription] =>
[ParkingBayNumber] =>
[Parking] =>
[ParkingDescription] =>
[BusinessRights] =>
[HeightRestrictions] =>
[CommonFeatures] =>
[NumberOfShares] =>
[FacingOptions] =>
[KitchenOptions] =>
[FeatureOptions] =>
[SpecialFeatureOptions] =>
[WallOptions] =>
[WindowOptions] =>
[StyleOptions] =>
[TemperatureControlOptions] =>
[SecurityOptions] =>
[RoofOptions] =>
[RoomOptions] =>
[PoolOptions] =>
[BathroomOptions] =>
)
[AgentDetails] => Array
(
[InternetAgentName] => Ricky Duckworth
[InternetAgentPhoneNumber] => 0157931534
[InternetAgentEmailAddress] => [email protected]
[InternetAgentSMSNumber] => 0796057834
[ListingAgentCode] => CN21
[ListingAgencyCode] => CWP021
)
)
)
)
)
)
)
As you can see the array is structured fine. It's like SoapRequest has got to far into an array and stopped. I also get the notice
Notice: Array to string conversion in /var/www/vhosts/propertylogic.net/httpdocs/soap_feed/property24/add_property.php on line 178
Which is the SOAPCall line.
Thanks very much!
[EDIT]Ok, basically the SOAP server requested that section to be raw xml, so I had to replace the Array with a String - sort of stupid way of doing things, but the error message now makes sense! (Can't answer my own question).
You'd better generate and use WSDL to create SOAP Client and define complex types there. This way every SOAP type will be converted to PHP types in a natural way (in your example it'll be an array of objects).
Or you can replace array with string as you did already, though it is a dirty magic :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With