我有一个带有单个函数getProd()的wsdl,它接受一个字符串参数并且有一个SOAPaction getProd。我已经能够使用NuSoap和SoapClient来使用web服务。但是无论何时我尝试使用curl消耗它,我都会为getProd()保持错误缺失参数1。请帮忙。我之前使用curl来使用其他Web服务所以我不知道问题是什么。
这是我的代码
$soap_do = curl_init();
$post_string = "books";
curl_setopt($soap_do, CURLOPT_URL, "http://localhost/wsdl/post.php?wsdl" );
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_TIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true );
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, array(
'Content-Type: string; charset=utf-8',
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: getProd",
'Content-Length: '.strlen($post_string)
) );
$response = curl_exec($soap_do);
echo $response;
echo curl_error($soap_do);
答案 0 :(得分:0)
解决。我意识到NuSoap和SoapClient会自动添加所需的肥皂信封。虽然您在使用Curl时手动执行此操作