Tags Archives

You are currently viewing all posts tagged with xml.

So you found yourself looking for one of the following keywords ‘PHP SOAP Repeated Element Name‘ or ‘SOAP Structure Repeated Name‘.

Then look no further, I’m going to show you how to properly address this problem.
PHP SoapClient is not the most complete library out there, it’s actually rather poor at times, if you have the time to test and implement, a better, faster, more complete library to replace PHP SoapClient, then google this: WSO2 Web Services Framework for PHP (WSO2 WSF/PHP), it’s a paid-turned-open source project.

In reference to our problem, you may have a structure like this:

And whether you are building the response using Objects or Arrays, the answer is pretty much the same.

In case you are working with a complex WSDL Specification you are probably using Objects, for perfect control over the namespaces.

The Solution
The simplest solution relies on a pretty little thing called, ArrayObject, implemented in PHP 5, which can be used whether you are building an Array or an Object.

If you are a building simple response without need for namespace declarations, you can just put the value instead of using SoapVar’s.

The example above will output the XML repeated element example above when sent via SOAP.

Read more →