Author Topic: MSXML2 restful API call returns no data on Windows Embedded Standard  (Read 244 times)

0 Members and 1 Guest are viewing this topic.

Offline Douglas Martin

  • Newbie
  • *
  • Posts: 28
  • Gender: Male
    • ProfiTouch
I use the following code to consume restful apis which return lists of contacts and tickets for a customer.  The trace code produces good results on my Windows 10 Pro system.

On the Windows Embedded Standard Service Pack 1 system I get Response=<<> 0<>>

50 PTDEBUGPyriTeamSupportApi = 50=True
15:58:49>TEAMSUPP_GETCUSTKTS URLPath=</xml/Customers/1103428/Tickets>
15:58:49>TeamSupportAPI Open bstrURL=https://app.teamsupport.com/api/xml/Customers/1103428/Tickets
15:58:49>TeamSupportAPI Send Verb=GET bstrURL=https://app.teamsupport.com/api/xml/Customers/1103428/Tickets XML=
15:58:49>TeamSupportAPI Response=<<> 0<>>
15:58:49>TEAMSUPP_GETCUSTKTS Response=<<> 0<>>
15:58:49>TeamSupportAPI Open bstrURL=https://app.teamsupport.com/api/xml/Customers/1103428/Contacts
15:58:49>TeamSupportAPI Send Verb=GET bstrURL=https://app.teamsupport.com/api/xml/Customers/1103428/Contacts XML=
15:58:49>TeamSupportAPI Response=<<> 0<>>

Results on Windows 10 Pro system I get Response=<<?xml version="1.0" encoding="utf-8"?>
<Tickets>
  <Ticket>
...
    <Tags />
  </Ticket>
</Tickets><> 200<>OK>



15:52:02>TeamSupportAPI Open bstrURL=https://app.teamsupport.com/api/xml/Customers/1103428/Tickets
15:52:02>TeamSupportAPI Send Verb=GET bstrURL=https://app.teamsupport.com/api/xml/Customers/1103428/Tickets XML=
15:52:12>TeamSupportAPI Response=<<?xml version="1.0" encoding="utf-8"?>
<Tickets>
  <Ticket>
...
    <Tags />
  </Ticket>
</Tickets><> 200<>OK>


15:52:12>TeamSupportAPI Open bstrURL=https://app.teamsupport.com/api/xml/Customers/1103428/Contacts
15:52:12>TeamSupportAPI Send Verb=GET bstrURL=https://app.teamsupport.com/api/xml/Customers/1103428/Contacts XML=
15:52:12>TeamSupportAPI Response=<<?xml version="1.0" encoding="utf-8"?>
<Contacts>
  <Contact>
    <Email>averspizza@msn.com</Email>
    <FirstName>Brad </FirstName>
    <ContactID>3824219</ContactID>
    <MiddleName />
    <LastName>Randall</LastName>
    <Title />
    <IsActive>True</IsActive>
    <LastLogin>5/9/2016 1:31 PM</LastLogin>
    <LastActivity>5/9/2016 12:31 PM</LastActivity>
    <LastPing />
    <IsPortalUser>False</IsPortalUser>
    <PrimaryGroupID />
    <InOffice>False</InOffice>
    <InOfficeComment />
    <ActivatedOn>5/9/2016 1:31 PM</ActivatedOn>
    <DeactivatedOn />
    <OrganizationID>1103428</OrganizationID>
    <Organization>Avers North</Organization>
    <DateCreated>5/9/2016 1:31 PM</DateCreated>
    <DateModified>5/9/2016 1:31 PM</DateModified>
    <CreatorID>3526274</CreatorID>
    <ModifierID>3526274</ModifierID>
    <DisableOrganizationTicketsViewOnPortal>False</DisableOrganizationTicketsViewOnPortal>
    <PortalViewOnly>False</PortalViewOnly>
    <BlockInboundEmail>False</BlockInboundEmail>
    <EMail2 />
    <isar>False</isar>
  </Contact>
</Contacts><> 200<>OK>


Code: [Select]
FUNCTION TeamSupportAPI(BYVAL Verb AS STRING, BYVAL XMLString AS STRING, BYVAL URLPath AS STRING) AS STRING
   LOCAL objHTTP AS IXMLHTTPRequest
   LOCAL bstrURL AS WSTRING
   LOCAL bstrResponse AS WSTRING
   LOCAL vXML AS VARIANT
   vXML = XMLString
   objHTTP = NEWCOM "Msxml2.ServerXMLHTTP.6.0"
   IF ISNOTHING(objHTTP) THEN
     IF PTDebugCfgVal(%PTDEBUGPyriTeamSupportApi) THEN WriteDebugLogFile("TeamSupportAPI objHTTP is Nothing")
     EXIT FUNCTION
   END IF
   ' Opens an HTTP connection to an HTTP resource
   bstrURL = "https://app.teamsupport.com/api"
   '15:20:00>Open bstrURL=https://app.teamsupport.com/api/xml/Tickets//Actions   
   bstrURL = bstrURL + URLPath
   objHTTP.Open Verb, bstrURL, 0, $orgID, $apiToken
   ' Sends an HTTP request to the HTTP server
   IF PTDebugCfgVal(%PTDEBUGPyriTeamSupportApi) THEN WriteDebugLogFile("TeamSupportAPI Open bstrURL="+bstrURL)
   objHTTP.SetRequestHeader "Authorization", "Basic " + Get_Base64_Encode($orgID & ":" & $apiToken)
   objHTTP.SetRequestHeader "Cache-Control", "max-age=0"
   objHTTP.SetRequestHeader "Access-Control-Allow-Origin", "*"
   objHTTP.SetRequestHeader "Access-Control-Allow-Headers", "*"
   objHTTP.SetRequestHeader "Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT"
   '15:20:00>Send Verb=POST bstrURL=https://app.teamsupport.com/api/xml/Tickets//Actions XML=<Ticket><TicketStatusID>251029</TicketStatusID>
   '<TicketTypeID>41053</TicketTypeID><TicketTypeName>Support</TicketTypeName><Name>test</Name><Description><![CDATA[<p>test</p>
   If PTDebugCfgVal(%PTDEBUGPyriTeamSupportApi) THEN WriteDebugLogFile("TeamSupportAPI Send Verb="+Verb+" bstrURL="+bstrURL+" XML="+VARIANT$(vXML))
   objHTTP.Send(vXML)
   bstrResponse = "x"
   IF objHTTP.Status = 200 THEN ' HTTP_STATUS_OK=200
      bstrResponse = objHTTP.ResponseText + "<>" + STR$(objHTTP.Status) + "<>" + objHTTP.StatusText
   ELSE
      bstrResponse = objHTTP.ResponseText + "<>" + STR$(objHTTP.Status) + "<>" + objHTTP.StatusText
   END IF
   IF PTDebugCfgVal(%PTDEBUGPyriTeamSupportApi) THEN WriteDebugLogFile("TeamSupportAPI Response=<"+TRIM$(bstrResponse)+">")
   FUNCTION = bstrResponse
END FUNCTION
  Does anyone have any idea why it does not work on the Windiws Embededd SyeTem?  I have installed all windows updates. The system has IE11 Version 10.0.9600.18124 which is the latest.

If I use POSTMAN to send the request on the Windows Embededd Standard machine it returns tickets and contacts just fine.
Doug