Hello.

I have a web services API that requires an Id and an hmac generated with the request parameters and an API Key to be placed in its authorization header.

Is there a way to obtain the call body to perform the HMAC?

In postman I have been able to make the call successfully with a pre-request which is the following:

 

const apiKey = pm.collectionVariables.get("apiKey");;
const webId = pm.collectionVariables.get("webId");
const crypto = require('crypto-js');
 
if(pm.request.method === 'POST') {
 
    const parsedBody = JSON.parse(pm.request.body.raw);
    const jsonParams = JSON.stringify(parsedBody);
 
    // Create HMAC
 
    const hmac = crypto.HmacSHA256(jsonParams, apiKey);
    const hmacb64 = crypto.enc.Base64.stringify(hmac);
 
    // Set computed HMAC as an environment variable (or you could add it directly to the headers)
    pm.environment.set('hmacb64', hmacb64);
 
    // Construct the Authorization header
    const authorizationHeader = "signmage " + webId + ":" + hmacb64;
    pm.environment.set('Authorization', authorizationHeader);
} else if(pm.request.method === 'GET') {
 
    const url = pm.request.url.getPathWithQuery();
 
    const hmac = crypto.HmacSHA256(url, apiKey);
    const hmacb64 = crypto.enc.Base64.stringify(hmac);
 
    // Set computed HMAC as an environment variable (or you could add it directly to the headers)
    pm.environment.set('hmacb64', hmacb64);
 
    // Construct the Authorization header
    const authorizationHeader = "signmage " + webId + ":" + hmacb64;
    pm.environment.set('Authorization', authorizationHeader);
}

 


But in Creatio I'm a little lost if it's possible to do something similar.

I would appreciate it if you could help me know if this is possible. Thank you.

Like 0

Like

0 comments
Show all comments

I have integrated SOAP service in trial version of Sales Creatio. The test request was successful and returns the response parameters correctly, but when I'm trying to call the webservice in business process and bind the response parameter to auto-generated page, it shown only "Response body" in Process Elements parameter.

 

Please, refer the screenshots attached.

 

 

 

Any guidance would be appreciated!

Like 0

Like

3 comments

My guess is that it is because the web service is returning an array of records and the MemberNumber is from an element in the array/collection. If the web service is really just returning one record, but wrapping it in an array, you could map the field in the web services setup in Creatio as something like (you might need to modify this to match the structure of the json returned from the API):

$.[0].MemberNumber

To specifically get the value from the record at index 0 of the array.

Ryan

How to bind all the records from array/collection in grid from web service response without entity?

Revathi,

You’ll need to use a subprocess and pass each item returned to the sub process. See an article on that here https://customerfx.com/article/working-with-collections-from-a-web-service-element-in-a-process-in-creatio/

Ryan

Show all comments

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

In a Business Process, we are calling a Web Service using the Web Service Call element, but sometimes we will get a failure that we need to log to a custom table for action later. We really could do with as much information about the failure as possible, including being able to log out the parameters that the Web Service was passed so the support users can assess what happened without having to have trace logging turned on for the BP and digging into the BP log as well. I can't see any output on the web service call for that, but maybe someone else has found a way to get this info?

Like 2

Like

2 comments

Hi Harvey, we have similar needs, but no result, unfortunately. 

