delphi7调用.net编写的webservice出现奇怪异常

yangliu690 2007-08-15 11:21:48
问题描述:
.net开发的webservice访问地址为:http://218.4.155.114:99/WebService/EntInterface.asmx?WSDL

用delphi7编写客户端程序,访问此webservice出现奇怪错误。
先file-new-other-webservice 选择wsdl importer 输入“http://218.4.155.114:99/WebService/EntInterface.asmx?WSDL”
生成单元文件EntInterface。有三个函数可以调用
function SendMessage(const strLoginCode: WideString; const strPass: WideString; const strSpNum: WideString; const strRecvNum: WideString; const strMsg: WideString; const bConfirm: Integer; const AtDate: WideString): WideString; stdcall;
function RecvMessage(const strLoginCode: WideString; const strPass: WideString): WideString; stdcall;
function GetStatus(const strLoginCode: WideString; const strPass: WideString; const strSendID: WideString): WideString; stdcall;


然后使用THTTPRIO调用webservice的函数
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
HTTPRIO1.HTTPWebNode.UseUTF8InHeader := true;
HTTPRIO1.URL := 'http://218.4.155.114:99/WebService/EntInterface.asmx';
s := (HTTPRIO1 as EntInterfaceSoap).SendMessage('aa','bb','55','0123456','aaa',0,'');
Button1.Caption := s;
end;

1.调用SendMessage函数时出现下列异常
发送消息出现错误 System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.NullReferenceException: 未将对象引用设置到对象的实例。
at qxtweb.WebService.EntInterface.SendMessage(String strLoginCode, String strPass, String strSpNum, String strRecvNum, String strMsg, Int32 bConfirm, String AtDate)
--- 内部异常堆栈跟踪的结尾 --

2.调用GetStatus函数出现下列异常
发送消息出现错误 System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.ArgumentNullException: String 引用没有设置为 String 的实例。
参数名: s
at System.Text.UTF8Encoding.GetBytes(String s)
at TZCT.DB.SetRSAPass.Encrypting(String Source, String Key)
at qxtweb.WebService.EntInterface.RecvMessage(String strLoginCode, String strPass)
--- 内部异常堆栈跟踪的结尾 --

3.调用RecvMessage函数出现下列异常
发送消息出现错误 System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.ArgumentNullException: 值不能为空。
参数名: input
at System.Text.RegularExpressions.Regex.IsMatch(String input)
at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern)
at TZCT.DB.BaseFunction.IsUnsign(String str)
at qxtweb.WebService.EntInterface.GetStatus(String strLoginCode, String strPass, String strSendID)
--- 内部异常堆栈跟踪的结尾 ---


请高手帮忙看看怎么解决这个问题啊?
以前用delphi7调用webservice都很正常的
...全文
711 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
niuxuanhu 2008-05-05
  • 打赏
  • 举报
回复
估计delphi7的控件和webservice的版本对不上
niuxuanhu 2008-05-05
  • 打赏
  • 举报
回复
我也碰到了这个问题,是服务器的问题,用c#调用就没问题
CYDong0423 2007-08-18
  • 打赏
  • 举报
回复
你这个问题我也遇到过
未将对象引用设置到对象的实例-------这个提示就是webservice中不存在这个函数或是你的函数名称和他的不对应。
如果你是用file-new-other-webservice新建webservice是应该不会有错了。那就可能是webservice的错误了。
我是这样用的
type
TWebServiceInterface = class (TObject)
private
RIO: THttpRIO;
EntSOAP: EntInterfaceSoap;
public
constructor Create;overload;
end;
var
objWSI: TWebServiceInterface ;

implementation


constructor TWebServiceInterface.Create;
begin
RIO := THttpRIO.Create(Application);
EntSOAP:= GetClientAppServiceSoap(True,'',RIO);
end;


EntSOAP.调用函数

hangzhou_hammer 2007-08-15
  • 打赏
  • 举报
回复
高手吃饭去了~~^0^ 我来听听课
yangliu690 2007-08-15
  • 打赏
  • 举报
回复
有高手吗?
yangliu690 2007-08-15
  • 打赏
  • 举报
回复
这个问题很奇怪,会不会是webservice本身的问题?
yangliu690 2007-08-15
  • 打赏
  • 举报
回复
呵呵,webserice_viod是?
兄弟,可以在讲详细点吗?
brightyang 2007-08-15
  • 打赏
  • 举报
回复
var clint:webserice_viod;


clint:=flogin.httprio1 as webserice_viod;
yangliu690 2007-08-15
  • 打赏
  • 举报
回复
InvRegistry.RegisterInvokeOptions(TypeInfo(TouchNetServiceSoap), ioDocument);
生成单元文件的时候就有了
robin100 2007-08-15
  • 打赏
  • 举报
回复
加上这句试试。InvRegistry.RegisterInvokeOptions(TypeInfo(TouchNetServiceSoap), ioDocument);
其中 TouchNetServiceSoap 是你服务的名称
zzzzzllllll 2007-08-15
  • 打赏
  • 举报
回复
服务器有问题
yangliu690 2007-08-15
  • 打赏
  • 举报
回复
大家可以自己试一下的
.net开发的webservice访问地址为:http://218.4.155.114:99/WebService/EntInterface.asmx?WSDL
yangliu690 2007-08-15
  • 打赏
  • 举报
回复
人气不旺阿
yangliu690 2007-08-15
  • 打赏
  • 举报
回复
5555555555555555

1,593

社区成员

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

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