When to use elements and attrs in nusoap?

  nusoap, php, soap

In Nusoap, if I want to define array of struct, I can do it like this:

(message is a struct)

$server->wsdl->addComplexType(
'messageArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
[], // $elements
[
    [
        'ref' => 'SOAP-ENC:arrayType',
        'wsdl:arrayType' => 'tns:message[]',
    ],
], // $attrs
'tns:message'

);

As shown in the code comment, if I swap the position of the $elements and $attrs, it still works. I am not clear on what should be element, what should be attrs in nusoap.

From nusoap documentation:

elements  $elements   = array ( name = array(name=>'',type=>'') ) 

attrs $attrs  = array( array( 'ref' =>
"http://schemas.xmlsoap.org/soap/encoding/:arrayType",
"http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" ) )

Can anybody explain the usage for the $elements and $attrs, especially on the 'ref'=> part?

Source: Ask PHP

LEAVE A COMMENT