0
我目前正在從一個表單發出一個SOAP請求,我似乎無法正常工作。我已經檢查並且仔細檢查了我的測試值是否正確,並且看起來沒有任何區別。SOAP請求 - 錯誤:0服務器無法處理請求。 --->值不能爲空。參數名稱:g
我得到:
「錯誤:0服務器無法處理請求--->值不能爲空 參數名:。G」
每當我試圖提交SOAP API 。 這是我的代碼(它是在Joomla MVC組件結構中,因此我將挑選出相關的代碼):
這是我的控制器窗體,它從窗體獲取輸入字段並將它們放入要發送到的數組中在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);
}
並調用相應的SOAP功能的模型功能:
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);
}
正如你可以看到我已經確保所有領域都投入實際或測試數據和方法存在。此外,所有需要的領域都是必需的。 我不知道爲什麼這不起作用,谷歌搜索還沒有能夠解決我的問題。現在已經過去了一兩天,希望有人能夠幫助到這裏! 謝謝 James
嗨,感謝您的回覆。我確保所有數據都是正確的,而且似乎可行,但現在已經出現了新的錯誤!錯誤:0服務器無法處理請求。 --->對象引用未設置爲對象的實例。 – devoncrazylegs
這就是答案。原來我的前兩個元素不是正確的類型。謝謝! – devoncrazylegs