我目前正在从一个似乎无法正常工作的表单发出SOAP请求。我检查并仔细检查了我的测试值是否正确,它似乎没有任何差别。
我明白了:
“错误: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);
}
正如您所看到的,我确保所有字段都包含实数或测试数据并且方法存在。此外,还需要所有需要的字段。 我不知道为什么这不起作用,Google搜索无法解决我的问题。现在已经有一两天了,希望有人可以在这里帮忙! 谢谢 詹姆斯
答案 0 :(得分:2)
检查静态数据。还要检查数据类型是否与wsdl文件正确匹配。