tags:

views:

27

answers:

1
+1  Q: 

PHP soap client

The result of a soap client call is an object that contains 2 properties and an array of objects.

The array of objects is mapped as stdclasses.

Is there any way to fix this?

Update: I need the proper mapping : object with an array of objects not array of stdclasses.

A: 

stdclasses is the standard object in php. Like in java, where you have the Object class.. and every class extends Object... so what you are receiving is indeed an array of objects..

Let's say that you are receiving a list of products from your web service and you want an array of objects Product. What you need to do is create a constructor for the Product class, then call the webservice and use a foreach to pass each stdclass to the constructor of Products.. of course, in the constructor you're mapping the structure of the data from the WS to your own structure of Products. Hope this helps

pleasedontbelong