WinBatch® Technical Support Forum

Archived Boards => COM Automation and dotNet => Topic started by: JTaylor on May 01, 2017, 02:02:07 PM

Title: XMLHTTP Issue
Post by: JTaylor on May 01, 2017, 02:02:07 PM
Hoping someone can help me see what I am apparently doing wrong that is so simple I can't find it after 6 or so hours.

I make a call to a webservice and retrieve a list of items.  When I launch the WinBatch script it works as expected.

If I upload a list it works fine as I can open the table in the admin tool and query the table and all is good.  I can also make the call via  web browser that I am making in the script and it returns all the records.

The catch is that after the first load when launching the script it only returns the same list no matter how many new items I upload within the script.  Again, everything outside the script returns what is expected.  I even copy/paste the URL during the process so I am using the exact same link in the browser but the browser and the script return different results.   If I close the script and reopen then it returns all the records as expected.  I do a lot of this type of stuff and haven't ever encountered such a  problem and, so far, can't see what I could be doing wrong.

Suggestions?

Jim


Code (winbatch) Select



  SQLText = "truncate table import"
  myConn.Execute(SQLText)

  ' Create MSXML Object
  MSXML = CreateObject("MSXML2.XMLHTTP")

  XMLURL = "https://www.myserver.com/webcgi/webbatch.exe?test/get.web&action=GET&domain=mydomain"
  ret = MSXML.Open("GET", XMLURL, @FALSE)
  MSXML.Send
  Display(1,"Selections","Importing ...")
  xtxt = MSXML.ResponseText

  ObjectClose(MSXML)

  If StrIndexNC(xtxt,"Insert into",0,@FWDSCAN) > 0 Then myConn.Execute(xtxt)


Title: Re: XMLHTTP Issue
Post by: td on May 02, 2017, 06:38:49 AM
Other than a missing closing single quote, nothing jumps out as problematic.
Title: Re: XMLHTTP Issue
Post by: JTaylor on May 02, 2017, 07:32:42 AM
Interesting...my mind has always registered those as Comments over the many years I've used that piece of code in many different places  :)   

Unfortunately that wasn't the problem.   Wonder what the food will be like in the asylum or if the drugs will make me not care?

Jim
Title: Re: XMLHTTP Issue
Post by: td on May 02, 2017, 07:46:54 AM
Didn't mean to imply that the missing quote was the 'cause' because obviously is not given how the WIL parser works.  And a missing closing quote is not the same thing as a comment to the parser nor to syntax colorizers. 
Title: Re: XMLHTTP Issue
Post by: JTaylor on May 02, 2017, 08:33:57 AM
I know.  I just found it interesting how I never thought about that being anything other than a Comment, even though, from a WB coding point of view, it obviously isn't.

Jim
Title: Re: XMLHTTP Issue
Post by: td on May 02, 2017, 10:57:01 AM
If we ever fix that open quote quirk, you may be in for a bit of work...
Title: Re: XMLHTTP Issue
Post by: JTaylor on May 02, 2017, 03:06:15 PM
As expected...just me being an idiot.  Kept thinking I was doing something wrong in my code but turned out it was XMLHTTP cacheing the results, which is what it looked like, but I hadn't seen that before and assumed me closing and reopening the object would have taken care of it so ignored my first thought and kept looking for something in my code.   Easily fixed by adding a timestamp parameter to the URL so it changes every time.  Sorry to have bothered you.

Jim