Create complex type nusoap php - php

I work on a project of personal web service nusoap I start for the first time the web service last week via the web info.
Currently I am trying to write a webservice that inserts an element in the form of a table.
Here is the file server:
require_once ('lib/nusoap.php');
$server = new nusoap_server();
$server->configureWSDL("test", "urn:Test/", "http://localhost/testajout/server.php");
$server->wsdl->schemaTargetNamespace="http://localhost/testajout/server.php";
$server->soap_defencoding = 'utf-8';
//register of method
$server->wsdl->addComplexType(
'cordonne',
'complexType',
'struct',
'all',
'',
array(
'ID'=> array('name' => 'id', 'type' => 'xsd:int'),
'prenom'=> array('name' => 'prenom', 'type' => 'xsd:string'),
'lastname'=> array('name' => 'lastname', 'type' => 'xsd:string'),
'datedebut'=> array('name' => 'datedebut', 'type' => 'xsd:date'),
'solde'=> array('name' => 'solde', 'type' => 'xsd:decimal'),
'identifient'=> array('name' => 'identifient', 'type' => 'xsd:string'),
'photo' => array('name' => 'photo', 'type' => 'xsd:string'),
'fid'=> array('name' => 'fid', 'type' => 'xsd:int'),
'codebarre' => array('name' => 'codebarre', 'type' => 'xsd:string')
));
$server->register('InsertUser',array('cordonne'=>'tns:cordonne'),array('return' =>'xsd:string'));
function InsertUser($cordonne){
$cordonne=array();
$db1=new PDO('mysql:host=localhost;dbname=service','root','');
/* $req1 = $db1->prepare("SELECT * FROM myusers WHERE identifient =:identifient");
$req1->execute(array(':identifient' =>$identifient));
$count = $req1->rowCount();
if($count){
return "existe déja";
}else{*/
$id=$cordonne['id'];
$prenom = $cordonne['nom'];
$lastname = $cordonne['prenom'];
$datedebut = $cordonne['datedebut'];
$solde = $cordonne['solde'];
$login = $cordonne['identifient'];
$photo =$cordonne['photo'];
$fid=$cordonne['fid'];
$codebarre=$cordonne['codebarre'];
$req=$db1->prepare("insert into myusers values(:ID,:Prenom,:LastName,:dateDebut,:solde,:identifient,:photo,:fidelit,:CodeBarre)");
$req->execute(array(':ID'=>$id,':Prenom'=>$prenom,':LastName'=>$lastname,':dateDebut'=>date("Y-m-d", strtotime( $datedebut)),':solde'=>$solde,
':identifient'=>$login,':photo'=>$photo,':fidélit'=>$fid,':CodeBarre'=>$codebarre));
return "client ajouter";
}
Client code:
error_reporting(E_ALL);
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the client instance
$client = new nusoap_client('http://localhost/testajout/server.php');
$cordonne['id']=NULL;
$cordonne['nom']=$_POST['nom'];
$cordonne['prenom']=$_POST['prenom'];
$cordonne['datedebut']=$_POST['dateDebut'];
$cordonne['solde']=$_POST['solde'];
$cordonne['identifient']=$_POST['identifient'];
$cordonne['photo']=$_POST['photo'];
$cordonne['fid']=$_POST['clientFid'];
$cordonne['codebarre']=$_POST['codebarre'];
$res = $client->call('InsertUser',array('cordonne'=>$cordonne));
print_r($res);
Nothing is display.

