Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Eirik Hoem's Blog:
Setting xsi:type for objects sent over SOAP (inheritance)
Mar 19, 2008 @ 15:26:27

Eirik Hoem has posted a tip for all of the PHP SOAP developers out there - a method for setting the xsi:type correctly for objects sent in the message.

I spent quite some time looking for info on how to specify the xsi:type for the objects, and I finally came across SoapVar. I created a base class which the SOAP classes extended. A method called pack is responsible for setting xsi:type.

In his example, he creates a BaseClass to work from and builds a createCustomer class on top of it, defining a setCustomer function inside. When the new Person is created, a new Customer is too complete with the correctly formatted type on the object.

tagged: soap extension soapvar baseclass customer person xsitype

Link:

PHP Web Services Blog:
Payload the Way You Want with PHP5 built-in SOAP
Jan 30, 2008 @ 21:00:31

The PHP Web Services blog has a helpful hint on getting a custom SOAP request all ready to go:

How do you get this [custom] XML to be output by the SoapClient?

Using the SoapVar method and a few newly created objects, making a custom structure is simple. It's just a matter of encoding the object and setting it with the base() method in the PHP SOAP extension. Check out the blog post for an example of both the custom XML and the code to produce it.

tagged: payload custom soap extension soapvar object encode

Link:


Trending Topics: