NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Problem sending array of structures with data to the client?


Joined: 12 Jan 2010
Posts: 1
Reply with quote
Hi forum members,

I've been creating a service layer for an application ...
I need to send an array of structures with data from the server side to the client side.

Please, take a 5 minutes read my code!
Code:

//Create the server instance
$server = new soap_server;

//Initialize WSDL support
$server->configureWSDL('cac', 'urn:cac');

$server->register(
    'query',
    array('request'=>'xsd:string'),
    array('return' => 'tns:CacSoapQueryResult'),
    'urn:cac',
    'urn:cac#query',
    'rpc',
    'encoded',
    'Process a request and execute queries on CAC server'
  );

$server->wsdl->addComplexType(
    'CacSoapQueryResult',
    'complexType',
    'struct',
    'all',
    '',
    array(
      'recordSet' => array(
        'name' => 'recordSet',
        'type' => 'tns:ArrayOfCacSoapRecord'),
    )
);

$server->wsdl->addComplexType(
    'ArrayOfCacSoapRecord',
    'complexType',
    'array',
    '',
    'SOAP-ENC:Array',
    array(),
    array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:CacSoapRecord[]')),
    'tns:CacSoapRecord'
  );

$server->wsdl->addComplexType(
    'CacSoapRecord',
    'complexType',
    'struct',
    'all',
    '',
    array(
      'uid' => array(
        'name' => 'uid',
        'type' => 'xsd:string'),
      'username' => array(
        'name' => 'username',
        'type' => 'xsd:string'),
      'mail' => array(
        'name' => 'mail',
        'type' => 'xsd:string'),
    )
  );


The problem is this:

When I try to send an array with data from the server, the client get this: Response not of type text / xml: text / html,
When the array is empty, no problems. the client gets: Array { } , and the rest...

The function that provide the data, is ok and tested.

My question:
Why is this happening if the definition of data types is correct?

Thanks for your help!!! Smile
View user's profileFind all posts by kyberneeesSend private message
Problem sending array of structures with data to the client?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic