Can we call GET/POST ajax call from Pentaho data integration spoon - django

I am using Django, Neo4j, and pentaho. In Pentaho Data Integration, we can use the javascript for any transaction. My question is that can we call ajax from the PDI javasticpt to django server method. Actually i want to send success msg to server after the ETL process done by the PDI. Following is the javascript I am trying.
var xhReq = new XMLHttpRequest();
xhReq.open("GET", "http://127.0.0.1/url_name/?parameter=value", false);
xhReq.send();

Don't re-invent the wheel my friend!, use the "REST Client" step as the last step of your flow, and use the parameters in the step to specify the GET Method and URL with GET parameters to send. After executing the "REST Client" you will get the expected response as you specified in the parameters (maybe a JSON if your server answers it).
You don't need to code with javascript (actually is possible with User Defined Java Class with coding, but it's a more complex process).

Related

In Postman how to mock a post API call to return reponses based on the request body?

I'm trying to leverage Postman's mock server feature to mock an API that my application calls.
This is a Post request. I have gone through the documentation and as advised I have saved the responses as examples.
When I try hit the mock URL I get the postman error response
Here is my setup -
My Collection with saved examples
MY mock server
After going through your query, I can see that you're trying to match an example based on the body passed with the request.
To match an example based on the request body, you can leverage the body matching feature of mock servers by:
Enabling the body matching feature from the mock edit page (Reference: https://learning.postman.com/docs/designing-and-developing-your-api/mocking-data/setting-up-mock/#matching-request-body-and-headers).
OR
Passing an additional x-mock-match-request-body header with value as true along with your mock request to get the desired results.
You can find more information on how to use body matching feature with mock servers here: https://learning.postman.com/docs/designing-and-developing-your-api/mocking-data/matching-algorithm/#6-check-for-header-and-body-matching.
Do let me know if this doesn't solve your issue. In that case, it would be helpful if you can share the mock request that you're sending to get the response.

Postman mock server vs JSON mock server

I know if i have node installed i can spin up JSON mock server in no time and then i can create endpoints which support GET,PUT,POST etc. Also i realise that data can be stored (like insertion deletion, updation etc) in db.json until json server is restarted.
Now i tried POSTMAN, and i realised it's very easy and simple process to setup mockserver and create an endpoint. But is there anyway i can do PUT, POST etc to postman and save the data somewhere? like we can do in JSON server's db.json?
also is there any other advantage i can get using POSTMAN's mock server over JSON mock server?
I am new to POSTMAN's mock server so any input would be of great help
Postman Mockserver:
The response you get from the mock server is the example you store for your request.
you can hardcode the value or store the response in a variable and set example as :
Now the response you get depends on the value for the variable 'response'
make sure you select the environment for the mock server where the variable 'response' is present

Receive Callback request inside Postman automated test

I am trying to write automated tests with Postman. I am new to postman automation world so sorry if the question will seem dumb.
In the api that I need to test when I send a request I immediately receive a response with a transactionID, no matter transaction succeeded or not. Along with my request I send a CallbackURL to the server where I expect the actual transaction result to be called back. The server will do a PUT request back to the CallbackURL that I have provided with the transactionID and the actual response or error.
So the question is, can I have such kind of scenarios in my postman tests?
I guess I should run a web server and expose an endpoint which will expect a PUT request and I should get the body of this PUT request in my tests to check it, and respond back to it with success.
In other words, within my script I need to perform the following actions:
Do a request to the server passing a callback URL
check the immediate response from the server and keep the returned transactionID
Have a webserver run with an endpoint that I passed as a callback URL
Expect a request to that endpoint with transactionID and actual response
Check that the response is what I actually expected
Respond to the request with success
I was thinking about Postman Mock server, but seems it is not designed for such usage.
I also think may be I can run some JS Webserver (may be nodeJS) inside the postman Sandbox...
Actually I am very new to postman testing and I am really confused about this kind of issue. Is it even possible to do this with postman or I need something else?
There are some features provided by POSTMAN which can help you to resolve your problem
When you do request to server passing callback URL it gives you transactionID in response. Save that transactionID in environment variable or global variable. Same you can do it for callbackURL.
Eg. pm.environment.set("transactionID", transactionID);
Then you can do the second request where you passed callback URL and transactionID which you have already.
In short in POSTMAN there are features like
Set global and environment variable which helps to pass some values fetched from response to another request.
call other request on success of first request
eg. postman.setnextRequest({{requestname}});
If you can mentioned your problem statement little bit in details it will be easy to answer in better way.
Hope This Will Help You

Connecting a desktop application with a website

I made an application using Qt/C++ that reads some values every 5-7 seconds and sends them to a website.
My approach is very simple. I am just reading the values i want to send and then i make an HTTP POST to the website. I also send the username and password to the website.
The problem is that i cannot find out if the request is successful. I mean that if i send the request and server gets it, i will get an HTTP:200 always. For example if the password is not correct, there is no way to know it. It is the way HTTP works.
Now i think i will need some kind of a protocol to take care the communication between the application and the website.
The question is what protocol to use?
If the action performed completes before the response header is sent you have the option of adding a custom status to it. If your website is built on PHP you can call header() to add the custom status of the operation.
header('XAppRequest-Status: complete');
if you can modify the server side script you could do the following
on one end :
You can make the HTTP post request via ajax
and evaluate the result of the ajax request.
On the serve side
On the HTTP request you do your process and if everything goes accordingly you can send data back to the ajax script that called it.
solves your problem .. ?

SOAPUI client Testing webService

I am using SoapUI to test the web service. In that I can able to format one request and get the response back.
now My requirement is I need to prepare a file(not sure about the format) and I have to send 50 to 100 different requests at a time from the soapUI client and get the response back.
Colud any one help me out in this?
You can use datasource to load the input for which you want to get back response and then loop it using datasource loop step
More info : http://www.soapui.org/Data-Driven-Testing/datasources.html
Not sure if this what you are looking for.