NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: osquiabro on October 23, 2014, 04:39:18 AM
-
Hi, somebody use Rest with nettalk?
http://www.restapitutorial.com/lessons/whatisrest.html
-
yes, it's possible to do REST with NetTalk.
Are you wanting to create a client or a server?
cheers
Bruce
-
About REST, and SOAP, may I ask some question about these features in NT, because I have some issues ...
Or post another post in forum?
Regards, Oggy
-
Bruce, both i have a customer that required read data from this services
http://www.satasgis.crimpr.net/crimgis/rest/services/Mapas
-
Hi Oggy,
Probably a good starting point is to catch up on a few webinars. They provide a basic understanding and will help you get going. After that if you have specific questions you can ask anywhere on these forums.
A sub-set of the ClarionLive webinar list is here;
http://www.capesoft.com/webinars.htm
>> I have a customer that required read data from this services
This would imply that a client is your first priority. A good primer for this is webinar #48.
On the server side, there was quite a lot of stuff added in NetTalk 8. If nothing else this will help you understand what the server side is doing. A good priming webinar for this is #255.
During the User Group Webinars Web Services have come up a few times.
http://www.capesoft.com/accessories/NetTalkUserGroup.htm
#12 is a good one, with a bit of follow-up in #13.
At some point I'll be doing an update on the client side, but that's a little bit down the road.
Cheers
Bruce
-
Ok, thanks for reply, but my problem, as always for me :), its not the usual one..
I used Nettalk example num 42, (SoapServer). This works fine. I can start the server and send request as is in example.
Ok, next point: I add another app, plain window, purpose just for testing. From that new window I want to call external procedure where is my SOAP request procedure (client app from example), with some parameter(s). Ok, parameters goes from window to soap-request procedure, and SOAP XML is creates as usually. But, whet its come to POST and SEND request to server, problem started. Here is my routine to post request:
SendPost routine
PostURL = 'http://' & clip(loc:url) & '/getInfo'
ThisWebClient.SetAllHeadersDefault()
ThisWebClient.Pragma_ = 'No-Cache'
ThisWebClient.CacheControl = 'No-Cache'
ThisWebClient.ContentType = 'text/xml'
ThisWebClient.AcceptEncoding = ''
ThisWebClient.ContentLength = len(clip(PostString)) !
ThisWebClient.AsyncOpenTimeOut = 1200
ThisWebClient.InActiveTimeout = 2000
ThisWebClient.Post(PostURL,PostString)
! Return some value if all goes well
if ID_Korisnika <> 0 and Rezultat.ErrorCode = 0
Return(ID_Korisnika) ! Returning with some ID, thats what I wan
ELSE
Return(ID_Korisnika) ! Returning with zero ID
END
First error is: -60, which means connection was not open (see attachment 1)
Ok, I resolve this error calling manually ThisWebClient.Init(NET:SimpleClient) procedure.
Now this error gone, but another problem is that ThisWebClient.Post(PostURL,PostString), procedure never open, instead of that, ThisWebClient.Destruct procedure fired?!?. Nor ThisWebClient.Send procedure never ever came in focus. When I manually call these procedures (Send for example), another error "connection not open" appear...
What Im doing wrong?!?
Sorry for such large post...
Oggy
[attachment deleted by admin]
-
this part is wrong;
ThisWebClient.Post(PostURL,PostString)
! Return some value if all goes well
if ID_Korisnika <> 0 and Rezultat.ErrorCode = 0
Return(ID_Korisnika) ! Returning with some ID, thats what I wan
ELSE
Return(ID_Korisnika) ! Returning with zero ID
END
the POST is asynchronous, meaning that you can't test for a result, or do a RETURN immediately after the call. Rather the post will be made (in the background) and the result will come out through either the .ErrorTrap method, or the .PageReceived method.
So what you need to do is do the Post, and then add code to PageReceived (parsing the result you got back in .Page property) and add code to .ErrorTrap to handle an error.
Of course being asynchronous, ie Event driven, it needs a window structure. So it needs to be based on a Window template, not a source code template. But you can always make the procedure completely "hands-free" if you like, and hide the window as well, so the window itself is invisible.
cheers
Bruce
-
We do not understand, the problem is not in:
if ID_Korisnika <> 0 and Rezultat.ErrorCode = 0
Return(ID_Korisnika) ! Returning with some ID
ELSE
Return(ID_Korisnika) ! Returning with zero ID
END
it is just for returning some results, but.... As you can see, the ThisWebClient.Post(PostURL,PostString) IS in the code, but Post procedure in class never ever open, I put some messages in embed of Post procedure, but these messages do not flash before me ;)
Second , nor the PageReceived ever opened. never...
-
Hm, that means, my source is not possible, I must have some event on to goes from one procedure to another !?!?
Thats sound Ok...
-
Ok, solved as suggested. Now, another one :D
Where is, if exists, parameter, or timer for ErrorTrap procedure? I want to variable calliing this procedure.
-
post new questions on a new thread.