<?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: Internal : Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object. in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50267#M5530</link>
    <description>&lt;A class="user-content-mention" data-sign="@" data-contactkey="c6c6cfb7-50c2-4300-9c05-22d03d1fa6d4" data-tag-text="@vikas kalwala" href="https://community.blueprism.com/network/profile?UserKey=c6c6cfb7-50c2-4300-9c05-22d03d1fa6d4" data-itemmentionkey="1666824b-ab8c-4af2-a356-e6bc2f1dba51"&gt;@vikas kalwala&lt;/A&gt;,&lt;BR /&gt;&lt;BR /&gt;So you're using an API key. Does that need to be placed in the Authorization header, and is it considered a &lt;STRONG&gt;Bearer&lt;/STRONG&gt; token? If so, you do not want to add it via the Headers collection. Instead, you want to set the &lt;STRONG&gt;User Bearer Token&lt;/STRONG&gt; property to &lt;STRONG&gt;True&lt;/STRONG&gt; and then place your API key in the &lt;STRONG&gt;Bearer Token&lt;/STRONG&gt; property.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="16499.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/16660i9BC09931C9E2109E/image-size/large?v=v2&amp;amp;px=999" role="button" title="16499.png" alt="16499.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,​&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Eric Wilson&lt;BR /&gt;Director, Integrations and Enablement&lt;BR /&gt;Blue Prism Digital Exchange&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Thu, 17 Nov 2022 13:15:00 GMT</pubDate>
    <dc:creator>ewilson</dc:creator>
    <dc:date>2022-11-17T13:15:00Z</dc:date>
    <item>
      <title>Internal : Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50264#M5527</link>
      <description>Hi , Facing the Internal : Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object issue when I try to use the HTTP post request. I tested it via postman and able to get the response but the same inputs are not working in BP.&lt;BR /&gt;&lt;BR /&gt;Could someone please help me on this. Attaching the screenshots for the same.&lt;BR /&gt;&lt;BR /&gt;Here is the code.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Try&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim request As WebRequest = WebRequest.Create(addressURL)&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;If forcePreAuth Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;'Sometimes a web server will require the authorisation header in the initial request&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;'In which case we have to add the basic authorization header manually.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim bytes() As Byte = System.Text.Encoding.UTF8.GetBytes(String.Format("{0}:{1}",username,password))&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim base64 As String = Convert.ToBase64String(bytes)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;request.Headers.Add("Authorization", "Basic " &amp;amp; base64)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Else&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If Not String.IsNullOrEmpty(username) AndAlso Not String.IsNullOrEmpty(password) Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;request.Credentials = New NetworkCredential(username,password)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;If useProxy Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim proxyURI As New Uri(proxyURL)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim proxy As New WebProxy(proxyURI, True)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim proxyCred As New NetworkCredential(proxyUsername, proxyPassword)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim credCache As New CredentialCache()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;credCache.Add(proxyURI, "Basic", proxyCred)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;proxy.UseDefaultCredentials = False&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;proxy.Credentials = credCache&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;request.Proxy = proxy&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;request.Method = method&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;request.ContentType = contentType&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim httpRequest As HttpWebRequest = TryCast(request, HttpWebRequest)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If httpRequest IsNot Nothing Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If Not String.IsNullOrEmpty(accept) Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;httpRequest.Accept = accept&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If Not String.IsNullOrEmpty(certID) Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;httpRequest.ClientCertificates.Add(m_Certificates(certID))&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;For Each r As DataRow In headers.Rows&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;For Each c As DataColumn In headers.Columns&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim columnName As String = c.ColumnName&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim val As String = r(columnName).ToString&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;request.Headers.Add(columnName,val)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Exit For 'Only one row is allowed&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;' Normal stream writer, we aren't encoding a file etc.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If Not usingFile Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;If Not String.IsNullOrEmpty(body) Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim requestStream As IO.Stream = request.GetRequestStream()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Using sw As New IO.StreamWriter(requestStream, New Text.UTF8Encoding(False))&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;sw.Write(body)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End Using&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Else If usingFile Then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;' Prep the request body&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim byteArray = File.ReadAllBytes( body )&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim requestStream As IO.Stream = request.GetRequestStream()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;requestStream.Write(byteArray,0, byteArray.Length)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End If&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Using response As WebResponse = request.GetResponse()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim responseStream As IO.Stream = response.GetResponseStream()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim sr As New IO.StreamReader(responseStream)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;resultData = sr.ReadToEnd()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End Using&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Catch e As WebException&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Using response As WebResponse = e.Response&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim httpResponse As HttpWebResponse = CType(response, HttpWebResponse)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Using data As Stream = response.GetResponseStream()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Using reader = New StreamReader(data)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dim text As String = reader.ReadToEnd()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;resultData = resultData + text&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End Using&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End Using&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End Using&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;End Try&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;vikas kalwala&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Nov 2022 00:30:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50264#M5527</guid>
      <dc:creator>Adharv</dc:creator>
      <dc:date>2022-11-17T00:30:00Z</dc:date>
    </item>
    <item>
      <title>RE: Internal : Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50265#M5528</link>
      <description>&lt;A class="user-content-mention" data-sign="@" data-contactkey="c6c6cfb7-50c2-4300-9c05-22d03d1fa6d4" data-tag-text="@vikas kalwala" href="https://community.blueprism.com/network/profile?UserKey=c6c6cfb7-50c2-4300-9c05-22d03d1fa6d4" data-itemmentionkey="e3fe34d3-fefb-4305-9407-bad2254c2d83"&gt;@vikas kalwala&lt;/A&gt;,&lt;BR /&gt;&lt;BR /&gt;So you're using the &lt;STRONG&gt;Utility - HTTP&lt;/STRONG&gt; VBO, correct?​ If so, are you using the latest version from the DX (see the link below)? Can you paste a screenshot of the properties you've set for the action?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://digitalexchange.blueprism.com/dx/entry/3439/solution/utility---http" target="_blank" rel="noopener"&gt;https://digitalexchange.blueprism.com/dx/entry/3439/solution/utility---http&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Eric Wilson&lt;BR /&gt;Director, Integrations and Enablement&lt;BR /&gt;Blue Prism Digital Exchange&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Nov 2022 02:39:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50265#M5528</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2022-11-17T02:39:00Z</dc:date>
    </item>
    <item>
      <title>RE: Internal : Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50266#M5529</link>
      <description>When I use the HTTP VBO from the link you mentioned its throwing the error-&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Exception: The underlying connection was closed: An unexpected error occurred on a send.&lt;/STRONG&gt;&lt;BR /&gt;&lt;B&gt;Inner Exception: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;I use HTTP request action with &lt;STRONG&gt;Header&lt;/STRONG&gt;,&lt;STRONG&gt; Body&lt;/STRONG&gt;(with JSON text) and &lt;STRONG&gt;address URL&lt;/STRONG&gt;.&lt;BR /&gt;&lt;STRONG&gt;Force pre auth&lt;/STRONG&gt;- False,&lt;BR /&gt;&lt;STRONG&gt;Use proxy&lt;/STRONG&gt; - False &amp;amp; &lt;STRONG&gt;Content-Type&lt;/STRONG&gt;- application/json&lt;BR /&gt;&lt;BR /&gt;In the &lt;STRONG&gt;Headers&lt;/STRONG&gt; collection I pass only the API key.&lt;BR /&gt;&lt;BR /&gt;With the one header(api key) it&amp;nbsp; is working in postman but not in BP.&lt;BR /&gt;&lt;BR /&gt;Sorry I am unable to upload the screenshot as Iam in restricted network.&lt;BR /&gt;&lt;B&gt;&amp;nbsp;&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;vikas kalwala&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Nov 2022 03:25:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50266#M5529</guid>
      <dc:creator>Adharv</dc:creator>
      <dc:date>2022-11-17T03:25:00Z</dc:date>
    </item>
    <item>
      <title>RE: Internal : Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50267#M5530</link>
      <description>&lt;A class="user-content-mention" data-sign="@" data-contactkey="c6c6cfb7-50c2-4300-9c05-22d03d1fa6d4" data-tag-text="@vikas kalwala" href="https://community.blueprism.com/network/profile?UserKey=c6c6cfb7-50c2-4300-9c05-22d03d1fa6d4" data-itemmentionkey="1666824b-ab8c-4af2-a356-e6bc2f1dba51"&gt;@vikas kalwala&lt;/A&gt;,&lt;BR /&gt;&lt;BR /&gt;So you're using an API key. Does that need to be placed in the Authorization header, and is it considered a &lt;STRONG&gt;Bearer&lt;/STRONG&gt; token? If so, you do not want to add it via the Headers collection. Instead, you want to set the &lt;STRONG&gt;User Bearer Token&lt;/STRONG&gt; property to &lt;STRONG&gt;True&lt;/STRONG&gt; and then place your API key in the &lt;STRONG&gt;Bearer Token&lt;/STRONG&gt; property.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="16499.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/16660i9BC09931C9E2109E/image-size/large?v=v2&amp;amp;px=999" role="button" title="16499.png" alt="16499.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,​&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Eric Wilson&lt;BR /&gt;Director, Integrations and Enablement&lt;BR /&gt;Blue Prism Digital Exchange&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Nov 2022 13:15:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/50267#M5530</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2022-11-17T13:15:00Z</dc:date>
    </item>
  </channel>
</rss>

