Important!!! Cookies in System

Hi Support,

I’m working on a business process that involves calling custom web services. For authentication, I need to pass cookies such as BPMLOADER, .ASPXAUTH, and BPMCSRF in the header. Currently, I'm adding these manually, which isn't practical.

image


Query: Is there a way to automatically fetch these cookies when a user logs into Creatio and store them in a variable for later use in a web-service call? 


Platform: Creatio:Energy (Freedom UI)

Like 0

Like

4 comments

If the web services are native to Creatio, why call them as web services at all? That adds a lot of unnecessary overhead to doing something that is already native. It would be better to rethink the approach. Can you give more details of what specifically you're trying to accomplish?

Hi Ryan,

I’ve created some custom web services (C#) to pull data from a client’s external database & push into Creatio-DB and vice versa. 

  • To automate this, I'm planning to schedule these service calls to run at fixed intervals.

i.e.  `https://my-creatio-url.com/0/rest/ServiceName/GetData`

https://my-creatio-url.com/0/rest/MyServiceName/GetData


Based on my understanding, to make any API call whether it is OData Service or Custom Web-Service, we need to pass Cookies in header for 'GET' request & BPMCSRF Token along with Cookies for 'POST' Request as authentication.


ServiceName: Get Object Detail

Authentication: Basic Auth
Web Service with Basic Authentication


In Below Example, I'm trying to fetch all city data using 'City' Object. (checked 'use authentication')

Case_1. No Cookies in Header, (Response: ❌Error)



Error

 

Case_2: Passing Cookies in Header.  (Response: ☑️Success )

City Response

 

Also in Postman, Cookies are automatically fetched in Header

City Response with Cookies in Header

 

Query: Is there a way to automatically fetch these cookies when a user logs into Creatio and store them in a variable for later use in a web-service call? 

Hi,

I also used script task for Login service (Screenshot is below)

 



But this script task is not working. 

Query: Do I need to log into Creatio to call subsequent custom web-service with cookies or can directly call them without login service?



 

 

If you have a C# schema in Creatio that connects to the other system, there's no need to call that C# as a web service from Creatio. You can simply create an instance of the class and call the method.

Instead of trying to call the C# code from Creatio as a service using the URL: https://my-creatio-url.com/0/rest/ServiceName/GetData

You can instead just add the following in a script task in the scheduled process:

var service = new ServiceName();
var result = service.GetData();

Ryan

Show all comments