Please use the correct array keys in the definition of complextype array
$server->wsdl->addComplexType(
'cordonne',
'complexType',
'struct',
'all',
'',
array(
'id'=> array('name' => 'id', 'type' => 'xsd:int'),
'prenom'=> array('name' => 'prenom', 'type' => 'xsd:string'),
'lastname'=> array('name' => 'lastname', 'type' => 'xsd:string'),
'datedebut'=> array('name' => 'datedebut', 'type' => 'xsd:date'),
'solde'=> array('name' => 'solde', 'type' => 'xsd:decimal'),
'identifient'=> array('name' => 'identifient', 'type' => 'xsd:string'),
'photo' => array('name' => 'photo', 'type' => 'xsd:string'),
'fid'=> array('name' => 'fid', 'type' => 'xsd:int'),
'codebarre' => array('name' => 'codebarre', 'type' => 'xsd:string')
));
And instead of passing the array with key to the server just send the array without key
$res = $client->call('InsertUser',array($cordonne));

Related

create dynamic multidimensional array using PHP

I want to create dynamic multidimensional array using PHP
I need to generate array like this ...
$fetchMenu = array('page-1' => array(
'name' => 'first_page',
'label' => 'First page 2',
'route' => 'product_index',
'pages' => array(
array(
'name' => 'xxx',
'label' => 'xxx',
'route' => 'product_index',
), array(
'id' => 'permissions',
'label' => 'Permissions',
'title' => 'Permissions',
'route' => 'product_add',
'menu_tree_path' => 'default|system|roles_and_permission|permissions',
'display_in_menu' => true,
)
),
),
'page-2' => array(
'name' => 'second_page',
'label' => 'Second page 2',
'route' => 'product_index',
'pages' => array(),
),);
How can I do it ?
something like this?
$dynMenu = array();
$bookLength = 5; //function getBookLength() ??
for($i=0;$i<$bookLength;$i++){
$pageNumber = 'page'.$i;
$page = $i; // function getPages() ??
$dynMenu[$pageNumber] = array('name' => 'foo', 'label' => 'bar');
for($j=0;$j<$page;$j++){
$dynMenu[$pageNumber][$j] = array('name' => 'foo-ish', 'label' => 'bar-ish');
}
}

NuSOAP returns empty array

