MSXML2 restful API调用在Windows Embedded Standard上不返回任何数据

时间:2018-01-09 23:18:27

标签: rest api msxml

我使用以下代码在PowerBASIC Windows应用程序中使用restful API,该应用程序返回客户的联系人和票证列表。跟踪代码在我的Windows 10 Pro系统上产生了良好的效果。

当我在同一个Windows Embedded Standard Service Pack 1系统上使用POSTman运行相同的查询时,工作正常。

在Windows Embedded Standard Service Pack 1系统上,我收到Response 0

Here is the trace results on WIndows Embedeed SP1, do not get any tickets.
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"?>
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> 



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

0 个答案:

没有答案