Hello,
I’m needing to call a Function method from a Customization but am hitting the following error:
Inner Exception
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Inner Exception
The remote certificate is invalid according to the validation procedure.
Here is my code calling my function. This is straight from the Epicor User Guide.
string apiKey = GetAPIKey();
var restClient = new RestClientBuilder()
.SetDefaultApiKey(apiKey)
.UseSession(this.oTrans.CoreSession)
.Build();
var funcContent = new RestContent(
new {
<data>
})
.SetApiKey(apiKey);
var funcResponse = restClient.Function.Post("<FuncLibraryName>", "<FuncMethodName>", funcContent, published: true);
We have a self signed SSL certificate on our server, but since this is being called internally in an Epicor Customization it’s my understanding that that should be fine.
What’s even more confusing is that when I run the customization on the App server I get an “Invalid API Key” error, but when I use the same key using the alternate code provided by Epicor (below, but with correct params) I get the same SSL error as above.
var restClient = new RestClientBuilder()
.SetAppServerUrl("https://host/ERP10")
.SetCompanyId("Company")
.SetDefaultApiKey(ApiKey)
.UseBasicAuthentication("UserName", "Password")
.Build();
SSL certification isn’t my strong suite, but everything seems to be setup how Epicor suggests. Any suggestions would be great!