Home > database >  A great god, genuflect is begged WebAPI PB how to invoke ASP.NET??? To post) technology for help,
A great god, genuflect is begged WebAPI PB how to invoke ASP.NET??? To post) technology for help,

Time:10-22

PB is a great god, company have a project recently, need and the third party company, transfer data through the interface, the situation is like this:
1, our company provides interface is ASP.NET WebAPI form, simple test interface is as follows:
http://115.29.226.49:8081/api/ServiceFromConsumer/GetTestInfo
Returns the result as follows, the JSON format:
{
"Message" : "see this piece of information, said data returned success"
}
2, the other party is using PB created by the client, now we need each other to call interface for data interaction, but the other engineers as if to say bad call ~

Searched some information online, say PB9 later, is to support the WebService interface call, also have GetURL and PostURL, but suffer from of PB are not ripe, unable to write test Demo,

So, in the which god had time, genuflect is begged to write a simple Demo, can have the Post and the Get method,
The Get interface:
http://115.29.226.49:8081/api/ServiceFromConsumer/GetTestInfo
http://115.29.226.49:8081/api/ServiceFromConsumer/GetAllMember
Post interface:
http://115.29.226.49:8081/api/ServiceFromConsumer/AddMember

Hope to give a Demo which eldest brother or give a train of thought, thank you!!!!!!
If is not convenient to post, can send me email: 373269349 @qq.com,, thank you

CodePudding user response:

 
N_pbfunc_http lnv_http
Lnv_http. Of_clear ()//clear parameter
Lnv_http. Of_set_URL (" http://115.29.226.49:8081/api/ServiceFromConsumer/GetTestInfo ")
Lnv_http. Of_set_ContentType (" application/json ")
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Blob lblb_data
String ls_error
IF lnv_http. Of_get (lblb_data ls_error) Then
N_pbfunc_encode lnv_encode
String gbkData
GbkData=https://bbs.csdn.net/topics/lnv_encode.of_utf8ToGbk (lblb_data)//is due to return to the utf-8 encoding, will directly show the code
MessageBox (" tip ", gbkData)
The Else
MessageBox (" prompt ", "failure")
End the IF

You can refer to http://download.csdn.net/detail/my_aa/9193081 to download address w_http return json button in the window