NuSOAP - allowing arrays as inputs

Discussion in 'PHP' started by grutland, Jun 15, 2011.

  1. #1
    Hi,

    Trying to finalise our API and using NuSOAP to generate the WSDL.
    I'm having some issues with allowing users to enter arrays as inputs.
    This doesn't seem to be a problem using PHP's SoapClient, but when using other languages the WSDL doesn't work.

    I've tried the following approaches:

    $server->register(
    'functionName',
    array('parameters' => 'xsd:string',
    array('return' => 'xsd:string')),
    'namespace'
    false,
    'rpc',
    'encoded'
    );
    PHP:
    $server->register(
    'functionName',
    array('parameters' => 'xsd:string[]',
    array('return' => 'xsd:string')),
    'namespace'
    false,
    'rpc',
    'encoded'
    );
    PHP:
    $server->register(
    'functionName',
    array('parameters' => 'xsd:array',
    array('return' => 'xsd:string')),
    'namespace'
    false,
    'rpc',
    'encoded'
    );
    PHP:
    $server->wsdl->addComplexType(
    'parameter',
    'complexType',
    'struct',
    'sequence',
    '',
    array(),
    array(
    'key' => array('name' => 'key', 'type' => 'xsd:string'),
    'value' => array('name' => 'value', 'type' => 'xsd:string')
    )
    );
    
    $server->register(
    'functionName',
    array('parameters' => 'tns:parameter[]',
    array('return' => 'xsd:string')),
    'namespace'
    false,
    'rpc',
    'encoded'
    );
    PHP:
    $server->wsdl->addComplexType(
    'parameter',
    'complexType',
    'struct',
    'sequence',
    '',
    array(),
    array(
    'key' => array('name' => 'key', 'type' => 'xsd:string'),
    'value' => array('name' => 'value', 'type' => 'xsd:string')
    )
    );
    
    $server->wsdl->addComplexType(
    'parameters',
    'complexType',
    'array',
    '',
    'SOAP-ENC:Array',
    array(),
    array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:parameter[]'),
    'tns:parameters'
    );
    
    $server->register(
    'functionName',
    array('parameters' => 'tns:parameters',
    array('return' => 'xsd:string')),
    'namespace'
    false,
    'rpc',
    'encoded'
    );
    PHP:
    Any one got any ideas on how to get this to work?

    Gary
     
    grutland, Jun 15, 2011 IP
  2. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #2
    Sorry, to clarify... what I want to do is be able to input an unbounded array into a soap call.
    I've have also tried putting minOccurs and maxOccurs into those examples above.

    I'm sure it must be possible.
     
    grutland, Jun 15, 2011 IP