delphi7调用.net编写的webservice出现奇怪异常 ( 积分: 100 )

  • 主题发起人 yangliuhh
  • 开始时间
Y

yangliuhh

Unregistered / Unconfirmed
GUEST, unregistred user!
问题描述:
.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都很正常的
 
有人知道原因吗?
 
有人知道嗎??怎麽都不回一下啊。。。。。
 
5555555555555555555
 
WideString(s:string;);你用这个把你发送的STINRG转化一下再试试
 
觉得服务端写得也有问题, 未将对象引用设置到对象的实例。
 
"WideString(s:string;);你用这个把你发送的STINRG转化一下再试试 "

早就试过了,没用

大家可以自己试一下的
.net开发的webservice访问地址为:http://218.4.155.114:99/WebService/EntInterface.asmx?WSDL
 
我说,服务端有没有问题啊,觉得你的服务端有问题,,因为提示的错误是服务端的错
'未将对象引用设置到对象的实例'这是.NET最明显的最常见的错误之一
 
顶部