<?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: SAS Stored process integration from .NET using JSON input stream in Developers</title>
    <link>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/488960#M5732</link>
    <description>&lt;P&gt;Hi Nik,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response. It wasn't quite what I had hoped for. However, assuming you were the person behind the h54s&amp;nbsp;adapter your suggestion did weigh in and eventually we have settled for that way of integration. Thanks for the help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Br, Michael&lt;/P&gt;</description>
    <pubDate>Wed, 22 Aug 2018 16:14:20 GMT</pubDate>
    <dc:creator>Berliner_Ørsted</dc:creator>
    <dc:date>2018-08-22T16:14:20Z</dc:date>
    <item>
      <title>SAS Stored process integration from .NET using JSON input stream</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/476416#M5730</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are experiencing issues with establishing a connection between a .NET application and SAS where we want to call SAS Stored Processes using an input data stream in JSON format. We are currently on 9.3 M2 albeit we should be migrating to 9.4 within the next quarter or two.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue we are facing is that when we call the stored process from .NET the process seems to hang. We are unsure whether we are not calling the stored process correctly or whether we have not set it up correctly. Any help on how to call SAS Stored processes from .NET is welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what we are doing currently&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. The SAS program. To simplify we are initially just trying to copy the input stream to an output stream. The first step is to use the following SAS program, inspired by the &lt;A href="http://support.sas.com/documentation/cdl/en/wbsvcdg/62759/HTML/default/viewer.htm#n1uog7i35wm2hzn1mml529a2r11m.htm" target="_blank"&gt;documentation&lt;/A&gt;, which works:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename orig "f:\&amp;lt;path&amp;gt;\orig.txt";
filename copy "f:\&amp;lt;path&amp;gt;\copy.txt";
data _null_;
 infile orig ;
 file copy;
 INPUT ;
 put _INFILE_;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;2. The stored process:&amp;nbsp;To adapt the SAS program to the stored process I remove the physical file ref ‘orig’ and instead use a fileref instream as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename copy "f:\AA_SchedOpt\AA_source\macros\copy.txt";
data _null_;
 infile instream;
 file copy;
 INPUT ;
 put _INFILE_;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;while&amp;nbsp;registering a stored process called ‘instream_TEST’ with the code and a data source named instream as illustrated here&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 708px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21647i062DA92CD3294BAB/image-dimensions/708x588?v=v2" width="708" height="588" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;Note that the chosen content type is set to application/x-www-form-urlencoded. I am unsure whether this is correct but relying on documentation &lt;A href="http://support.sas.com/documentation/cdl/en/wbsvcdg/62759/HTML/default/viewer.htm#n0e44v8zffokk6n1b5uu2alusw8p.htm" target="_blank"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The .NET side&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is how we are trying to call the SAS STP from the .NET side&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using (var client = new WebClient { UseDefaultCredentials = true })&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var instream = new WorkOrderModel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Description = "Test"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.BaseAddress = _baseUrl;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var subUrl = $"/SASStoredProcess/do?_program=/&amp;lt;server&amp;gt;/STP/instream_TEST&amp;amp;_username={user}&amp;amp;_password={pw}";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return client.UploadString(subUrl, JsonConvert.SerializeObject(instream));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody point to where we should be looking to debug out integration?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 12:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/476416#M5730</guid>
      <dc:creator>Berliner_Ørsted</dc:creator>
      <dc:date>2018-07-09T12:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Stored process integration from .NET using JSON input stream</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/479926#M5731</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend that you attach your data payload as a file upload component of a multipart form data POST body, rather than as a named/defined stream.&amp;nbsp;The&amp;nbsp;fileref for your input file will then be assigned dynamically by the STP webapp as documented&amp;nbsp;&lt;A href="http://support.sas.com/rnd/web/intrnet/dispatch/webin.html" target="_self"&gt;here&lt;/A&gt;. You can then substitute your &lt;STRONG&gt;instream&lt;/STRONG&gt; fileref with &lt;STRONG&gt;&amp;amp;_WEBIN_FILEREF&lt;/STRONG&gt;, the value of which will typically be that dynamically assigned fileref that looks something like #LN00012, pointing to the temporary uploaded copy of your input file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, consider sending your data to sas as csv over json. It's much faster &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nik&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 15:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/479926#M5731</guid>
      <dc:creator>boemskats</dc:creator>
      <dc:date>2018-07-20T15:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Stored process integration from .NET using JSON input stream</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/488960#M5732</link>
      <description>&lt;P&gt;Hi Nik,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response. It wasn't quite what I had hoped for. However, assuming you were the person behind the h54s&amp;nbsp;adapter your suggestion did weigh in and eventually we have settled for that way of integration. Thanks for the help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Br, Michael&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 16:14:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/488960#M5732</guid>
      <dc:creator>Berliner_Ørsted</dc:creator>
      <dc:date>2018-08-22T16:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Stored process integration from .NET using JSON input stream</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/488964#M5733</link>
      <description>&lt;P&gt;Cool! FYI in the next couple of weeks we'll be releasing 'v1' of h54s. Very few changes in terms of syntax, but&amp;nbsp;&lt;A href="https://github.com/Boemska/h54s/issues/26#issuecomment-287543043" target="_self"&gt;a substantial performance improvement&lt;/A&gt;&amp;nbsp;for data payloads bigger than a few KB.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck, feel free to get in touch privately if you hit any snags.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nik&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 16:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Stored-process-integration-from-NET-using-JSON-input-stream/m-p/488964#M5733</guid>
      <dc:creator>boemskats</dc:creator>
      <dc:date>2018-08-22T16:24:00Z</dc:date>
    </item>
  </channel>
</rss>