I have the problem, that the NuSOAP server returns an empty array. I read and tried a lot of topics/things already but the result is always the same. I guess its only a minor thing you guys can solve within a minute.
I want to put an array of strings containing client information into another array that holds all servers:
Array
(
[Client1] => Array ([HostName] => 'TestHostName', [IP] => '1.1.1.1'),
[Client2] => Array ([HostName] => 'TestHostName', [IP] => '2.2.2.2'),
[Client3] => Array ([HostName] => 'TestHostName', [IP] => '3.3.3.3')
)
The arrays will get filled from mysql data, but for testing purposes I created a static array with data. Here is what I have got so far:
<?php
require_once ('lib/nusoap.php');
require('mysql.php');
$ServerName = 'server';
$ServiceName = 'CentralConfigService';
$ServiceURL = 'http://' . $ServerName . '/' . $ServiceName;
$Server = new soap_server();
$Server -> configureWSDL($ServiceName, $ServerName . '/' . $ServiceName);
function GetClientInfo($ClientName)
{
$Clients = array();
$ClientInfo = array(
'HostName' => 'testiname',
'IP' => 'testip',
'Type' => 'testtype',
'Config' => 'testconfig',
'Routines' => 'testroutines',
'Files' => 'testfiles',
'Access' => 'testaccess');
$Clients[$ClientName] = $ClientInfo;
return $Clients;
}
$Server -> wsdl -> addComplexType(
'ClientInfo',
'complexType',
'struct',
'sequence',
'',
array(
'HostName' => array('name' => 'HostName', 'type' => 'xsd:string'),
'IP' => array('name' => 'IP', 'type' => 'xsd:string'),
'Type' => array('name' => 'Type', 'type' => 'xsd:string'),
'Config' => array('name' => 'Config', 'type' => 'xsd:string'),
'Routines' => array('name' => 'Routines', 'type' => 'xsd:string'),
'Files' => array('name' => 'Files', 'type' => 'xsd:string'),
'Access' => array('name' => 'Access', 'type' => 'xsd:string')
)
);
$Server -> wsdl -> addComplexType(
'Clients',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ClientInfo')
),
'tns:Clients'
);
$Server -> register(
'GetClientInfo',
array('HostName' => 'xsd:string'),
array('return' => 'tns:Clients'),
$ServiceURL,
$ServiceURL . '#GetClientInfo',
'rpc',
'encoded',
'Get config by type');
if ( !isset( $HTTP_RAW_POST_DATA ) ) $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
#$Server -> service($HTTP_RAW_POST_DATA);
?>
when I call the function "GetClientInfo", I always get an empty array:
Array
(
[0] => Array
(
[0] => Array
(
)
[1] => Array
(
)
[2] => Array
(
)
[3] => Array
(
)
[4] => Array
(
)
[5] => Array
(
)
[6] => Array
(
)
)
)
The client calls the function:
<?php
require_once('lib/nusoap.php');
$wsdl = "http://server/server.php?wsdl";
$client = new nusoap_client($wsdl, 'wsdl');
$result = $client -> call('GetClientInfo', array('ClientName'=>'Client1'));
print_r($result);
?>
Sorry for the long post. I hope it contains all necessary information.
Thanks a lot in advance!
Cheers,
Daniel
I found my mistake. The complexType that includes the struct has to look like that:
$Server -> wsdl -> addComplexType(
'Clients',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ClientInfo')
),
'tns:ClientInfo'
So 'tns:ClientInfo' instead of 'tns:Clients' in the last line.
Here is a fully functioning example:
server.php
<?php
// Includes
require_once ('lib/nusoap.php');
require('mysql.php');
require('cc_functions.php');
// General SOAP configuration
$ServerName = 'server';
$ServiceName = 'CentralConfigService';
$ServiceURL = 'http://' . $ServerName . '/' . $ServiceName;
$Server = new soap_server();
$Server -> configureWSDL($ServiceName, $ServerName . '/' . $ServiceName);
function GetClientInfo($ClientName)
{
$Clients = array();
$Clients1 = array(
'HostName' => 'testiname',
'IP' => 'testip',
'Type' => 'testtype',
'Config' => 'testconfig',
'Routines' => 'testroutines',
'Files' => 'testfiles',
'Access' => 'testaccess');
$Clients2 = array(
'HostName' => 'testiname2',
'IP' => 'testip2',
'Type' => 'testtype2',
'Config' => 'testconfig2',
'Routines' => 'testroutines2',
'Files' => 'testfiles2',
'Access' => 'testaccess2');
array_push($Clients, $Clients1);
array_push($Clients, $Clients2);
return $Clients;
}
$Server -> wsdl -> addComplexType(
'ClientInfo',
'complexType',
'struct',
'all',
'',
array(
'ID' => array('name' => 'ID', 'type' => 'xsd:integer'),
'HostName' => array('name' => 'HostName', 'type' => 'xsd:string'),
'IP' => array('name' => 'IP', 'type' => 'xsd:string'),
'Type' => array('name' => 'Type', 'type' => 'xsd:string'),
'Config' => array('name' => 'Config', 'type' => 'xsd:string'),
'Routines' => array('name' => 'Routines', 'type' => 'xsd:string'),
'Files' => array('name' => 'Files', 'type' => 'xsd:string'),
'Access' => array('name' => 'Access', 'type' => 'xsd:string')
)
);
$Server -> wsdl -> addComplexType(
'Clients',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ClientInfo[]')
),
'tns:ClientInfo'
);
$Server -> register(
'GetClientInfo',
array('ClientName' => 'xsd:string'),
array('return' => 'tns:Clients'),
$ServiceURL,
$ServiceURL . '#GetClientInfo',
'',
'rpc',
'Get config by type');
if (!isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = file_get_contents('php://input');
#$Server -> service($HTTP_RAW_POST_DATA);
?>
client.php
<?php
require_once('lib/nusoap.php');
$wsdl = "http://server/server.php?wsdl";
$client = new nusoap_client($wsdl, 'wsdl');
$result = $client -> call('GetClientInfo', array('ClientName'=>''));
print_r($result);
?>

Rendering and process same form twice in Zend Framework 2?

I have a requirement of rendering and processing the same form again if user check a select box. I looked into form collections but it didn't exactly access my problem because I don't need to render a set of fields instead my requirement is to render the complete form again. So what I added another function getClone($prefix) to get the clone of form which returns me the clone of form object after adding a prefix in the name of form. Like this
<?php
namespace Company\Form;
use Zend\Form\Form;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;
class CompanyAddress extends Form implements InputFilterAwareInterface {
protected $inputFilter;
public function __construct($countries, $name = 'null') {
parent::__construct('company_address');
$this->setAttribute('method', 'post');
$this->setAttribute('id', 'company_address');
$this->add(array(
'name' => 'street_1',
'attributes' => array(
'id' => 'street_1',
'type' => 'text',
),
'options' => array(
'label' => 'Street *',
)
));
$this->add(array(
'name' => 'street_2',
'attributes' => array(
'id' => 'street_2',
'type' => 'text',
),
'options' => array(
'label' => 'Street 2',
)
));
$this->add(array(
'name' => 'country_id',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'id' => 'country_id',
),
'options' => array(
'label' => 'Country',
'value_options' => $countries
)
));
$this->add(array(
'name' => 'city_id',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'id' => 'city_id',
),
'options' => array(
'label' => 'City ',
'value_options' => array()
)
));
$this->add(array(
'name' => 'zip',
'attributes' => array(
'id' => 'zip',
'type' => 'text',
),
'options' => array(
'label' => 'ZIP',
'value_options' => array()
)
));
$this->add(array(
'name' => 'address_type',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'id' => 'zip',
),
'options' => array(
'label' => 'Type',
'value_options' => array(
'' => 'Select Type',
'default' => 'Default',
'invoice' => 'Invoice',
'both' => 'Both',
)
)
));
}
public function getClone($prefix){
$form = clone $this;
foreach($form->getElements() as $element){
$name = $element->getName();
$element->setName("$prefix[$name]");
}
return $form;
}
public function getInputFilter() {
if (!$this->inputFilter) {
$inputFilter = new InputFilter();
$factory = new InputFactory();
$inputFilter->add($factory->createInput(array(
'name' => 'street_1',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'Street cannot be empty'),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'street_2',
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'city_id',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'City cannot be empty'),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'country_id',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'Country cannot be empty'),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'zip',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'ZIP cannot be empty'),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'address_type',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'Address Type cannot be empty'),
),
),
)));
$this->inputFilter = $inputFilter;
}
return $this->inputFilter;
}
}
and than in my action I did this
public function testAction() {
$countries = $this->getServiceLocator()->get('Country')->getSelect();
$companyAddressForm = new CompanyAddressForm($countries);
$clone = $companyAddressForm->getClone('address2');
if($this->request->isPost()){
$data = $this->request->getPost();
$companyAddressForm->setData($data);
$clone->setData($data['address2']);
$isFormOneValid = $companyAddressForm->isValid();
//$isFormTwoValid = $clone->isValid();
}
$view = new ViewModel();
$view->companyAddressForm = $companyAddressForm;
$view->clone = $clone;
return $view;
}
This is working as I expected it to work, forms are rendering and validating correctly, I want to know whether it is a correct way or a hack?
If both of the forms are exactly the same then you don't need to declare and validate two forms in the controller action.
Reason:
If there are two forms rendered your HTML page. Only one of the forms can be posted by the users at a time and you need to validate only one form at a time. What you are doing now is to validate the same form with the same post data over again. So either $isFormOneValid, $isFormTwoValid are both true or both false.
Instead, declare only one form, render it twice in your view, and upon post, validate it with the post data. If the two forms differ in properties, filters, validators, etc. then you can create two methods like $form->applyForm1Validarots() and $form->applyForm2Validarots, check the value of your select element, and call the appropriate method to apply the validaorts / filters before calling isValid() on it.
Hope I helped

