Month: August 2020

Catalina API Error Not Able to Load Assembly

Catalina API Error Not Able to Load Assembly

Question

When I try to access Catalina’s API for Dynamics SL, I am getting an error that looks like this. What is the problem, and how can I fix it?

Answer:

Look at the web.config of your ctDynamicsSL web application and remove the section <system.codedom>. So looking below, just remove this total section from your web.config

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
Call Custom Stored Procedure via Catalina’s RESTful API for Dynamics SL

Call Custom Stored Procedure via Catalina’s RESTful API for Dynamics SL

Catalina has had a way to call custom stored procedures from their SOAP based web services for Dynamics SL for years.  You can now do it using the RESTful API version.

Looking at the Swagger Documentation, you can now see a customSQL resource (If you don’t see this, contact Catalina Support to see about getting updated to the latest version of Catalina API for Dynamics SL)

Example using one of our procedures:

/api/customSQL/xct_spDSLvalidateContactID

{ 
    "parameters": 
    [
        { 
        "name": "ContactID", "value": "BJON"
        } 
        ,
        { 
        "name": "CustID", "value": "CT0100"
        } 
        ,
        { 
        "name": "Type", "value": "B"
        } 
    ]
    ,
    "checkSum": "3CB06C9A4A83BECCFC60684C271818EDEEAA5770" 
}

NOTE:  the checksum is a security feature that is turned on by default.  This allows the API to double check to make sure that you are who you say you are.  Use a SHA1 hash of the stored procedure name to generate the checksum.

The checksum requirement can be disabled in your DSLCONFIGFILE.xml  file.

You can generate the checksum using any SHA1 library, or you can use the library included in our service distribution: /ctDynamicsSL/bin/ctStandardLib.dll

var checksum = ctStandardLib.ctHelper.getHash(siteKey, storedProcedureName);

Problem with Special Characters in Catalina API Query String

Problem with Special Characters in Catalina API Query String

I ran into an issue earlier where I was trying to retrieve a customer using the Catalina Technology API for Dynamics SL. But the problem was that the CustID had special characters in it. In this case, the CustID looked like this: “BB& 1 2

So, there was a prefix of “BB”, then there was an ampersand, and then there were two spaces, then the number 1, two more spaces, then the number 2.

First of all, I had to URL encode the CustID that was getting passed to my API so that the call looked like this:

/api/financial/accountsReceivable/customer/BB%26%20%201%20%202

You can see that & was replaced by %26 and a space was replaced by %20.

Now, that is fine, but then .NET was having problems with the & (even encoded) in that it had an error like this:

A potentially dangerous Request.Path value was detected from the client (&amp;).

This is remedied by looking at the web.config of your ctDynamicsSL application. Search for the keyword: httpRuntime. Once you found that, if you don’t already have an attribute requestPathInvalidCharacters in that key, add it. This is a good default one:

<httpRuntime requestPathInvalidCharacters="&lt;,&gt;,%,&amp;,:,\,?" />

Then from that remove the &amp; so that you will allow the & to go in. That way, your final httpRuntime should look similar to this:

<httpRuntime requestPathInvalidCharacters="&lt;,&gt;,%,:,\,?" />

As you can see above, I removed &amp;, from the invalid characters. Thus allowing the ampersand to be allowed.

NOTE: If your httpRuntime has other attributes like the .NET version, etc. Leave those alone. Just worry about the requestPathInvalidCharacters attribute and it’s value.