NetTalk Central

Author Topic: Web server with POST-ing  (Read 4257 times)

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Web server with POST-ing
« on: September 28, 2016, 12:41:22 AM »
I have some pretty old Web service, online for years now. Now I decide to put some rudimental POST function(s) to the same service. I know how to do that, thanks to SOAP example from xFiles (of course). Now, my question is: when I use AsyncOpenUse (net.AsyncOpenUse (net.AsyncOpenUse = 1), the service
did not "catch" any data that I send ?!?. However, if AsyncOpenUse is off, all works well. But, if AsyncOpenUse is off and server-service is also off, the client must wait about 1,5-2 seconds to abort sending of data. This means for every single request to the server, when server is offline, delay to abort is way too long.
How to speed up aborting of sending data to offline server?
Clarion 10, Nettalk 7.40
Code example with AsyncOpenUse = 1, that is no-go version:
    net.HeaderOnly = 1 ! Cijelu stranu, dodano novo
    net.SetAllHeadersDefault()
    net.Pragma_ = 'No-Cache'
    net.CacheControl = 'No-Cache'
    net.ContentType = 'text/xml' !
    net.ContentLength = len(clip(PostString)) !
    net.AsyncOpenTimeOut    = 300
    net.InActiveTimeout     = 1200
    net.CanUseProxy         = 1
    net.ConnectionKeepAlive = 0
    net.AcceptEncoding = 'win-1250'
    net.ContentLength = Len(Clip(PostString))
    PacketSent = PostString
    PutanjaSOAP = 'http://' &clip(MPB:OPIS9)&clip(':')& Clip(Left(Format(MPB:DATUM3,@n_5)))  & '/getInfo'
    net.Post(Clip(PutanjaSOAP) , Clip(PostString))

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Re: Web server with POST-ing
« Reply #1 on: September 28, 2016, 01:59:26 AM »
Hm, I noticed something weird. In netwww.clw, NetWebClient.Post  procedure, this code:
if self.AsyncOpenUse = 0
    Do Old_SynchronousOpen_Open
  else
    ! AsynOpen
    if self.openflag = 1
      self.abort()
    end
  end
That means, the async open procedure did not work, because there is no AsynOpen procedure ?!?!?!
Regards, Oggy.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Web server with POST-ing
« Reply #2 on: September 28, 2016, 11:07:37 PM »
I haven't looked too hard at that code Oggy, but I am seeing;

  if (self.AsyncOpenUse = 0)
    Do Old_SynchronousOpen_Send
  else
    Do AsyncOpen
  end



a little lower down,, so I think that's where the Open happens.

You're on a really old build of NetTalk though, and the WebClient class has changed quite a bit since those days, so I guess if the SyncOpen works for you, and the Async open not, then just use the Sync Open for now.

cheers
Bruce

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Re: Web server with POST-ing
« Reply #3 on: September 30, 2016, 04:13:43 AM »
Exaclty Bruce, Async open did not work, I will use Sync open for now... Can you confirm that in Nettalk9 is working?
Thank you.
Regards. Oggy

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Web server with POST-ing
« Reply #4 on: October 03, 2016, 10:42:14 PM »
At this point I think NT9 is the same as NT8 in this regard. It's something I'll look into though.

cheers
Bruce