lukebeer / broadworks-ocip

PHP Framework for interacting with the Broadworks OCI Provisioning API
GNU General Public License v2.0
26 stars 15 forks source link

xsi:nil self-closing elements not possible #7

Open lukebeer opened 8 years ago

lukebeer commented 8 years ago

Issue raised via email in quote block below -

We have come up across a strange one however, we cannot generate a “xsi:nil” value in the API requests.

<BroadsoftDocument protocol="OCI" xmlns="C" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<userId xmlns="">marc.decorny</userId>
<command xsi:type="UserModifyRequest17sp4" xmlns="">
<userId>xxxxxxx</userId>
<phoneNumber>xxxxxxx</phoneNumber>
<extension>202</extension><sipAliasList xsi:nil="true"/>
<endpoint xsi:nil="true"/>
</command>
</BroadsoftDocument>

We have tried variants of the below, but keep on getting errors

$request->endptoint = new SimpleContent("xsi:nil");
$request->endptoint->setElementName('endpoint');

$request->endptoint = null ;
$request->endptoint->setElementName('endpoint');

But none seem to work.

Is there a trick that we are missing?

Many thanks marc

Well spotted.

https://github.com/lukebeer/broadworks-ocip/blob/v1.0.0/core/OCIBuilder.php#L47 solved this in v1 but it's a bit of a hack. I'd planned to add methods that would handle element attributes but only got as far as declaring a variable named $attributes in the type trait ^_^