NetTalk Central

Author Topic: ServerWebServiceMethodWizard - Generated Code Has Errors  (Read 2887 times)

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
ServerWebServiceMethodWizard - Generated Code Has Errors
« on: December 03, 2018, 11:20:37 AM »
NT11.04, Clarion 11

After reading the docs :-) I added a Sync procedure, using the Wizard, and then tried adding a SyncAccounts procedure using ServerWebServiceMethodWizard.  The generated code for CheckForToken is missing information.  I went through the wizard a few times to make sure I wasn't missing anything and then went trough the "Actions" tab to see if anything obvious was missing.  Below is the generated code.  You can see that the ExistsValue('') and GetValue('') are missing information.  There is a line where the left side of the = is missing.  Is there something I need to add to a setting or is this a bug?

CheckForToken  routine
! Start of "Start of CheckForToken Routine"
! [Priority 5000]

! End of "Start of CheckForToken Routine"
    ! before getting started check to see if there is a token for the session ID
    If p_web.xml = 0 and p_web.json = 0 ! incoming parameters are just url encoded, either in the URL, or as post data, or as a cookie.
      If p_web.IfExistsValue('') then  = p_web.GetValue('').
    ElsIf p_web.xml = 1
      Clear()
       = strxml.between(p_web.Nocolon(lower('<token>'),Net:SingleUnderscore+Net:NoSpaces),p_web.Nocolon(lower('</token>'),Net:SingleUnderscore+Net:NoSpaces))
    ElsIf p_web.json = 1
      json.Start()
      json.RemovePrefix      = false  ! token field won't be in a structure, so no concept of prefix, so no need to remove it.
      json.ReplaceColons      = true
      json.ReplacementChars  = '_'
      strjson.SetValue(p_web.GetValue('_json_'))
      json.SetTagCase(jf:CaseLower)
      if json.LoadString(strjson) = jf:ok
        Clear()
         = json.GetPropertyValue('token',1)
      Else ! jf:error
        p_web.AddServiceError(Error:InvalidJson,'SyncAccounts', '', json.error,'Review JSON data and correct it.')
      End
    End
    if
      p_web.SessionID =
      p_web.TouchSession()
    end

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: ServerWebServiceMethodWizard - Generated Code Has Errors
« Reply #1 on: January 08, 2019, 12:54:39 PM »
Bruce, any suggestions on where to look?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11171
    • View Profile
Re: ServerWebServiceMethodWizard - Generated Code Has Errors
« Reply #2 on: January 09, 2019, 02:56:50 AM »
I've seen the IDE do this when importing the TXA (which the wizard creates).
Re-importing the TXA manually can often sort it out.

It seems that the Parameters are added to the procedure, but not "attached" to the actual local variables.
Trivial to do that manually of course (just open the parameter and set the Field value).

It seems like an IDE-importing-TXA type bug though because the -reimport of the TXA seems to work.

cheers
Bruce

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: ServerWebServiceMethodWizard - Generated Code Has Errors
« Reply #3 on: January 10, 2019, 11:35:49 AM »
Thank you.  Once I linked the Parameters to the local variables everything compiled.