John Fereira - 2010-01-12

I am working on a site that uses Drupal and the "services" and "soap_server" drupal modules to produce web services.  The soap_server module uses nusoap (I'm currently using version 0.7.3) to generate a wsdl and expose the services.  I can consume them without a problem from another instance of Drupal (also using nusoap) but am having a problem when trying to consume the same services from a Coldfusion site (which uses java Axis2).

When creating the client code it just points to the wsdl exposed using the soap_server module and results in the following error:

Type {http://www.w3.org/2001/XMLSchema}Array is referenced but not defined.

Here is the code which instantiates the server from the soap_server module:

// URL
  $name_space = $scheme . $server_name . base_path() . $q;
  
  // Create server instance
  $soap_server = new soap_server();
  // set encoding to UTF-8
  $soap_server->soap_defencoding = 'UTF-8';
  $soap_server->decode_utf8 = false;
  
  // Initialize WSDL support
  $soap_server->configureWSDL('DrupalSoap', $name_space, $name_space);
  $soap_server->wsdl->schemaTargetNamespace = $name_space;
  
  //Define array types
  $soap_server->wsdl->addComplexType(
    'pair', 'complexType', 'struct', 'all', '',
    array(
      'title' => array('name' => 'title', 'type' => 'xsd:string'),
      'value' => array('name' => 'value', 'type' => 'xsd:string'),
    )
  );
  $soap_server->wsdl->addComplexType(
    'Array', 'complexType', 'array', '', 'SOAP-ENC:Array', array(),
    array(
      array(
        'ref' => 'SOAP-ENC:arrayType',
        'wsdl:arrayType' => 'tns:pair[]'
      )
    ), 'tns:pair'
  );

It looks like the http://www.w3.org/2001/XMLSchema namespace is not getting added for the complexTypes that are added.  Can anyone see something obviously incorrect here.  BTW, the soap_module has been in use for several years but it hasn't been updated recently so perhaps it did work with an older version of nusoap.