<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1662566#M12072</link>
    <description>&lt;P&gt;Ok, My problem was solved. It was some restriction for using port 4242.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthermore, I learned two other things.&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; I have to use "&lt;STRONG&gt;Run Selection&lt;/STRONG&gt;" (F8) instead of "&lt;STRONG&gt;Run&lt;/STRONG&gt;" (F5)&lt;/P&gt;&lt;P&gt;unless I will get this error:&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;File C:\***\certificates\Untitled1.ps1 cannot be loaded. The file &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;C:\****\Untitled1.ps1 is not digitally signed. You cannot run this script on the current system. &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;For more information about running scripts and setting execution policy, see about_Execution_Policies at &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;https:/go.microsoft.com/fwlink/?LinkID=135170.&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;+ FullyQualifiedErrorId : UnauthorizedAccess&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;It seems it related to restriction policy in our company which may others have the same issue.&lt;/P&gt;&lt;P&gt;2. if you run the &lt;STRONG&gt;PowerShell ISE&lt;/STRONG&gt; "as administrator"&amp;nbsp; then your certificate should add to the administrator user.&lt;/P&gt;&lt;P&gt;By the way, Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/3607"&gt;@andoryuu&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jan 2020 19:33:43 GMT</pubDate>
    <dc:creator>parviz_asoodehfard</dc:creator>
    <dc:date>2020-01-03T19:33:43Z</dc:date>
    <item>
      <title>Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1657201#M11987</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm trying to access to APIs of Qlik from a client but I face with an error. This is my code:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;$hdrs = @{}&lt;BR /&gt;$hdrs.Add("X-Qlik-xrfkey","1234567890123456")&lt;BR /&gt;$hdrs.Add("X-Qlik-User","UserDirectory=****;UserId=***********")&lt;BR /&gt;$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}&lt;/P&gt;&lt;P&gt;$url = "https://*************** /qrs/app/68cc1647-8311-4bf5-8070-04f08f36b639/hubinfo?xrfkey=1234567890123456"&amp;nbsp;&lt;BR /&gt;Invoke-RestMethod -Uri $url -Method GET -Headers $hdrs -Certificate $cert&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The Error:&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.&lt;BR /&gt;At line:8 char:1&lt;BR /&gt;+ Invoke-RestMethod -Uri $url -Method GET -Headers $hdrs -Certificate $ ...&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException&lt;BR /&gt;+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Extra information:&lt;/P&gt;&lt;P&gt;- I can run it on the server and get the response correctly.&lt;BR /&gt;&lt;SPAN&gt;- The OS of server and client are Win 10 (server and client).&lt;BR /&gt;- I have access to QMC from client.&lt;BR /&gt;- the $cert on client and server after running the upper code is similar.&lt;BR /&gt;- I've added&amp;nbsp;&lt;U&gt;&lt;EM&gt;[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12&lt;/EM&gt;&amp;nbsp;&lt;/U&gt; &amp;nbsp; but it didn't solve.&lt;BR /&gt;- I've removed certificates (client.pfx and root.cer) from server and install them again and gotten the correct answer (on server) then I've done the same on the client but got the same error. [Now it seems I ruined the sandbox Qlik server :)) :((]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will be appreciate any clue.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 14:26:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1657201#M11987</guid>
      <dc:creator>parviz_asoodehfard</dc:creator>
      <dc:date>2019-12-13T14:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-RestMethod : The underlying connection was closed: An unexpected error oc...</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1657723#M12001</link>
      <description>Try adding this at the beginning&lt;BR /&gt;#Cert security settings&lt;BR /&gt;add-type @"&lt;BR /&gt;using System.Net;&lt;BR /&gt;using System.Security.Cryptography.X509Certificates;&lt;BR /&gt;public class TrustAllCertsPolicy : ICertificatePolicy {&lt;BR /&gt;public bool CheckValidationResult(&lt;BR /&gt;ServicePoint srvPoint, X509Certificate certificate,&lt;BR /&gt;WebRequest request, int certificateProblem) {&lt;BR /&gt;return true;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;"@&lt;BR /&gt;[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Dec 2019 21:37:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1657723#M12001</guid>
      <dc:creator>andoryuu</dc:creator>
      <dc:date>2019-12-13T21:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-RestMethod : The underlying connection was closed: An unexpected error oc...</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1659197#M12030</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/90961"&gt;@parviz_asoodehfard&lt;/a&gt;&amp;nbsp; did you try this?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 22:09:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1659197#M12030</guid>
      <dc:creator>andoryuu</dc:creator>
      <dc:date>2019-12-18T22:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-RestMethod : The underlying connection was closed: An unexpected error oc...</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1659531#M12036</link>
      <description>&lt;P&gt;yes, I tried but it didn't work. I suspect to the firewall, so I wanted to make sure it's not because of the firewall then I will reply you again. Thank you for your reply&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 20:50:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1659531#M12036</guid>
      <dc:creator>parviz_asoodehfard</dc:creator>
      <dc:date>2019-12-19T20:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-RestMethod : The underlying connection was closed: An unexpected error oc...</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1659554#M12037</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/90961"&gt;@parviz_asoodehfard&lt;/a&gt;&amp;nbsp; you may also need to run your PowerShell terminal as an administrator for this to succeed.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 21:48:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1659554#M12037</guid>
      <dc:creator>andoryuu</dc:creator>
      <dc:date>2019-12-19T21:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1662566#M12072</link>
      <description>&lt;P&gt;Ok, My problem was solved. It was some restriction for using port 4242.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthermore, I learned two other things.&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; I have to use "&lt;STRONG&gt;Run Selection&lt;/STRONG&gt;" (F8) instead of "&lt;STRONG&gt;Run&lt;/STRONG&gt;" (F5)&lt;/P&gt;&lt;P&gt;unless I will get this error:&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;File C:\***\certificates\Untitled1.ps1 cannot be loaded. The file &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;C:\****\Untitled1.ps1 is not digitally signed. You cannot run this script on the current system. &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;For more information about running scripts and setting execution policy, see about_Execution_Policies at &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;https:/go.microsoft.com/fwlink/?LinkID=135170.&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino"&gt;&lt;EM&gt;+ FullyQualifiedErrorId : UnauthorizedAccess&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;It seems it related to restriction policy in our company which may others have the same issue.&lt;/P&gt;&lt;P&gt;2. if you run the &lt;STRONG&gt;PowerShell ISE&lt;/STRONG&gt; "as administrator"&amp;nbsp; then your certificate should add to the administrator user.&lt;/P&gt;&lt;P&gt;By the way, Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/3607"&gt;@andoryuu&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2020 19:33:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1662566#M12072</guid>
      <dc:creator>parviz_asoodehfard</dc:creator>
      <dc:date>2020-01-03T19:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1845289#M15716</link>
      <description>&lt;P&gt;Can you elaborate how you managed to fix the 4242 port restriction?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 07:22:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Invoke-RestMethod-The-underlying-connection-was-closed-An/m-p/1845289#M15716</guid>
      <dc:creator>Snejqu</dc:creator>
      <dc:date>2021-10-12T07:22:18Z</dc:date>
    </item>
  </channel>
</rss>

