Home > database >  I want to ask next function by using the method of oleobject call webservice
I want to ask next function by using the method of oleobject call webservice

Time:10-10

Like uploadforxml, call a method, use to initialize the environment

CodePudding user response:

I'm here is an example, according to the books ISBN query book information,

CodePudding user response:

//f_get_json_isbn

//https://api.douban.com/v2/book/isbn/9787543632608
//https://api.douban.com/v2/book/isbn/7543632608
Long ll_pos
Ll_pos=pos (as_isbn, '-')
The do while ll_pos & gt; 0
As_isbn=left (as_isbn ll_pos - 1) + mid (as_isbn, ll_pos + 1)
Ll_pos=pos (as_isbn, '-')
Loop


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
String ls_data, ls_response

Ole OleObject lole_tenyear//statement
Lole_tenyear=CREATE oleobject
Lole_tenyear. ConnectToNewObject (" Microsoft. XMLHttp ")//help XMLHttp component, I tested xp and Windows 7 are shipped, do not need to install any auxiliary software such as.net environment

Lole_tenyear. Open (" POST ", ls_url, false)//parameter explanation see:
//http://blog.csdn.net/ldl22847/article/details/9662927

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 key is this step: if your browser HTTPS environment is not installed the roots of certification certificates, must be an error, if you apply for to install the authority such as verisign hair root certificate, use ie to open the top of the HTTPS, wouldn't the red warning (ask if you continue to), but the pb not prompt if you continue, direct error exit, verisign certificate a year like 10000-100000 yuan fee, here if you want to test, you can change the HTTPS address to https://www.alipay.com/(alipay), not an error, note: this certificate and validation are one-way authentication, not a two-way,
The do While lole_tenyear. ReadyState & lt;> 4//'query condition, delay
The yield ()
Loop
Ls_response=lole_tenyear. The responseText//returns the
//messagebox (ls_url, ls_response)

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

CodePudding user response:

Don't support ole webservice many interface way, or using the HTTP request webservice
  • Related