Script with not executing Web.PostJson

Hello, I wrote a script and it uses the function web.PostJson but it returns nothing when executing it in windows 7 but when is executed in w10 it works fine, I’ve tried in 3 pcs with w7 and it’s the same issue, I’ve installed IE11 by a recommendation in the forum but it doesn’t work, any of you had this problem before?

Is the API using SSL (https)?

20characters

Yes, its using SSL, maybe is the TLS version in W7 because others API that does not require SLL works fine

It will likely be tls version, you need to update a couple of regedit lines. There is a topic on forum when I faced the same issue

In c# there’s some additional code for webclient to force a SSL handshake (ServicePointManager), or bypass the certificate check (RemoteCertificateValidationCallback) and return true. I don’t know how that would be passed in the script. I’ve hit a brick wall with it because of the cyphers used for the SSL certificate. If you can open the site in Chrome and Firefox but not IE, you’re most likely experiencing the same issue as Chrome and Firefox don’t use the same libraries for https.

Head to https://www.ssllabs.com/ssltest/ and test the site.

Look for the W7 section of the analysis. Here’s for my site:

2020-08-05_05;32_1596627134_firefox

The SSL cyphers are incompatible for W7-W8.1.

EDIT:

Here’s JTR’s post:

FWIW, those registry entries didn’t change anything for me.

If you edit %ProgramFiles(x86)%\SambaPOS5\Samba.Presentation.exe.config with the text pasted below, it will log System.Net calls.

Close SambaPOS and make a backup/copy of Samba.Presentation.exe.config. YOu’ll need that afterwards to replace the edited file.

Paste the code just above </configuration>:
2020-08-05_06;07_1596629272_Notepad2

<system.diagnostics>
    <trace autoflush="true" />
    <sources>
        <source name="System.Net">
            <listeners>
                <add name="System.Net" />
            </listeners>
        </source>
        <source name="System.Net.Sockets">
            <listeners>
                <add name="System.Net" />
            </listeners>
        </source>
        <source name="System.Net.Cache">
            <listeners>
                <add name="System.Net" />
            </listeners>
        </source>
    </sources>
    <sharedListeners>
        <add
            name="System.Net"
            type="System.Diagnostics.TextWriterTraceListener"
            initializeData="System.Net.trace.log"
        />
    </sharedListeners>
    <switches>
        <add name="System.Net" value="Verbose" />
        <add name="System.Net.Sockets" value="Verbose" />
        <add name="System.Net.Cache" value="Verbose" />
    </switches>
</system.diagnostics>

After SambaPOS starts, you will want to clear System.Net.trace.log (located in %ProgramFiles(x86)%\SambaPOS5\) before you try your API call. THere’s a lot of information that’s dumped in the log.

Make your API call and open the log file. From what I’ve been able to find, if you see "The request was aborted: Could not create SSL/TLS secure channel" (like I do), you may be SOL.

I can’t say there isn’t a solution, but I’ve given up trying to find one. I’ll just fallback to http on < W10 machines.

EDIT 2:

You’ll find the line/error I was talking about at the end of the call log. It may look something like this:

System.Net.Sockets Verbose: 0 : [10676] Entering Socket#24827179::Dispose()
System.Net Error: 0 : [10676] Exception in HttpWebRequest#6480969:: - The request was aborted: Could not create SSL/TLS secure channel..
System.Net Error: 0 : [10676] Exception in HttpWebRequest#6480969::EndGetRequestStream - The request was aborted: Could not create SSL/TLS secure channel.

Don’t forget to copy the backup file over the edited one as that log file will grow quickly.

Also what version of samba you using? I found I had issues after updating to 5.3 using windows 7, presuming the newer .net version you need for 5.3 doesnt use those reg lines.
I found updating to windows 10 solved without need to edit reg files.

I´m going to try to log the error as @memo said, at the moment I couldn’t solve the problem, I had the 5.2.24 version but I updated to 5.3.0 but the issue was there, for now I will trigger the request in the W10 machine passing the values thru broadcast message, it would be good if the try catch error could works inside samba, or already works?