PB调用WebService遇到的问题
2013-04-30 13:05
246 查看
今天用PB调用WebService时,遇到了十分不解的问题,我WebService中的方法都使用单元测试验证过的,但用PB调用时,方法中的参数上传到WebService始终是null。(报的异常:System.NullReferenceException: Object reference not set to an instance
of an object)我调用WebService的代码为:
if dw_1.rowcount()
= 0 then
return
cashcarteinfo cartelist[]
cartelist
=dw_1.object.data
cashcarteiteminfo carteitemlist[]
datastore ldst_carteitem
ldst_carteitem= create datastore
ldst_carteitem.dataobject
= 'd_carteitem'
ldst_carteitem.settransobject( sqlca)
ldst_carteitem.retrieve( idt_uptime)
carteitemlist
= ldst_carteitem.object.data
destroy ldst_carteitem
SoapConnection conn
cashservice cashweb
long rVal
conn
= create SoapConnection
rVal
= Conn.CreateInstance(cashweb,
"cashservice","http://localhost/WebService/Service.asmx")
try
string ls
= space(500)
long stationid
stationid
= 1
if cashweb.uploadcarte( cartelist, carteitemlist, stationid,
ref ls)
=true then
Messagebox('','succes')
else
Messagebox('fail',ls)
end
if
catch( SoapException e )
messagebox ("Error",
"Cannot invoke Web service~r~n"+ e.getmessage( ) )
// error handling
end
try
destroy cashweb
destroy conn
经过过反复的调试,终于发现问题所在。我上传的参数是一个结构体数组,在给结构体赋值时,如果结构体的某一字段赋了null,上传到WebService后,整个对象(结构体)都会为null。找到了原因,问题迎刃而解!
另附PB调用WebService调试的方法:
将Vs.Net 的WebService启动调试,让它处于调试状态,并设好WebService的断点;再调试PB程序,只要PB调用的WebService方法在Vs.Net 中有断点,就会自动进入Vs.Net 的环境中查看参数的传递情况。
of an object)我调用WebService的代码为:
if dw_1.rowcount()
= 0 then
return
cashcarteinfo cartelist[]
cartelist
=dw_1.object.data
cashcarteiteminfo carteitemlist[]
datastore ldst_carteitem
ldst_carteitem= create datastore
ldst_carteitem.dataobject
= 'd_carteitem'
ldst_carteitem.settransobject( sqlca)
ldst_carteitem.retrieve( idt_uptime)
carteitemlist
= ldst_carteitem.object.data
destroy ldst_carteitem
SoapConnection conn
cashservice cashweb
long rVal
conn
= create SoapConnection
rVal
= Conn.CreateInstance(cashweb,
"cashservice","http://localhost/WebService/Service.asmx")
try
string ls
= space(500)
long stationid
stationid
= 1
if cashweb.uploadcarte( cartelist, carteitemlist, stationid,
ref ls)
=true then
Messagebox('','succes')
else
Messagebox('fail',ls)
end
if
catch( SoapException e )
messagebox ("Error",
"Cannot invoke Web service~r~n"+ e.getmessage( ) )
// error handling
end
try
destroy cashweb
destroy conn
经过过反复的调试,终于发现问题所在。我上传的参数是一个结构体数组,在给结构体赋值时,如果结构体的某一字段赋了null,上传到WebService后,整个对象(结构体)都会为null。找到了原因,问题迎刃而解!
另附PB调用WebService调试的方法:
将Vs.Net 的WebService启动调试,让它处于调试状态,并设好WebService的断点;再调试PB程序,只要PB调用的WebService方法在Vs.Net 中有断点,就会自动进入Vs.Net 的环境中查看参数的传递情况。
相关文章推荐
- PB调用WebService遇到的问题
- PB9.0调用Webservice步骤以及相关问题
- 调用webservice遇到基础连接已关闭的问题
- 在与sap系统集成时遇到的问题.sap系统发布一webservice,java(xfire)作为客户端调用,调用时抛出如下异常: Wrong Content-Type and empty HTTP-Body received: ("HTTP Code 20
- 调用.NET WebService写入文件时遇到文件夹被拒绝访问的问题
- jquery调用WebService遇到的问题
- Axis2发布webservice过程 和Axi af16 s2调用wsdl 及遇到的问题
- 调用.NET WebService写入文件时遇到文件夹被拒绝访问的问题
- args.get_error的详细解释和在asp.net ajax中调用webservice遇到的问题
- 关于webService调用遇到的问题
- Android通过ksoap调用webservice遇到的问题及解决之道全纪录
- 调用webservice时遇到的几个问题
- 关于 ksoap2调用 webservice 遇到的一些问题
- WP8调用WebService或WCF时遇到的问题及解决方案
- 调用WebService接口遇到的问题。
- CXF动态客户端调用webservice实例 遇到的问题
- 在使用KSoap2调用webservice遇到的问题
- 关于asp调用webservice遇到的问题
- cxf调用.net webservice 接口遇到的问题(尚未解决)
- 调用webservice时遇到的几个问题