Home > database >  C # call the webservice success, PB call fails, how broken
C # call the webservice success, PB call fails, how broken

Time:10-07

C #

The static void Main (string [] args)
{
WebReference. MainServiceImplService obj=new WebReference. MainServiceImplService ();
The string header="& lt; ? The XML version='1.0' encoding='GBK'?> & lt; Header> & lt; Servicecode> 71000001 & lt;/servicecode> & lt; Apiversion> 2.0 & lt;/apiversion> & lt; Createtime> The 2020-03-06 08:00:00 & lt;/createtime> & lt; Govcode> 3 XXXXXXX & lt;/govcode> & lt; Systemid> & lt;/systemid> & lt; Username> & lt;/username> & lt; Userpass> 123456 & lt;/userpass> & lt;/header> ";
String body="& lt; ? The XML version='1.0' encoding='GBK'?> & lt; body> & lt; Fullname info='name & gt; Xxx & lt; Cardno info='id' & gt; 37 XXXXXXXXXXX & lt;/cardno> & lt; Type the info='signing status & gt; 2 & lt;/type> & lt;/body> ";
String result=obj. ServiceMain (header, body);

Console. WriteLine (result);
The 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 & lt;> 0 then
Ll_result=ole_webservice. ConnectTonewObject (" MSSOAP. SoapClient ")
If ll_result & lt;> 0 then
Messagebox (" prompt ", "connect MSSOAP SoapClient failure! Return parameter: "+ string (ll_result))
If isvalid (ole_webservice) then destroy ole_webservice
End the if
End the if
Try

Ls_center_url='XXXXXXXXXWSDL'
Ole_webservice. Mssoapinit (ls_center_url)

The Catch (RuntimeError err)
Messagebox (' prompt ', 'the server address is invalid or the network impassability! ')
The return - 1
End the try
String ls_header="& lt; ? The XML version='1.0' encoding='GBK'?> & lt; Header> & lt; Servicecode> 71000001 & lt;/servicecode> & lt; Apiversion> 2.0 & lt;/apiversion> & lt; Createtime> The 2020-03-06 08:00:00 & lt;/createtime> & lt; Govcode> 3 XXXXXXX & lt;/govcode> & lt; Systemid> & lt;/systemid> & lt; Username> & lt;/username> & lt; Userpass> 123456 & lt;/userpass> & lt;/header> ";
String ls_body="& lt; ? The XML version='1.0' encoding='GBK'?> & lt; body> & lt; Fullname info='name & gt; Xxx & lt; Cardno info='id' & gt; 37 XXXXXXXXXXX & lt;/cardno> & lt; Type the info='signing status & gt; 2 & lt;/type> & lt;/body> ";

ls_xml=ole_webservice. Servicemain (ls_header ls_body)
Red this line error calling external object
Return 0

CodePudding user response:

With PB with SOAP or HTTP, PB SOAP is not to say, F1 help are:
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

Ole OleObject lole_tenyear//statement
Lole_tenyear=CREATE oleobject
Lole_tenyear. ConnectToNewObject (" Microsoft. XMLHttp ")//I tested xp and Windows 7 are bringing
Lole_tenyear. Open (" POST ", ls_url, false)
Lole_tenyear. SetRequestHeader (" Expect100Continue ", "false")
Lole_tenyear. SetRequestHeader (" the content-type ", "application/x - WWW - form - urlencoded")
Lole_tenyear. SetRequestHeader (' Content - Length, the string (len (ls_data)))
//lole_tenyear. Send (')
Lole_tenyear. Send (ls_data)

The do While lole_tenyear. ReadyState & lt;> 4//'query condition, delay
The yield ()
Loop
Ls_response=lole_tenyear. The responseText//returns the

IF lole_tenyear. The Status & gt; THEN=300
//MessageBox (" HTTP request failed: ", lole_tenyear. StatusText, the Exclamation! , OK!
END the IF

Destroy lole_tenyear
Return ls_response
  • Related