I am working on Soap Server 3.x and would like to be able to provide type information in the WSDL that is provided to consumers of the service. Currently we are looking at xsd:any or xsd:struct as the type of the object returned from all services as it seems that no response type information is provided by the _foobar_resource_definition() function.
It seems that this is not acceptable for some SOAP clients as mentioned by ilo in this issue for Soap Server.
I appreciate that for some resources including node it would be difficult to provide detailed type information as any old module can add stuff to the node object, but in other cases the return type would be well defined.
How about something like this?
array(
'my_resource' => array(
'retrieve' => array(
'file' => array('type' => 'inc', 'module' => 'my_module', 'name' => 'resources/my_resource'),
'callback' => '_my_resource_retrieve',
'args' => array(
array(
'name' => 'id',
'optional' => FALSE,
'source' => array('path' => 0),
'type' => 'int',
'description' => 'The id of the my_resource object to get',
),
'return' => array(
'name' => 'my_resource_obj',
'type' => 'struct',
'children' => array(
array(
'name' => 'some_text',
'type' => 'string',
'default value' => 'Default Value',
),
array(
'name' => 'some_number',
'type' => 'int',
'default value' => 0,
),
),
),
'access callback' => '_my_resource_access',
'access arguments' => array('retrieve'),
'access arguments append' => TRUE,
),
Comments
Comment #1
gddWe discussed this in IRC several days ago, and we think a Services 3 implementation of SOAP Server should do the following to manage this:
1) Implement hook_services_resources_alter() to add your needed return values
2) Do the same to add a WSDL callback for each resource.
I think this should solve your problem. I don't see this information getting added into Services core however. It adds a very large amount of data for a use case that is becoming increasingly less implemented.