How To Do Conditional Put for SimpleDB Using AWS SDK For PHP Version 2

I have the following code which inputs new items into a domain for SimpleDB. I am using AWS SDK For PHP Version 2.
$client->putAttributes(array(
'DomainName' => $domainName,
'ItemName' => $uniqueid,
'Attributes' => array(
array('Name' => 'USER_ID', 'Value' => $uniqueid, 'Replace' => true),
array('Name' => 'EMAIL', 'Value' => $email, 'Replace' => true),
array('Name' => 'CREATED', 'Value' => $date, 'Replace' => true),
array('Name' => 'LAST_UPDATED', 'Value' => $date, 'Replace' => true),
)
));
How do I do a conditional put? I want the conditional to be that EMAIL does not exist. It's something like:
Expected.Name => EMAIL Expected.Exists => False but I don't know the syntax.
Here is a link to the API Docs. I don't understand them well enough to implement this.
http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.SimpleDb.SimpleDbClient.html#_putAttributes
Thanks!
This seems to work. I am now getting a conditional check failed error.
$client->putAttributes(array(
'DomainName' => $domainName,
'ItemName' => $uniqueid,
'Attributes' => array(
array('Name' => 'USER_ID', 'Value' => $uniqueid, 'Replace' => true),
array('Name' => 'EMAIL', 'Value' => $email, 'Replace' => true),
array('Name' => 'CREATED', 'Value' => $date, 'Replace' => true),
array('Name' => 'LAST_UPDATED', 'Value' => $date, 'Replace' => true),
),
'Expected' => array('Name' => 'EMAIL', 'Exists' => false),
));

