【发布时间】:2014-08-13 17:54:19
【问题描述】:
我目前正在开发一种方法,将 Saba 中的“忘记密码”功能与 SSO 结合使用,但无需直接访问 Saba 网站。
我在尝试访问 Saba Web 服务时遇到了问题,目前我遇到了问题。
我得到的 var_dump 错误如下:
string(544) " ns1:Server.NoService The AXIS engine could not find a target service to invoke! targetService is InfoService/cspsRetrievePassword "
以下是详细信息:
Saba 的构建方式无法在自定义 Web 服务上使用 REST,只能使用 SOAP。 我在表单提交上调用了以下函数:
public function doPasswordRetrieval($pId, $pAction, $pNewPassword, $pOldPassword, $pIsOldPasswordHashed, $pSecretQ, $pSecretA, $pSendMail){
if($this->isAuthenticated()) {
$soapenv = 'http://schemas.xmlsoap.org/soap/envelope/';
$soapcommand = 'cspsRetrievePassword';
$soapurl = "https://mydomain/axis/services/InfoService";
$soapcert = $this->getCertificate();
$soapqryid = $pId;
$soapqryact = $pAction;
$soapqrynewp = $pNewPassword;
$soapqryoldp = $pOldPassword;
$soapqryphash = $pIsOldPasswordHashed;
$soapqrysecq = $pSecretQ;
$soapqryseca = $pSecretA;
$soapqrymail = $pSendMail;
$soapqry = '<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="' . $soapenv . '">';
$soapqry .= '<SOAP-ENV:Body>';
$soapqry .= '<saba:' . $soapcommand . ' xmlns:saba="' . $soapurl . '">';
$soapqry .= '<certificate>' . $soapcert . '</certificate>';
$soapqry .= '<id>' . $soapqryid . '</id>';
$soapqry .= '<action>' . $soapqryact . '</action>';
$soapqry .= '<newPass>' . $soapqrynewp . '</newPass>';
$soapqry .= '<oldPass>' . $soapqryoldp . '</oldPass>';
$soapqry .= '<isOldPasswordHashed>' . $soapqryphash . '</isOldPasswordHashed>';
$soapqry .= '<secretQuestion>' . $soapqrysecq . '</secretQuestion>';
$soapqry .= '<secretAnswer>' . $soapqryseca . '</secretAnswer>';
$soapqry .= '<sendMail>' . $soapqrymail . '</sendMail>';
$soapqry .= '</saba:' . $soapcommand . '>';
$soapqry .= '</SOAP-ENV:Body>';
$soapqry .= '</SOAP-ENV:Envelope>';
$url = $soapurl . '/' . $soapcommand;
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: " . $url,
"Content-length: " . strlen($soapqry),
);
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 10000);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $soapqry);
$response = curl_exec($handle);
curl_close($handle);
var_dump($response);
//return $response;
}
}
SOAP 包装器和 XML 可以用不同的方式编写,而不是添加到字符串中,但我目前处于开发阶段,只是试图使其工作。
我的第一反应是网络服务不存在,但确实存在。
在 saba 中,Web 服务部分:
Name* cspsRetrievePassword
Java Class* csps.CspsRetrievePasswordCommand
如果需要,我可以粘贴我的自定义 java 类,但主要部分都存在
public class CspsRetrievePasswordCommand extends SabaWebCommand
public CspsRetrievePasswordCommand()
throws SabaException
{
addInParam("id", String.class, " person id");
addInParam("action", String.class, "action value");
addInParam("newPass", String.class, " new password ");
addInParam("oldPass", String.class, " old password ");
addInParam("isOldPasswordHashed", String.class, " is old password in hashed format");
addInParam("secretQuestion", String.class, " secret question");
addInParam("secretAnswer", String.class, " secret answer");
addInParam("sendMail", String.class, " send Mail?");
}
public void doExecute(HttpServletRequest request, IXMLVisitor visitor)
我的第二反应是 $url 语法不正确。
我尝试了以下方法,但没有成功:
- /axis/services/InfoService/cspsRetrievePassword
- /axis/services/InfoService?cspsRetrievePassword
- /axis/services/InfoService
最后一个,在 URL 中没有命令的情况下调用 Web 服务,并且仅在 SOAP 查询中给了我一个不同的错误:
string(436) " (70034) Exception in executing info service: @001 java.lang.NullPointerException "
任何帮助将不胜感激。
谢谢!
【问题讨论】: