In Katalon Studio how to store element value in Global Variable from Web Service Response and need to pass in another Web Service Request or Header - global-variables

I am configuring the web service in Katalon Studio. I have to take element value from web service response and stored it in global variable and the same element has to be sent in next web service request or header part.
Whenever i hit this web service, i will get unique values. The same values need to be updated in global variable and have to sent current value in next service.
OAUTH - In below example i need to store access_token 7 its value in Global Variable and need to use it across.
"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzQ2OTY0NzQsInVzZXJfbmFtZSI6ImJlYXN0dGVzdDQiLCJhdXRob3JpdGllcyI6WyJST0xFX0JFQVNUX0JPX0lUIiwiUk9MRV9CRUFTVF9DQVBfQURNSU4iLCJST0xFX0JFQVNUX1NVUEVSVVNFUiIsIlJPTEVfQkVBU1RfRlJBVURfVkVMT0NJVFlfQ0hFQ0siLCJST0xFX0JFQVNUX0JBQ0tfT0ZGSUNFIiwiUk9MRV9CRUFTVF9DQVBfTU9OSVRPUiIsIlJPTEVfQkVBU1RfRlJPTlRfT0ZGSUNFIl0sImp0aSI6ImU1YWVmNDk1LTAwN2YtNGM4NS04MmZiLWYzZjEzNjNlNTgzNiIsImNsaWVudF9pZCI6Ik9hdXRoLVRydXN0ZWQtQ2xpZW50Iiwic2NvcGUiOlsicmVhZCIsIndyaXRlIl19.hD3BXKJbo2sTkEhQAYxUi7CDU45-ZtZWjjpO99-21McrvK74Ffh0uIImFTE71JI0wjwUWZ1zM28rZ7pQfQB9TLOeUW1bImtFDMaHIg_NvfWXLNCQe8lREjCv-LhpSkKksUyBU85A-Q8T4az0VQyKGs0AfHvc2gTrEWuoJGQpDfePz3l_10fJnEqC5arev-vIF1zeMijHXUWQd-AGKr_PLn2S8iPOpkBAiNmz1SDTDBZe1jdpVfYSC1RJQAbzOWGpL0ia7TAzBPpEpn6XV3emoIWIpFTJY0CNavQvEL9fc-D8nPmwF4q_Tnm2LnqbtCIlqk2SbFU5bdSmtIZfl5atxA",
Transaction Id: In below example i need to store transactionID and its value in global variable and need to use it across.
{
"transactionID":"09610123112519543357"
}

Related

Lookupcache not working as expected in Apigee

I am calling a oauth call and saving the clientid of the call using populate cache and assigning that clientid to variable via lookupcache and consuming that variable in subsequent calls for different endpoints its working fine but when i make another oauth call with different client the immediate lookupcache variable value is showing as null until i make another APIendpoint call how to resolve this .The expecation is lookupcache variable is assigned as soon as populate cache is populated

How to override the URL-based component name for Application Insights telemetry?

I want to override my web API's component name shown in the Application Insights transaction search.
I am already setting the cloud role name, which has previously worked well, and even now works for some of the telemetry, as indicated by the single green marking on the image. However, almost all telemetry seems to ignore the cloud role name and instead uses the URL host as the component name, indicated by the three red marks on the image. Is it possible to override this?
I can confirm that all the raw JSON telemetry data sent to AI has ai.cloud.role set to the correct value. Furthermore, I find no traces of the host in the raw telemetry data that is sent, other than in the URL of course. This makes me believe that the component name is set directly by Azure Portal and is not possible to override. This assumption is supported by the fact that the single telemetry item on the image with the correct component name represents a call to my component from Azure Service Bus, i.e. not a HTTP call.

Microservices async operation HTTP response

We're building a microservice app where clients can create projects. The following diagram shows the technical flow of this process:
My question: what HTTP response should the API gateway return to the client (step 1.)?
My initial idea was to give back a 202, but the problem there is that I don't know the Location yet (/projects/{id}), because the id of the project will be created at the Project Management Service.
Considering that the IDs of the newly created project entity is not known at the request time (i.e. it is generated after the insertion into the database) you indeed cannot generate the url to the project resource.
Instead, you could assign an ID (i.e. 1234-abcd-5678-efgh) to the command before sending to the bus and keep track of its execution status on the API gateway itself. Then you can respond to the client with an command execution status endpoint like /commands/1234-abcd-5678-efgh where it can query by polling.
The alternative would be to use another service that would reserve&deliver unique IDs but you must make a blocking call to it and this hurts scalability. Or you can host this service inside the API gateway itself (onto the same node) to minimize latency. Also, there is a risk of loosing some IDs in case of project creation failures but this can be compensated by releasing those IDs in those situations (thus increasing the architecture complexity).
A third solution could be the use of a project surogate ID, like a GUID, assigned as a property of the project, included in the command, having the purpose of an alternate identity that can be used only in the pre-creation phase of the process. Then, the response to the client could be like this: /projects/by-guid/1234-abcd-5678-efgh and after the project is created a GET to this url would permanently redirect to the final project url.

Set SignalR client connectionid from configuration but not autogenerated

My SignalR client is Console Application
I want to set the ConnectionId for my console application (SignalRClient)
My thought is, in my console application config file, I set the ConnectionId, say, in app.config, I set a property "MyConnectionId" with value "123-123-123-123" and that ID ("123-123-123-123") should be used as SignalRClientConnectionId instead of auto-generated GUID.
Is this possible? If so, how?
The intention behind it is, I want to identify all the clients connected to my hubs, so that, I can send the data to respective SignalRClient/ConsoleApp
Hope, I'm clear.
Thank you.
Unfortunately you cannot provide a custom ConnectionId. This ConnectionId is always generated by SignalR itself.
For your intention what you can do is store the information of your console apps with along the ConnectionID. (ex:- in a database table where columns will be console app name and ConnectionID). By doing that you can identify which ConnectionID belongs to which console application so you can identify and send them separately as you want.

Session state access in Web API across domains

I have a ASP.Net API implementation, where to store and access the data / variables across consecutive calls, I am using a session state object as shown below and it can be successfully accessed in the multiple calls to separate calls by a browser:
// Access the current session object
var blSession = HttpContext.Current.Session;
// create the BL object using the user id
BL accessBL = new BL(userID);
// Store the Bl object in the session object dictionary
blSession["UserBL"] = accessBL;
I have to enable the following setting in the Global.asax, for the Session object to be accessible:
protected void Application_PostAuthorizeRequest()
{
// Enable session state in the web api post authorization
HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
}
Issue comes in when the WebAPI shown above has to be accessed via another ASP.Net MVC client, which is separately hosted on a different machine, at that time same consecutive calls do not maintain the state as shown above and thus it leads to an exception, since the consecutive calls rely on session data to proceed.
I have seen a similar issue when I seen the similar issue when I use the Fiddler Debugger, as it gets hosted as a web proxy, so consecutive calls through that too fails, since it does not maintain the state. In my understanding, issue is due to setting the Cookie across domain, which doesn't seem to work across domains due to security reason
I know a workaround is to use an application wide variable like Cache, but please suggest if you have a way to get the SessionState work. Let me know if you need more details.
If you have not setup an alternative way to do SessionState, then the default behavior is to do it InMemory on the server. This is why you are seeing issues when the request is handled by a different ASP.NET server.
Web API calls are meant to be stateless. That is, they should not perform like a classic ASP.NET application that relies on the framework to store user specific information in Session variables across HTTP requests. For each call, pass in a user-specific identifier or token that you can then use to lookup information stored in your backend. You can store this information in your database or a distributed cache like MemCache for faster retrieval.

Resources