So, we log all parameters manualy before calling web service :(

Hello Harvey,



If you want to see the body of the request generated by the web service and the response that comes from the server - You can try to use Telerik Fiddler tool to capture requests that are being sent from the Creatio instance

 

But this advice is relevant only for local environments.

If the environment is on a local machine, you can connect Fiddler and test it.

 

In general, if you do not want to use data tracing for a process, we believe that this goal can be achieved through development. For example, a web service call will be made using a script task, in which you will process various responses from the server and write the information you need into a table using C# code.



Thank you.

Show all comments

Hello,

 

we use Web service element in our business process, where we set several parameters. For logging purposes we need to get JSON of request body, but there is no such option (I see only Response body)



How can we get request body from the Web service element?



Thanks.

Vladimir

Like 0

Like

3 comments

Hello,

Unfortunately, Web service element doesn't directly expose the request body for logging within the element itself. 

 

Hello, 

 

and no hidden workaround? Or any methods, which are used from request body generation, that we could use as well?



Kind regards,

Vladimir

Hello Vladimir,



You can try to use Telerik Fiddler tool to capture requests that are being sent.

Show all comments
Hello. 
Hello.

I need to send an image through an API to convert it to base 64, I tried to do it using the Web service tool but it does not allow me to place an image or file field to use it from the bpm, I was looking for some information and I saw that it could be done using a script, I just haven't found a way to do it. Could you help me with some example or idea so I can do this please?

 

 

 

Like 0

Like

1 comments

Hello Laura, 

 

Please refer to this article for more detailed information about such functionality.  

Also, similar questions have already been discussed in the below posts, please review them for the detailed information:

https://community.creatio.com/questions/there-option-send-image-file-re…

https://community.creatio.com/questions/file-type-request-parameter-res…

Please inform us in case of any questions!

Best regards,

Anastasiia

Show all comments

Hi everyone,

 

if I have an interface marked as ServiceContract, and some method marked as OperationContract.

After that I have 2 classes implementing that interface and two different behaviours for a method in the interface.

How we can specify which implmentation we need to use when we hit that endpoint?

 

[ServiceContract]
public interface IServiceContract
{
    [OperationContract]
    void SomeMethod();
}
 
public class ImplementationClassA : IServiceContract
{
    public void SomeMethod()
    {
        // Implementation for Class A
    }
}
 
public class ImplementationClassB : IServiceContract
{
    public void SomeMethod()
    {
        // Implementation for Class B
    }
}

 

Like 0

Like

1 comments

Hello,

 

Do you have the possibility to create an instance of ClassA or ClassB when calling the service (based on some input parameters) and call the SomeMethod method from the correspondent class instance? It will call the method implemented in the correspondent class and your task will be achieved.

Show all comments

Hi Guys,

I have created a webservice using out the box webservice section and calling this webservice in business process.

Issue :- I have to pass collection inside collection to call the webservice. I am passing collection inside collection correctly but Creatio is not able to send collection data to webservice. Any idea how to resolve it?

 

Like 0

Like

1 comments

Hello,

 

It seems that the issue is that you are passing the first item read in the "Read bank account" element of the process (see [#Read bank account.First ite... in the "PartyAcctRelType" collection property settings from your screenshot). What should be done is modifying the "Read bank account" element and reading collection of records there, not the very first element from it:

And pass an actual collection of data read. This should work properly.

Show all comments

Hi community!

 

I have to integrate with a third-party tool that cannot send a request to the auth service and handle the cookies correctly.

 

Is there another method similar to webhooks using an API key in the URL or in the data itself?

 

Thanks in advance,

Robert

Like 1

Like

1 comments

Greetings, 

 

Possibly only through Oauth. 



Link to documentation: https://academy.creatio.com/docs/user/on_site_deployment/deployment_add…;



Best regards, 

Okrhan

Show all comments

Hy everyone,

 

I have encountered an issue where I am trying to call my webservice endpoint and I'm getting a 404 - Not found error.

I have tried calling it through a button's function and also through Postman app, but I get the same error.

There is no ..\Creatio Instance\Terrasoft.WebApp\0\rest directory where I have installed my Creatio locally.

My Creatio version is 8.0.6.3422.

 

 

Any idea how to fix this issue?

 

Like 0

Like

5 comments

Hi!

 

Have you made any recent changes to the webservice endpoint? Also, have there been any recent changes to the Creatio instance?

 

Looking forward to hearing from you!

Alla Blinova,

Hi Alla,

I haven't made any changes to the webservice endpoint since I have created it.



The process was:

1. Create the C# code object in the advanced settings

2. Code the webservice function

3. Compile the package

4. Edit the classicUI section page source code (Adding button to call the webservice)

5. Complie the package once again

 

Also, there weren't any changes regarding my Creatio instance.



Few weeks ago I had done the same steps on a cloud trial version where it worked just perfectly.



*Edit: Typo

Thanks!

 

Then we would suggest trying to call the webservice with a different record or data set to see if the issue persists.

If the issue continues, then try the source code generation and full compilation as a potential solution.

Alla Blinova,

I have tried to recomplie the individual package, then all the other packages and also tried source code generation but I had no success.



However I had a saved package where I have used a similar webservice. I installed this package on a trial cloud environment then locally.

The webservice call worked both on cloud and on local environment.



After this I exported my package which has the reported problem regarding webservice and installed it on cloud and it still doesn't work there.

 

Is there a method to check whether I have all the requirements to call the webservice, or is it possible to compare the two webservice/package components?

Hi Alla,

 

I have been able to resolve the issue.

I tried to call [Creatio instance]/0/rest/[package name]/[function call] instead of [Creatio instance]/0/rest/[webservice class]/[function call].

 

Thank you for your help.

Show all comments