Schema "anyType" in WSF/PHP

Tuesday, February 26, 2008

Have you seen any schema that contain elements in 'anyType' like this,
       <xsd:schema elementFormDefault="qualified" targetNamespace="">
<xsd:element name="echoString">

<xsd:element name="inMessage" type="xsd:anyType"/>

<xsd:element name="echoStringResponse">

<xsd:element name="returnVal" type="xsd:anyType"/>


This type of schemas allow users to set any types at run-time. Now WSF/PHP allows users to use this facility in PHP. For an example,
So if any one want to build the following payload,

<echostring xmlns="">
code and string

You can just use following array to generate this,
$res = $proxy->echoString(array("inMessage" => "code and string"));

or using the classmap,

class echoString
public $inMessage;

$echostr = new echoString();

$echostr->inMessage = "test1";

Similarly you will be able handle the response..

1 comment:

David D'Agostino said...

Thanks for example. My question is can the value of an element of type "anyType" be a complexType? Your example shows jsut setting it to a string, which works in my testing. In my case the element that is anyType may be any number of complex types and I am wondering how to do this, especially in wsdl mode.