NetTalk Central

Author Topic: Web Service newbie question  (Read 3724 times)

RichBowman

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • Email
Web Service newbie question
« on: November 11, 2014, 06:33:01 AM »
I have a window with static information and 3 browses. Data for 2 of the browses comes from existing tables.

To build a memory table for the 3rd browse I call 2 web services. The first builds a few records and the second the remaining (total maybe 10 - 12).

The first time I enter the window everything looks and works fine. The second time things look OK but when I close I get an access violation. If I put message statements in to determine where, the access violation happens in different places (which makes me think timing is an issue). If I don't access the web services the window works correctly all the time.

In my window I call the 2 procedures with the web services call one after the other. In the page received embed I process the page and then do a post(event:close window). My code in the window with the browses assumes it comes back right away, like any other call, but while the server I'm calling is on the LAN and is very fast, I know it may or may not return instantly.

My hunch is things are getting tangled up in their underwear because I'm not waiting until the web service is completely finished before continuing to process the memory file in the window with the browses.
 
How can I do this?

Thank you,

Rich Bowman

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Web Service newbie question
« Reply #1 on: November 11, 2014, 08:57:32 PM »
Hi Rich,

I think you're on the wrong track.

You say;

>> If I put message statements in to determine where, the access violation happens

MESSAGE is not a good debugging tool because by using it you change the state of the program. This is especially true when dealing with network communications.

A better approach is to use DebugView - Use the StringTheory .Trace method or any other of a dozen approaches to write to debugview.

But;

>> I call the 2 procedures with the web services call one after the other. In the page received embed I process the page and then do a post(event:close window).

If I'm reading this correctly you have a procedure that "calls a web service, gets a response, and closes when the complete response has arrived and (presumably) been parsed.

In other words the calls to the WebServices are effectively "synchronous".

>> I'm not waiting until the web service is completely finished before continuing to process the memory file in the window with the browses.

but you are waiting. The calls to the web service procedures (*) wait until the loading is complete.

(*) I'm assuming you're doing a normal call, not STARTing those procedures on ew threads...

So you need to explore further...

Cheers
Bruce


RichBowman

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • Email
Re: Web Service newbie question
« Reply #2 on: November 12, 2014, 06:16:32 AM »
Thank you for the DebugView suggestion I should have remembered that. Not sure if my GPF is related to NetTalk, but it only occurs when NetTalk is in play. I realize this is a little involved but let me explain.

Window 1 lists items. When I select an item and click the red "More Info" in bottom right (see first screen shot) it displays Window 2 with 3 browses. Depending on the item, it will call 2 procedures each of which has a web service call. OK so far.

If I select an item that does not invoke a web service call, all is well and I never have a problem. If however I select an item that does invoke the 2 web service calls it gpf's while closing the More Info window the 2nd time. The curious thing is after the first time I click the button and do the web service calls, when I close the window with the 3 browses, a portion of it is still displayed in the first window (see 2nd screen shot). The very next time I go to the 2nd window and then exit, it crashes.

The third screenshot is what the window that calls the web services looks like.

It's almost as if doing the web service calls with NetTalk is preventing the 2nd window from closing.

I know this sounds strange but any ideas of what I might check would be most appreciated.

 Many thanks,

Rich

[attachment deleted by admin]

RichBowman

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • Email
Re: Web Service newbie question -- SOLVED
« Reply #3 on: November 12, 2014, 12:01:04 PM »
My bad. Kudos to GPFReporter. It revealed a subscript problem. Now all is well.

Sorry to have troubled you.

Rich