Delphi调用Java的WebService报错

Yothan 2011-02-14 04:58:47
合作伙伴写了一些处理逻辑在WebService中,wsdl地址为:https://114.255.245.64:8080/Crm/services/clienttrade?wsdl
我用delphi新建一个WebService的WSDL Import,生成一个文件后,调用报错,谁能帮忙:
调用:
procedure TForm1.btn2Click(Sender: TObject);
var
x: THTTPRIO;

InterfaceVariable: clienttradePortType;
begin
X :=THTTPRio.Create(Application);
x.HTTPWebNode.UseUTF8InHeader:=true;
x.WSDLLocation:= 'https://114.255.245.64:8080/Crm/services/clienttrade?wsdl';
InterfaceVariable := X as clienttradePortType;
showmessage(InterfaceVariable.SayHello);
end;
报错信息有时是“证书作者不支持。。”、“Empty Document"
郁闷。

另外,在WSDL Import导入的时候,点击Next有时会出现:
Unable to load WSDL File/Location: https://114.255.245.64:8080/Crm/services/clienttrade?wsdl. Error [灾难性故障].
...全文
400 16 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
无条件为你 2011-02-18
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 yueyun889 的回复:]
未解决。算了,我结贴了。
[/Quote]
既然未解决,为何给分不公平?
Yothan 2011-02-17
  • 打赏
  • 举报
回复
未解决。算了,我结贴了。
manfeng 2011-02-16
  • 打赏
  • 举报
回复
不是导入CA就行的,要完全没有错误才行,包括域名和证书授予的用户名称一致,证书在有效期范围内,证书可信,楼主的url是直接用ip的,估计域名和证书授予的用户名称一致这一点就过不了。
Yothan 2011-02-16
  • 打赏
  • 举报
回复
顶起。
kye_jufei 2011-02-15
  • 打赏
  • 举报
回复
測試結果,需要憑證。。。。
无条件为你 2011-02-15
  • 打赏
  • 举报
回复
与C#通讯实现上传文件的webservice我有,java的没有。
Yothan 2011-02-15
  • 打赏
  • 举报
回复
webservice使用的人太少。
haitao 2011-02-15
  • 打赏
  • 举报
回复
唉,xml、webservice
bdmh 2011-02-15
  • 打赏
  • 举报
回复
跟他 要个证书,加载上这个证书试试
Yothan 2011-02-15
  • 打赏
  • 举报
回复
不是吧,一个回复都没有?
Yothan 2011-02-15
  • 打赏
  • 举报
回复
可否设置信任所有凭证?我用的是Delphi7
alan_xxq 2011-02-15
  • 打赏
  • 举报
回复
樓上正解,這個wsdl確實需要加載ca憑證。。。
kye_jufei 2011-02-15
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 yueyun889 的回复:]
引用 6 楼 kye_jufei 的回复:
測試結果,需要憑證。。。。

你试过?还是看我的报错得出的?请大侠指点。
[/Quote]
需要安装一个CA的凭证。。。
Yothan 2011-02-15
  • 打赏
  • 举报
回复
恩,多谢楼上,原来自己写一个单元也行的。
那报错真是因为凭证?
mynameis_007 2011-02-15
  • 打赏
  • 举报
回复
WSDL Import不能生成,就自己写
请参考,
就这么调用GetOrlServicePortType.GetPorts()


unit OrlWebService;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type
OrlServicePortType = interface(IInvokable)
['{76B1606E-9B05-4FE0-AD1E-55393C25E5BB}']
function GetPorts(const userName: WideString; const password: WideString): WideString; stdcall;
end;

function GetOrlServicePortType(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): OrlServicePortType;

implementation

function GetOrlServicePortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): OrlServicePortType;
const
defWSDL = 'http://192.168.1.27:8080/axis2/services/OrlService?wsdl';
defURL = 'http://192.168.1.27:8080/axis2/services/OrlService';
defSvc = 'OrlService';
defPrt = 'OrlServicePortType';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
begin
RIO := THTTPRIO.Create(nil);
end
else
RIO := HTTPRIO;
try

Result := (RIO as OrlServicePortType);
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;

initialization
InvRegistry.RegisterInterface(TypeInfo(OrlServicePortType), 'http://service.nineOrl.com', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(OrlServicePortType), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(OrlServicePortType), ioDocument);
end.
Yothan 2011-02-15
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 kye_jufei 的回复:]
測試結果,需要憑證。。。。
[/Quote]
你试过?还是看我的报错得出的?请大侠指点。

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