I am currently making a SOAP request from a form that I cannot seem to get working correctly. I have checked and double checked that my test values are correct and it doesn't seem to make any difference at all.
I get:
"Error: 0 Server was unable to process request. ---> Value cannot be null. Parameter name: g"
whenever I try and submit to the SOAP api. Here is my code (it is within Joomla MVC component structure so I will pick out the relevant code):
Here is my contoller form that takes the input fields from the form and puts them in an array to be sent to the SOAP api:
public function submitForm1 () {
$input = JFactory::getApplication()->input;
$postVar = array();
//$time = date("m-d- G-i-s", $_POST['dob']);
$postVar['title'] = $input->get('title', null, 'string');
$postVar['firstname'] = $input->get('firstname', null, 'string');
$postVar['lastname'] = $input->get('lastname', null, 'string');
$postVar['email'] = $input->get('email', null, 'string');
$postVar['mobile'] = $input->get('mobile', null, 'string');
$postVar['home'] = $input->get('home', null, 'string');
//'dob' needs to be amended
$postVar['dob'] = date("Y-m-d",strtotime(time()));
$postVar['addline1'] = $input->get('addline1', null, 'string');
$postVar['addline2'] = $input->get('addline2', null, 'string');
$postVar['addline3'] = $input->get('addline3', null, 'string');
$postVar['town'] = $input->get('town', null, 'string');
$postVar['county'] = $input->get('county', null, 'string');
$postVar['postcode'] = $input->get('postcode', null, 'string');
$postVar['gender'] = $input->get('gender', null, 'string');
//'membertype' needs to be amended
$postVar['membertype'] = "test";
$postVar['gymguid'] = $input->get('gymguid', null, 'string');
$postVar['rateguid'] = $input->get('rateguid', null, 'string');
//These questions need to be amended
$postVar['WheredidyouhearaboutFitspace'] = "test";
$postVar['Whydoyouwantojointhegym'] = "test";
$postVar['socialfacebook'] = "test";
$postVar['socialtwitter'] = "test";
$postVar['socialfoursquare'] = "test";
//These dd details need to be amended
$postVar['DDrefnum'] = "test";
$postVar['promoguid'] = "test";
$postVar['DDfirstpayment'] = date("Y-m-d",strtotime(time()));
$postVar['StartofCurrentCon'] = date("Y-m-d",strtotime(time()));
$postVar['DDdayofmonth'] = 0; //Int
if(isset($postVar['student'])) {
$postVar['student'] = $input->get('student', null, 'int');;
} else {
$postVar['student'] = 0;
}
$postVar['PT'] = 0;
$postVar['ContactOptOut'] = 0;
$postVar['gyminductiondeclined'] = 0;
$postVar['Pinrequired'] = 0;
$model = $this->getModel('signup');
$model->submitForm1($postVar);
}
and the model function which calls the appropriate SOAP function:
public function submitForm1($postVar) {
$client = $this->createSoapRequest();
$url = 'https://webservice.com/MHservice.asmx?WSDL';
$options["connection_timeout"] = 25;
$options["location"] = $url;
$options['trace'] = 1;
$options['style'] = SOAP_RPC;
$options['use'] = SOAP_ENCODED;
$client = new SoapClient($url, $options);
$response = $client->FITaddupdatemember($postVar);
}
As you can see I have ensured that all fields have real or test data put in and the method exists. Also, all fields thar are required have been required. I have no idea why this isn't working and Google searches have not been able to solve my problem. It's been a day or two now and was hoping somebody maybe able to help on here! Thanks James