8 Replies Latest reply: Jan 24, 2013 2:25 AM by Anju Gopinath RSS

    reload fails when client and server are on different systems.

      Hi,

       

      I am facing a problem regarding reload.The report is on the server machine.

      I came up with this for reload.

       

      Sub External

          Set WSHShell = CreateObject("Wscript.Shell")

           'WSHShell.Run("D:\testserver.bat")                

           dim strCommand

          dim strReturnValue

          strCommand = chr(34) & "C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe"  & chr(34) & _

      " -r=" & chr(34) & "C:\QlikViewMount\reloadvictim.qvw" & chr(34)

          Set WshShell = CreateObject("WScript.Shell")

      strReturnValue = WshShell.Run (strCommand, 0, true)

      ActiveDocument.SetClearState

      ActiveDocument.Variables("vReloadStatus").SetContent "1", true

       

      This works fine when i invoke the macro in the server via IE.

       

      But, when I do it from a different system,  accessing the system via:

      http://10.113.58.1/QvAjaxZfc/AccessPoint.aspx?open=&id=localhost%7Creloadvictim.qvw&client=Ajax

       

      it tries to find the .exe on the client,(I believe that is what is happening...I put the command into a .bat file in the local system, and the cmd window popped up momentarily.).But, on the server, I get a log saying,

       

      Error: SQL Error:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

      1/14/2013 10:28:40 AM:       SQL State:IM002

      1/14/2013 10:28:40 AM:       General Script Error

      1/14/2013 10:28:40 AM:       Execution Failed

      1/14/2013 10:28:40 AM:      Execution finished.

       

      So, I am not really sure what is happening. What should I do so that reload happens on the remote server?

       

      Thanks and Regards,

      Anju

       


        • Re: reload fails when client and server are on different systems.

          I modified the command so that it looks into the shared folder. This works when I execute it on the desktop, but not via IE.

          strCommand = chr(34) & "\\optimatest\Distribution Service\QlikviewDistributionService.exe"  & chr(34) & _

          " -r=" & chr(34) & "\\optimatest\QlikViewMount\reloadvictim.qvw" & chr(34)

           

          How should I modify it so that IE picks up the path?

            • Re: reload fails when client and server are on different systems.

              Hi,

               

              I tried this

               

              Sub winprocess

                  strComputer = "optimatest"

                      strCommand = chr(34) & "C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe"  & chr(34) & _

              " -r=" & chr(34) & "C:\QlikViewMount\reloadvictim.qvw" & chr(34)

                Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

                  Set objProcess = objWMIService.Get("Win32_Process")

              errReturn = objProcess.Create(strCommand, null, null, intProcessID)

              If errReturn = 0 Then

                  'Wscript.Echo "notepad.exe was started with a process ID: " & intProcessID

                  ActiveDocument.Variables("vReloadStatus").SetContent "1", true

                  'Else

                  'Wscript.Echo "notepad.exe could not be started due to error: " & errReturn

                  End If

               

              End Sub

               

              but it gave the error: Permission denied 'GetObject'

               

              I should be able to login to this system and then do an ODBC connect !

              How do I achieve this?

               

              Thanks and Regards,

              Anju

                • Re: reload fails when client and server are on different systems.

                  Hi,

                   

                  The third method I am thinking of ....:)...which seems to be the best one going by previous posts...

                   

                  I have this script.. whose invocation syntax is

                  trigger-qds taskName taskPassword

                   

                  '
                  '     Start a Publisher EDX Task
                  '
                  QDS = "http://localhost:4720/qtxs.asmx"

                  argc = WScript.Arguments.Count
                  if argc <> 2 then
                  Wscript.Echo "Usage: trigger-qds.vbs taskName taskPassword"
                  Wscript.Quit
                  end if

                  EDXTASK = WScript.Arguments.Item(0)
                  EDXPSWD = WScript.Arguments.Item(1)

                  '<Global method="RequestEDX">
                  ' <i_TaskIDOrTaskName>Reload_BBCnews</i_TaskIDOrTaskName>
                  ' <i_Password>password</i_Password>
                  '</Global>

                  REQUEST = "<Global method=""RequestEDX"">"
                  REQUEST = REQUEST & "<i_TaskIDOrTaskName>" & EDXTASK & "</i_TaskIDOrTaskName>"
                  REQUEST = REQUEST & "<i_Password>" & EDXPSWD & "</i_Password>"
                  REQUEST = REQUEST & "</Global>"

                  ' execute the request
                  dim xmlHttp
                  set xmlHttp = createobject("Microsoft.XMLHTTP")
                  xmlHttp.open "POST", QDS, False
                  xmlHttp.setRequestHeader "Content-Type", "text/xml"
                  xmlHttp.Send REQUEST

                  ' show the response
                  'WScript.Echo xmlHttp.responseText

                  ' Load the Response into an XML object
                  dim xml
                  set xml = createobject("Microsoft.XMLDOM")
                  xml.async = false
                  xml.loadXML(xmlHttp.responseText)

                  ' Build an XSLT string to extract the TaskStartResult from the XML response
                  XSLT =        "<xsl:stylesheet version=""1.0"""
                  XSLT = XSLT & " xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"">"
                  XSLT = XSLT & "<xsl:template match=""/"">"
                  XSLT = XSLT & "<xsl:for-each select=""RequestEDX/RequestEDXResult"">"
                  XSLT = XSLT & "<xsl:value-of select=""TaskStartResult""/>"
                  XSLT = XSLT & "</xsl:for-each>"
                  XSLT = XSLT & "</xsl:template>"
                  XSLT = XSLT & "</xsl:stylesheet>"
                  'WScript.Echo XSLT
                  ' Load the XSLT into an XML object
                  dim xsl
                  set xsl = createobject("Microsoft.XMLDOM")
                  xsl.async = false
                  xsl.loadXML(XSLT)

                   

                  ' Transform the XML result to extract the TaskStartResult
                  ' then skip the first 40 bytes of XML Header
                  RESULT = Mid(xml.transformNode(xsl),40,99)

                  Select case RESULT
                      Case "Success":
                  RC = 0
                      Case "TaskNotFound":
                  RC = 1
                      Case "OtherError":
                  RC = 2
                      Case Other
                  RC = 90
                  End Select

                  WScript.Echo RESULT
                  WScript.Quit RC

                   

                   

                  but could someone tell me what EDXTASK and EDXPSWD are:  is edxtask another batch file which contains 'C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe' -r "C:\QlikViewMount\reloadvictim.qvw"' ? but then what is edxpswd?

                   

                  Thanks and Regards,

                  Anju