C#调用webservice成功,PB调用失败,怎么破

fcydj1984 2020-03-11 08:38:52
C#

static void Main(string[] args)
{
WebReference.MainServiceImplService obj = new WebReference.MainServiceImplService();
string header = "<?xml version='1.0' encoding='GBK'?><header><servicecode>71000001</servicecode><apiversion>2.0</apiversion><createtime>2020-03-06 08:00:00</createtime><govcode>3xxxxxxx</govcode><systemid></systemid><username></username><userpass>123456</userpass></header>";
string body = "<?xml version='1.0' encoding='GBK'?><body><fullname info='姓名'>xxx</fullname><cardno info='身份证号'>37xxxxxxxxxxx</cardno><type info='签约状态'>2</type></body>";
string result = obj.serviceMain(header, body);

Console.WriteLine(result);
Console.ReadLine();
}

pb8

string ls_rate_type,ls_center_url
long ll_result
string ls_xml,ls_body
ole_webservice= create oleobject

ll_result = ole_webservice.ConnectTonewObject("MSSOAP.SoapClient30")
if ll_result <> 0 then
ll_result = ole_webservice.ConnectTonewObject("MSSOAP.SoapClient")
if ll_result <> 0 then
messagebox("系统提示","连接MSSOAP.SoapClient失败!返回参数:"+string(ll_result))
if isvalid(ole_webservice) then destroy ole_webservice
end if
end if
try

ls_center_url='xxxxxxxxxwsdl'
ole_webservice.mssoapinit(ls_center_url)

Catch (RuntimeError err)
messagebox('提示','服务器地址无效或网络不通!')
return -1
end try
string ls_header = "<?xml version='1.0' encoding='GBK'?><header><servicecode>71000001</servicecode><apiversion>2.0</apiversion><createtime>2020-03-06 08:00:00</createtime><govcode>3xxxxxxx</govcode><systemid></systemid><username></username><userpass>123456</userpass></header>";
string ls_body = "<?xml version='1.0' encoding='GBK'?><body><fullname info='姓名'>xxx</fullname><cardno info='身份证号'>37xxxxxxxxxxx</cardno><type info='签约状态'>2</type></body>";

ls_xml = ole_webservice.servicemain(ls_header,ls_body)
红色这行报error calling external object
return 0
...全文
233 1 打赏 收藏 举报
写回复
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
WMERP 2020-03-19
用PB自带的SOAP或者HTTP把,PB的soap就不说了,F1帮助有:
Blob lblb_args
String ls_headers
String ls_url
Long ll_length,ll_rest
ls_url="https://api.douban.com/v2/book/isbn/"+as_isbn //https://api.douban.com/v2/book/isbn/9787516211366
String ls_data,ls_response

OleObject lole_tenyear //声明ole
lole_tenyear = CREATE oleobject
lole_tenyear.ConnectToNewObject("Microsoft.XMLHttp") // 我测过xp和win7都自带
lole_tenyear.open ("POST",ls_url, false)
lole_tenyear.SetRequestHeader("Expect100Continue", "false")
lole_tenyear.setRequestHeader ("Content-type", "application/x-www-form-urlencoded")
lole_tenyear.setRequestHeader('Content-Length',string(len(ls_data)))
//lole_tenyear.send (' ')
lole_tenyear.send (ls_data)

do While lole_tenyear.readyState <> 4 // ' 查询状态,延时
yield()
Loop
ls_response = lole_tenyear.responseText //返回结果

IF lole_tenyear.Status >= 300 THEN
// MessageBox ("HTTP request failed:", lole_tenyear.StatusText ,Exclamation!,OK!)
END IF

destroy lole_tenyear
return ls_response
  • 打赏
  • 举报
回复
发帖
Web 应用

656

社区成员

PowerBuilder Web 应用
社区管理员
  • Web 应用社区
加入社区
帖子事件
创建了帖子
2020-03-11 08:38
社区公告
暂无公告