nusoap server multi dimensional array not being returned

Hi I have a soap server written in nusoap that should return an array like:
Array
(
[Learner_Detail] => Array
(
[Learner_Id] => 09070567
[Known_As] => Aaron
[Name] => Mr Aaron Hawley
[Year] => 2011
[Tutor_Name] =>
[Prior_Institution] => Bishop of Rochester Academy
[Employer_Name] =>
[Gender] => Male
[Ethnicity] => White - English / Welsh / Scottish / Northern Irish / British
[Nationality] => UNITED KINGDOM
[DOB] => 07 Jul 1995
[Age_at_end_of_Aug] => 16
)
[Other] => Array
(
[NI_Number] =>
[ULN] => 7966088560
[University_Number] =>
[LLDHP] => No Disability
)
)
I have the following code to setup and register my server
$server->wsdl->addComplexType(
'Learner_Details',
'complexType',
'struct',
'all',
'',
array(
'Learner_Id' => array('name' => 'Learner_Id', 'type' => 'xsd:string'),
'Known_As' => array('name' => 'Known_As', 'type' => 'xsd:string'),
'Name' => array('name' => 'Name', 'type' => 'xsd:string'),
'Year' => array('name' => 'Year', 'type' => 'xsd:string'),
'Tutor_Name' => array('name' => 'Tutor_Name', 'type' => 'xsd:string'),
'Prior_Institution' => array('name' => 'Prior_Institution', 'type' => 'xsd:string'),
'Employer_Name' => array('name' => 'Employer_Name', 'type' => 'xsd:string'),
'Gender' => array('name' => 'Gender', 'type' => 'xsd:string'),
'Ethnicity' => array('name' => 'Ethnicity', 'type' => 'xsd:string'),
'Nationality' => array('name' => 'Nationality', 'type' => 'xsd:string'),
'DOB' => array('name' => 'DOB', 'type' => 'xsd:string'),
'Age_at_end_of_Aug' => array('name' => 'Age_at_end_of_Aug', 'type' => 'xsd:string'),
)
);
$server->wsdl->addComplexType(
'Contact_Details',
'complexType',
'struct',
'all',
'',
array(
'Email' => array('name' => 'Email', 'type' => 'xsd:string'),
'Mobile_Tel' => array('name' => 'Mobile_Tel', 'type' => 'xsd:string'),
'Home_Phone' => array('name' => 'Home_Phone', 'type' => 'xsd:string'),
'Daytime_Phone' => array('name' => 'Daytime_Phone', 'type' => 'xsd:string'),
'Emergency_Home_Tel' => array('name' => 'Emergency_Home_Tel', 'type' => 'xsd:string'),
'SCON_Daytime_Number' => array('name' => 'SCON_Daytime_Number', 'type' => 'xsd:string'),
'Emergency_Mobile' => array('name' => 'Emergency_Mobile', 'type' => 'xsd:string'),
'EMR_Relationship_to_Learner' => array('name' => 'EMR_Relationship_to_Learner', 'type' => 'xsd:string'),
'Prior_Attainment_Level' => array('name' => 'Prior_Attainment_Level', 'type' => 'xsd:string'),
'Address_1' => array('name' => 'Address_1', 'type' => 'xsd:string'),
'Address_2' => array('name' => 'Address_2', 'type' => 'xsd:string'),
'Address_3' => array('name' => 'Address_3', 'type' => 'xsd:string'),
'Address_4' => array('name' => 'Address_4', 'type' => 'xsd:string'),
'Address_5' => array('name' => 'Address_5', 'type' => 'xsd:string'),
'Country' => array('name' => 'Country', 'type' => 'xsd:string'),
'Postcode' => array('name' => 'Postcode', 'type' => 'xsd:string'),
'GNAL_to_Date' => array('name' => 'GNAL_to_Date', 'type' => 'xsd:string'),
'EMAL_EMA_Number' => array('name' => 'EMAL_EMA_Number', 'type' => 'xsd:string'),
'EMAL_ALG_Ref' => array('name' => 'EMAL_ALG_Ref', 'type' => 'xsd:string'),
'Left_College' => array('name' => 'Left_College', 'type' => 'xsd:string'),
'Rest_Use' => array('name' => 'Rest_Use', 'type' => 'xsd:string'),
'Student_Status' => array('name' => 'Student_Status', 'type' => 'xsd:string'),
'CoD' => array('name' => 'CoD', 'type' => 'xsd:string'),
)
);
$server->wsdl->addComplexType(
'Other',
'complexType',
'struct',
'all',
'',
array(
'NI_Number' => array('name' => 'NI_Number', 'type' => 'xsd:string'),
'ULN' => array('name' => 'ULN', 'type' => 'xsd:string'),
'University_Number' => array('name' => 'University_Number', 'type' => 'xsd:string'),
'LLDHP' => array('name' => 'LLDHP', 'type' => 'xsd:string'),
)
);
$server->wsdl->addComplexType(
'OtherArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Other[]')
),
'tns:Other'
);
$server->wsdl->addComplexType(
'Learner_DetailsArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Learner_Details[]')
),
'tns:Learner_Details'
);
$server->wsdl->addComplexType(
'Contact_DetailsArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Contact_Details[]')
),
'tns:Contact_Details'
);
$server->wsdl->addComplexType(
'totalInfo',
'complexType',
'struct',
'all',
'',
array(
'Learner_Details' => array('name' => 'Learner_Details', 'type' => 'tns:Learner_DetailsArray'),
'Contact_Details' => array('name' => 'Contact Details', 'type' => 'tns:Contact_DetailsArray'),
'Other' => array('name' => 'Other', 'type' => 'tns:OtherArray'),
)
);
$server->register(
'getStudentInfoById3',
array('name' => 'xsd:string'),
array('return' => 'tns:totalInfo'),
$namespace
);
I have a function that gets data from sql, feeds it into and array and then returns is the soap server. I have checked this code and know that it is returning an aaray as it should.
However when a test the service via soap ui I don't get my array returned in the xml. In stead I just get
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://xmlservicesdev.midkent.ac.uk/soap/Course">
I read the documentation and several tutorials and examples but I can't seem to get this working correctly. Can anyone help please?

Categories