Home > database >  PB simulation httpclient sends the message request API for help
PB simulation httpclient sends the message request API for help

Time:09-16

Recently, experts, and the client company CRM system interface communication, the client USES the PB development of CRM system, our side is usually via HTTP server provides the json format of business data
Because I to PB don't understand, ask ace here, PB have similar Java provided by the apache httpclient API or other things like that?
If yes, please indicate, by the way, and give some example invocation handler
Please instruct!
Thank you very much

CodePudding user response:

Original concept have Inet object, can realize the function of sending HTTP requests!

CodePudding user response:

The use of PB in INET control

INET control can simulate to the INTERNET in the form of a GET or POST request, and can GET a request to return to the page content, it needs to be used with INTERRNETESULT controls. These two controls is invisible, is not very help files written in detail, the proper use of the two controls need to be the first of the two control derived two standard class, then program used to instantiate.

A NEW STANDARD CLASS, select INET, save into n_inet

NEW a STANDARD CLASS, choose INTERNETRESULT, write in INTERNETDATA functions messagebox (' return a result, the string (data)), save as n_ir

We'll try the below, the following script

N_inet ln_inet

N_ir ln_ir

Ln_inet=create n_inet

Ln_ir=create n_ir

The integer li_ret

Li_ret=n_inet. Geturl (" http://www.china-puer.cn/list.asp? Id=1450 ', ln_ir)

If li_ret & lt; 1 then messagebox (' error, the string (li_ret))

CodePudding user response:

Now I am using the HTTP protocol with apache tomcat communication

Feeling with geturl and posturl general function can be implemented, including binary stream transmission and compression

CodePudding user response:

Thank you, consult lzp_lrp:
Implementation way of post, and transmitting the json or XML format content client calls example
For example the message content to the server side the following format:
"
{
"CMD" : "getVehicleOwnerInfo,"
"Params" : {
"StoreId" : "0079",
"Money" : "8693.68"
}
}
"

CodePudding user response:

Servicereference becomes unavailable but PostURL (urlname urldata, headers, {} serverport, data)

The data area is you
the above data
Look at the posturl help and routines

CodePudding user response:

reference lzp_lrp reply: 3/f
now I am using the HTTP protocol with apache tomcat communication

Feeling with geturl and posturl general function can be implemented, including binary stream transmission and compression


Moderators can, for example, or send the email, very worried this application, thanks a lot (please change # to @) getcmmc#sina.com

CodePudding user response:

Examples can refer to the help of pb


PostURL ()
HTTP Post function, so the original concept application can through the CGI, NSAPI, ISAPI interface sends a request,
Grammar servicereference becomes unavailable but PostURL (urlname urldata, headers, data)
Parameter
Servicereference becomes unavailable but: Inet object instance or reference
Urlname: String type, designated to send the request URL (uniform resource locator)
Urldata: Blob, sent to the specified urlname parameters specify the URL of the
Headers: String type, specify the HTML first, for Netscape browser, need a newline after each HTTP header (~ n), after all first and then with a newline (~ n)
Data: InternetResult instance variables, used to hold the returned HTML
The return value
Integer, the function returns 1 on success, return the following error values:
1 general error
2 the URL specified is invalid
- 4 cannot be connected to the Internet
- 6 Internet request invalid
Use the
Data parameters of the function requirement is class user object inherited InternetResult object instance, in the definition of the user object, you need to define InternetData cover function (), to deal with the Internet returns HTML data, because of the Internet to asynchronously send data, therefore, the data parameter must be an instance variable or a global variable reference (such as window class instance variables),
Example the following code to invoke PostURL (), among them, the Iinet_base is a type of Inet instance variables; N_ir_msgbox is the class user object inherited InternetResult object, iir_msgbox is the user object is an instance:
Blob lblb_args
String ls_headers
String ls_url
Long ll_length
Ir_msgbox=CREATE n_ir_msgbox
Ls_url="http://coltrane.sybase.com/"
Ls_url +="cgi - bin/pbcgi60. Exe/"
Ls_url +="myapp/n_cst_html/f_test? "
Lblb_args=blob (" ")
Ll_length=Len (lblb_args)
Ls_headers="Content - Length:" + String (ll_length) + "~ n ~ n
"Iinet_base. PostURL (ls_url lblb_args, ls_headers, iir_msgbox)

CodePudding user response:

Why not let the CRM provides you with a WEBSRVICE? This is not a more simple,

CodePudding user response:

Lzp_lrp please is very strong, learned today!
  • Related