<?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>Question Re: Problems with Patch in C# Console App - Don't Work -... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792159#M4841242</link>
    <description>It would be also worth trying to specify TLS version e.g. 1.2 if you use B1 10.0, and try /b1s/v2 to be compatiable with OData V4 because otherwise I don't see an issue.</description>
    <pubDate>Mon, 12 Aug 2024 23:33:20 GMT</pubDate>
    <dc:creator>EunSeok_Bang</dc:creator>
    <dc:date>2024-08-12T23:33:20Z</dc:date>
    <item>
      <title>Problems with Patch in C# Console App - Don't Work - Error 500</title>
      <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaq-p/13789949</link>
      <description>&lt;P&gt;Hello community, I hope you can help me, we are developing a console application with C#.&lt;/P&gt;&lt;P&gt;When we test via POSTMAN, everything works and updates the records, but when we do it via C# it doesn't work.&lt;/P&gt;&lt;P&gt;We share with you 2 approaches with which we test in C3 and both approaches fail.&lt;/P&gt;&lt;P&gt;Our code :&lt;/P&gt;&lt;P&gt;from this repo&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/adrian-scan4sap/code-queries-sl/blob/main/code-queries-sl/Program.cs" target="_self"&gt;https://github.com/adrian-scan4sap/code-queries-sl/blob/main/code-queries-sl/Program.cs&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;public static async Task TestPatch(){ 
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
                string baseUrl = "https://1.10.80.20:40000/b1s/v1/";
                ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) =&amp;gt; true;
                string businessPartnerUrl = $"{baseUrl}/BusinessPartners('USA140FGH82500')";

                // Create a JSON payload for the new Business Partner
                JObject businessPartnerData = new JObject
            {
                { "CardCode", "USA140FGH82500" }, // Provide a unique Business Partner code
                {
                    "ContactEmployees", new JArray
                    {
                        new JObject
                        {
                            { "Name", "Example Name 1..." },
                        }
                    }
                }
            };
                try
                {
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(businessPartnerUrl);
                    request.Method = "PATCH";
                    request.ContentType = "application/json";
                    request.Accept = "application/json";
                    request.Headers.Add("Cookie", $"B1SESSION={'7545-8455-SA-TOKEN'}");
                    using (var streamWriter = new StreamWriter(request.GetRequestStream()))
                    {
                        streamWriter.Write(businessPartnerData.ToString());
                        streamWriter.Flush();
                        streamWriter.Close();
                    }
                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    {
                        if (response.StatusCode == HttpStatusCode.NoContent)
                        {
                            Console.WriteLine("Business Partner Contact updated successfully.");
                        }
                        else
                        {
                            Console.WriteLine("Failed to update Business Partner Contact. Status code: " + response.StatusCode);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An error occurred while updating the Business Partner Contact: " + ex.Message);
                }&lt;/LI-CODE&gt;&lt;P&gt;Result :&amp;nbsp; Error 500 !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please, can someone give us some help, some link, some repository, some code?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Aug 2024 04:49:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaq-p/13789949</guid>
      <dc:creator>MikeRojas</dc:creator>
      <dc:date>2024-08-10T04:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Patch in C# Console App - Don't Work - Error 500</title>
      <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13789952#M4840959</link>
      <description>Video from code : &lt;A href="https://www.youtube.com/watch?v=AUNVFHKAYPY" target="_blank"&gt;https://www.youtube.com/watch?v=AUNVFHKAYPY&lt;/A&gt;</description>
      <pubDate>Sat, 10 Aug 2024 04:52:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13789952#M4840959</guid>
      <dc:creator>MikeRojas</dc:creator>
      <dc:date>2024-08-10T04:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Patch in C# Console App - Don't Work - Error 500</title>
      <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13791157#M4841095</link>
      <description>&lt;P&gt;Hello MikeRojas,&lt;/P&gt;&lt;P&gt;it looks like you are triing to create a new BP. In this case you need to use post and not patch:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mwalter_SUND_0-1723452053790.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/150225i4DC673831808F87D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mwalter_SUND_0-1723452053790.png" alt="mwalter_SUND_0-1723452053790.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 08:40:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13791157#M4841095</guid>
      <dc:creator>mw_SUND</dc:creator>
      <dc:date>2024-08-12T08:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Patch in C# Console App - Don't Work -...</title>
      <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13791895#M4841202</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are some suspictions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Make sure the Service layer port is 40000. the port 40000 is typically used for SLD service. the default Service Layer port is 50000.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string baseUrl = "https://1.10.80.20:40000/b1s/v1/";&lt;/LI-CODE&gt;&lt;P&gt;2. The variable for B1 session id "7545-8455-SA-TOKEN" looks strange. make sure if you used the correct variable to hold the the session id through login.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;request.Headers.Add("Cookie", $"B1SESSION={'7545-8455-SA-TOKEN'}");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;3. As a general tip, it would be helpful to test with a simpler JSON format, for example, GET BP to isolate the issue from JSON format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;BR /&gt;EunSeok&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 15:24:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13791895#M4841202</guid>
      <dc:creator>EunSeok_Bang</dc:creator>
      <dc:date>2024-08-12T15:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Patch in C# Console App - Don't Work -...</title>
      <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792047#M4841230</link>
      <description>Hi &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/9038"&gt;@EunSeok_Bang&lt;/a&gt; If the port we are using is 50000, we only put 40 for example and the token was also an example. We decided to test with PHP, NodeJS and Python and the PATCH worked perfectly in all of them, but the PATCH did not work in C#.</description>
      <pubDate>Mon, 12 Aug 2024 19:03:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792047#M4841230</guid>
      <dc:creator>MikeRojas</dc:creator>
      <dc:date>2024-08-12T19:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Patch in C# Console App - Don't Work -...</title>
      <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792156#M4841241</link>
      <description>Hi Mike, does it mean you succeeded with other methods like GET and POST, and only not successful with PATCH?</description>
      <pubDate>Mon, 12 Aug 2024 23:31:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792156#M4841241</guid>
      <dc:creator>EunSeok_Bang</dc:creator>
      <dc:date>2024-08-12T23:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Patch in C# Console App - Don't Work -...</title>
      <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792159#M4841242</link>
      <description>It would be also worth trying to specify TLS version e.g. 1.2 if you use B1 10.0, and try /b1s/v2 to be compatiable with OData V4 because otherwise I don't see an issue.</description>
      <pubDate>Mon, 12 Aug 2024 23:33:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792159#M4841242</guid>
      <dc:creator>EunSeok_Bang</dc:creator>
      <dc:date>2024-08-12T23:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Patch in C# Console App - Don't Work -...</title>
      <link>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792162#M4841244</link>
      <description>hi &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/9038"&gt;@EunSeok_Bang&lt;/a&gt; , only with PATCH</description>
      <pubDate>Mon, 12 Aug 2024 23:42:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/problems-with-patch-in-c-console-app-don-t-work-error-500/qaa-p/13792162#M4841244</guid>
      <dc:creator>MikeRojas</dc:creator>
      <dc:date>2024-08-12T23:42:20Z</dc:date>
    </item>
  </channel>
</rss>

