Monday, April 12, 2010

Web Service ::: Part 4 how to handle Maxoccurs =unbound condition in Web Service (nusoap)

To call a client ($client->call () ;) we need to pass an associative array as a parameter. Suppose we need to pass duplicate element to that associative array then the function “new soapval () “ will come into picture


In the above WSDL file “maxOccurs="unbounded” for the element named “CustomField". So we can pass n number of "Custom Field "element as parameter. By using “new soap val()” function ,we can include duplicate "Custom Field "element into an associative array 

$parameter= array ("CustomFields " =>
array ("CustomField "=>array ("Field "=>"Company"," Value "=>"XYZ"),
new soapval(' CustomField ', 'array', array("Field "=>"Employees"," Value "=>"ABCD")),