德尔福 XE +肥皂+ SSL协议
我有一个在 Delphi 2009 上编写的程序。它使用 SOAP over HTTP over SSL。因此,正是 SOAP 请求触发了 HTTP 请求,该请求由 Microsoft Internet Explorer 通过 DLL 进行处理。然后,MSIE 将弹出一个窗口,要求登录。
但现在我需要在 Delphi XE 中编译它,我遇到了问题。程序不想使用 SSL 登录。根本没有弹出窗口。所以,看来触发器不想工作。
错误出现在这段代码的第二行:
mantis:=GetMantisConnectPortType(false, mantisurl);
mi := mantis.mc_issue_get(username,password,MantisIssue);
错误是
Project IssueReporter.exe raised exception class ESOAPHTTPException with message 'Authorization Required (401) - 'https://***/mantis/api/soap/mantisconnect.php''.
连接过程的列表是
function GetMantisConnectPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): MantisConnectPortType;
const
defWSDL = 'https://***/mantis/api/soap/mantisconnect.php?wsdl';
defURL = 'https://***/mantis/api/soap/mantisconnect.php';
defSvc = 'MantisConnect';
defPrt = 'MantisConnectPort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as MantisConnectPortType);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
的一部分
MantisConnectPortType = interface(IInvokable)
mc_issue_get 是声明
function mc_issue_get(const username: string; const password: string; const issue_id: Int64): IssueData; stdcall;
:在浏览器和 2009 年编译的旧 exe 中一切正常。请帮助解决这个问题。 塔拉斯, 基辅
I have a program that was written on Delphi 2009. It uses SOAP over HTTP over SSL. So it is the SOAP request that triggers an HTTP request, which is handled by Microsoft Internet Explorer via a DLL. MSIE will then make a popup that asks for login.
But now I need to compile it in Delphi XE and I got a problem. program does not want to login in SSL. No popup at all. So, it seems that trigger doesn't want to work.
The error appears in the second line of this code:
mantis:=GetMantisConnectPortType(false, mantisurl);
mi := mantis.mc_issue_get(username,password,MantisIssue);
The error is
Project IssueReporter.exe raised exception class ESOAPHTTPException with message 'Authorization Required (401) - 'https://***/mantis/api/soap/mantisconnect.php''.
Listing of the connection procedure is
function GetMantisConnectPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): MantisConnectPortType;
const
defWSDL = 'https://***/mantis/api/soap/mantisconnect.php?wsdl';
defURL = 'https://***/mantis/api/soap/mantisconnect.php';
defSvc = 'MantisConnect';
defPrt = 'MantisConnectPort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as MantisConnectPortType);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
mc_issue_get is a part of
MantisConnectPortType = interface(IInvokable)
an has the declaration:
function mc_issue_get(const username: string; const password: string; const issue_id: Int64): IssueData; stdcall;
In the browser and in the old exe compiled in 2009 all works fine. Help please to resolve this problem.
Taras, Kyiv
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 Delphi 2009 exe 在您测试 Delphi XE exe 时在同一台电脑上“工作正常”,那么某些代码可能(很可能)在这段时间发生了变化编译Delphi2009.exe的时间和编译DelphiXE.exe的时间相同。
要测试代码是否有问题,请尝试在 Delphi 2009 中重新编译新代码(来自 Delphi XE 版本)并查看是否有效。如果它有效,那么 Delphi XE 处理证书的方式可能与 Delphi 2009 不同。如果它不起作用,则代码已发生重大更改,在这种情况下,您需要调试从证书存储中获取证书的代码。
证书可以安装到内置 Windows 证书存储中的各个位置。有时,人们只需双击并保留证书导入向导中的默认设置(从而选择自动选择证书位置),这可能会导致证书安装在 current_user 的证书存储中。如果发生这种情况,则 exe 将只能在同一 Windows 用户帐户下运行时才能获取证书。
您收到“需要授权”消息这一事实表明存在证书问题。但是,如果您从不同的 PC 进行测试,那么也可能存在防火墙/企业安全问题。
If the Delphi 2009 exe "works fine" from the same pc as you're testing the Delphi XE exe, then some code has probably (most likely) changed between the time the Delphi2009.exe was compiled and the time you compiled the DelphiXE.exe.
To test if the code is the problem, try to recompile new code (from Delphi XE version) in Delphi 2009 and see if that works. If it works, then Delphi XE probably handles certificates differently to Delphi 2009. If it doesn't work then the code has changed substantially, in which case you'll need to debug the code that picks up the certificate from the certificate store.
Certificates can be installed into various locations within the built-in Windows certificate store. Sometimes, people just double-click, and keep the defaults in the certificate import wizard (thereby selecting Automatically choose certificate location) which may result in the certificate being installed in the current_user's certificate store. If that happens, then the exe will only be able to pick up the certificate if running under the same windows user account.
The fact that you got an Authorization Required message points to a certificate issue. However if you're testing from different PC's then there could also be firewall/enterprise security issues.
您的代码在 Delphi XE2 中也可以正常工作,并且“需要授权”可能导致您无法登录 mantis
可能是您更改了自己的 mantis 帐户密码。
Your code works fine also in Delphi XE2 and "Authorization Required" might that you can't login into mantis
May be you changed your own password in mantis account.