PB12.5调用webservice 获取blob数据并放到数据窗口

陶小淘 2015-09-22 02:25:01
datastore ds1
string as_syntax,dwsyntax_str
long ll_row,ll_returnrow
string ls_returnmodiy
string ls_error
string csa
int i,LI_WHERE

uf_connect();
if SQLCA.SQLCode <> 0 then
as_returnerr="连接数据库出错,请检查数据库连接参数。"+string(sqlca.sqlerrtext)
return -1////创建数据窗口出错
end if
as_syntax = "select a.ybbm,a.pm,a.zczh,a.ggxh,a.jjdw,a.xxsxrq from sta000.yb_ylqc a where a.imonth = (select max(a.imonth) from sta000.yb_zlxm a) and a.xxsxrq<=to_char(sysdate + 60 ,'YYYYMMDD')" +&
"union all " + &
"select b.ybbm,b.xmmc,b.fylb,'',b.jjdw,b.xxsxrq from sta000.yb_zlxm b where b.imonth = (select max(b.imonth) from sta000.yb_zlxm b) and b.xxsxrq<=to_char(sysdate + 60 ,'YYYYMMDD')" +&
"union all " + &
"select e.tbdm,e.yptym,e.ggbzwzbs,e.scqy,e.bzdw,e.yxrq from sta000.yk_ypjcxx e where e.yxrq<=to_char(sysdate + 60 ,'YYYYMMDD')" +&
"and e.yxrq >= to_char(sysdate - 3 ,'YYYYMMDD')"

dwsyntax_str = Sqlca.syntaxfromsql(as_syntax, "style(type=grid)",ls_error)

IF Len(ls_error) > 0 THEN
uf_disconnect()
as_returnerr="SyntaxFromSQL caused these errors! "+ls_error
RETURN -1
END IF

ds1.Create( dwsyntax_str, ls_error)
IF Len(ls_error) > 0 THEN
uf_disconnect()
as_returnerr = "Create cause these errors: "+ ls_error
RETURN -1////创建数据窗口出错
END IF

int li_a

li_a=ds1.settransobject(sqlca)

if li_a<>1 then
uf_disconnect()
as_returnerr="服务端设置数据存储事务出错!"
return -1///设置对像事物出错
end if
ll_row=ds1.retrieve()
if ll_row<0 or isnull(ll_row) then
ls_error = sqlca.sqlerrtext
uf_disconnect()
as_returnerr="数据检索出错!" + ls_error
return -1//服务端检索数据出错
end if
ll_returnrow=ds1.getfullstate(dwo_blob)

if ll_returnrow<0 or isnull(ll_returnrow) then
uf_disconnect()
as_returnerr="服务端进行blob时,获取数据行出错!"
return -1 //封装到blob变量时出错
end if
uf_disconnect()
destroy ds1;
as_returnerr="数据检索成功!"
return ll_returnrow

上面是webservice的写法,编译生成ws是成功的。

//以下同样用pb125调用上面的ws
blob lb_datastore
string ls_err

soapconnection conn1
n_webservice n_p_ws_test_wsproxy1
conn1 = create soapconnection
conn1.createinstance( n_p_ws_test_wsproxy1,"n_webservice")

try
n_p_ws_test_wsproxy1.uf_retrieve(lb_datastore, ls_err)
catch(soapexception e1) //soapexception定义的异常
messagebox("sop异常",e1.text)
catch (runtimeerror re1) //
Messagebox("web连接错误",re1.text)
end try

if len(ls_err)>0 then
messagebox('',ls_err)
return
end if

提示sop异常Object reference not set to an instance of an object这是为什么求大神解答
...全文
1571 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
FrankLiang 2015-09-23
  • 打赏
  • 举报
回复
引用 6 楼 FrankLiang 的回复:
楼主,你好, 很奇怪我的pb12.5 classic,新增project中,.net web service 是灰色的,选不了。
不好意思,原来我搞错,现在application中找到。 现在我想转型搞想基于internet的cs,还在迷惘中,请大家给点提示,哪种方式能保留之前CS的界面操作方便性, 又能方便快速访问远程的database或共享文件夹。。。谢谢!
FrankLiang 2015-09-23
  • 打赏
  • 举报
回复
楼主,你好, 很奇怪我的pb12.5 classic,新增project中,.net web service 是灰色的,选不了。
FrankLiang 2015-09-23
  • 打赏
  • 举报
回复
楼主,您好,之前我一直用PB12.5开发C/S, 未来有些用户需要经过wan来使用,请问现时这种web service的方式是否合用?
zjl8008 2015-09-23
  • 打赏
  • 举报
回复
陶小淘 2015-09-23
  • 打赏
  • 举报
回复
找到原因了 datastore ds1没有 ds1 = create datastore
陶小淘 2015-09-22
  • 打赏
  • 举报
回复
引用 1 楼 lzp_lrp 的回复:
blob lb_datastore string ls_err soapconnection conn1 n_webservice n_p_ws_test_wsproxy1 conn1 = create soapconnection conn1.createinstance( n_p_ws_test_wsproxy1,"n_webservice") try n_p_ws_test_wsproxy1.uf_retrieve(lb_datastore, ls_err) catch(soapexception e1) //soapexception定义的异常 messagebox("sop异常",e1.text) catch (runtimeerror re1) // Messagebox("web连接错误",re1.text) end try if len(ls_err)>0 then messagebox('',ls_err) return end if lb_datastore没有赋值
您好 这个n_p_ws_test_wsproxy1.uf_retrieve(lb_datastore, ls_err)中两个参数都是返回值
WorldMobile 2015-09-22
  • 打赏
  • 举报
回复
blob lb_datastore string ls_err soapconnection conn1 n_webservice n_p_ws_test_wsproxy1 conn1 = create soapconnection conn1.createinstance( n_p_ws_test_wsproxy1,"n_webservice") try n_p_ws_test_wsproxy1.uf_retrieve(lb_datastore, ls_err) catch(soapexception e1) //soapexception定义的异常 messagebox("sop异常",e1.text) catch (runtimeerror re1) // Messagebox("web连接错误",re1.text) end try if len(ls_err)>0 then messagebox('',ls_err) return end if lb_datastore没有赋值

662

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder Web 应用
社区管理员
  • Web 应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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