Hello Community,

 

When calling a custom web service that uses anonymous authentication from the browser using this link : 

"http://mycreatio.com/0/ServiceModel/UsrCustomConfigurationService.svc/G…"

 

The page does not seem to work.

 

Note :  we have an on premise Creatio instance on Linux based on .Net Core.

 

Bellow are the steps to reproduce the case:

 

The Academy guides on how to Create a custom web service that uses anonymous authentication for .NET Core : https://academy.creatio.com/docs/developer/back_end_development/web_ser…

This is the class indicated in the first step (that returns the contact ID by the contact name) : 

namespace Terrasoft.Configuration.KycCustomConfigurationService {

    using System;

    using System.ServiceModel;

    using System.ServiceModel.Web;

    using System.ServiceModel.Activation;

    using Terrasoft.Core;

    using Terrasoft.Web.Common;

    using Terrasoft.Core.Entities;

    using Terrasoft.Web.Http.Abstractions;

    [ServiceContract]

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

    public class KycCustomConfigurationService: BaseService {

        private SystemUserConnection _systemUserConnection;

        private SystemUserConnection SystemUserConnection {

            get {

                return _systemUserConnection ?? (_systemUserConnection = (SystemUserConnection) AppConnection.SystemUserConnection);

            }

        }

        /* The method that returns the contact ID by the contact name. */

        [OperationContract]

        [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,

            ResponseFormat = WebMessageFormat.Json)]

        public string GetContactIdByName(string Name) {

            SessionHelper.SpecifyWebOperationIdentity(HttpContextAccessor.GetInstance(), SystemUserConnection.CurrentUser);

            var result = "";

            var esq = new EntitySchemaQuery(SystemUserConnection.EntitySchemaManager, "Contact");

            var colId = esq.AddColumn("Id");

            var colName = esq.AddColumn("Name");

            var esqFilter = esq.CreateFilterWithParameters(FilterComparisonType.Equal, "Name", Name);

            esq.Filters.Add(esqFilter);

            var entities = esq.GetEntityCollection(SystemUserConnection);

            if (entities.Count > 0) {

                result = entities[0].GetColumnValue(colId.Name).ToString();

                result = entities[0].GetTypedColumnValue(colId.Name); */

            }

            return result;

        }

    }

}

and this is the changes to the ..\Terrasoft.WebHost\appsettings.json file

"Terrasoft.Configuration.KycCustomConfigurationService": [

                                "/ServiceModel/KycCustomConfigurationService.svc"

                        ]



Thank you,

 

Like 0

Like

1 comments

Hello,
Based on the coe alone it is almost impossible to say what is the cause of the issue.
What kind of error you are facing, why do you think that the page isn't working?
Make sure that you created a class in the ..\Terrasoft.WebApp\ServiceModel for your service and check if you modified a services.config files as well as the Web.config.

Show all comments