How to add endpoint to wso2 esb rest api from config.properties file? - esb

I have a REST Service which need calls RestService on wso2 ESB and RestService. It needs to send REST request (POST) to another REST service. But RestService on ESB needs to get URL and add user/password from property file and add to Header(user/password) and send request to URL of another rest service.
Example: REST call ESB RestAPI, RestAPI get URL, user/password from property file and send POST request to REST Service to got URL from property.

You can refer to this articleon how to Retrieve Values From XML in Config Registry with WSO2 ESB.
Check this answer on how to set an authorization header for the endpoint.

Related

Send Grid response not getting on the WebHook

We are trying to integrate the send grid api using the provided doc to setup the authentication and use webhoook to check the response.
We have set up the Event Webhook followed by the https://docs.sendgrid.com/for-developers/tracking-events/getting-started-event-webhook-security-features document.
We are using "Authorization Method" as OAuth-2.0 and provided the client id, client secret, token url and the http post url, handling all this by our class which we build in salesforce.
enter image description here
We are trying to hit the using the postman collect we are getting "204 no content"
and no response on webhook.

How to use azure api management to do custom access token check and enrich data in request

All the incoming request to api management will have a token in a header, before backend service is hit token has to be verified. To verify token a GET tokenVallidationApi is to be hit and the response will tell us whether the token is valid or not. If the response exists for token validation , we have to take out few entries from response and enrich the body/header to hit the backend api. I am very new to api management tool and just figuring out how can we achieve this with azure api management?
This is possible. You would have to implement your policies like something below
1. Validate Token
For this, you would first call the validation endpoint using send-request. You could also implement caching using value caching policies for multiple requests.
The doc also highlights how you can extract value from the response body.
2. Transform Body & Headers
For headers, you would use the set-header policy and for the body, you would use the set-body policy.

Angular 5 - Receive POST requests

Scenario: My angular page should be receiving a POST request with JSON data from SpringBoot API.
Consider this as a work example: When client clicks on login on an angular webpage, the login info would be sent through JSON to SpringBoot where it will validate the user,if it returns true, the same JSON would then be forwarded back to webpage as POST, where it will be captured and then worked on(displayed for example).
Now, as per this link, it is said that POST requests cannot be received on Angular but need Express for the same. Is it true? or is there any other way to receive POST requests from API using Angular? I'm googling on this from many days and haven't found anything relevant that confirms this and needed a closure.
Angular is a library for providing a user interface in a browser (which is a type of HTTP client).
To listen for an HTTP request you need an HTTP server (such as Apache HTTPD, Lighttpd, NGINX, something built with Node.js+Express, etc, etc, etc).
is there any other way to receive POST requests from API using Angular?
No
should be receiving a POST request with JSON data from SpringBoot API.
Spring is a Java framework for running a webservice.
Typically it receives HTTP requests and makes HTTP responses.
While you could make HTTP requests from it (i.e. when a client makes an HTTP request to a Spring API, the Spring API then makes an HTTP request to another web service and uses the data in the response to construct its own response to the original request)…
… it sounds like you have the wrong end of the stick and really need to make an HTTP POST request from Angular to Spring and then read the HTTP response in Angular.
i.e. Ajax.

Is there a tool that can generate call to rest web service

I have a URL to rest web service (made in WCF with JSON endpoint) that I call by passing JSON with all parameters.
But I don't know some parameters names.
Is there some tool where I can enter service URL and method name to get JSON example that I must pass to this method?
I know that tools like this exist for SOAP services but I need for REST.
I just tried to use wcf test client but I can't load the JSON endpoint it's only for SOAP.
...svc/json
There are various addons for rest and soap services. you can try as per your requirement.

How can I discover what JSON endpoints a WCF service has?

How can I discover what JSON endpoints a WCF service has?
I know I can append wsdl to the URL and get the SOAP call details ...
http://myserver/Explore/TestService.svc?wsdl
but how can I get what JSON calls the service has?
You can't - there is no built-in mechanism for rest endpoint metadata - you just need to know which http options are applicable to which resources. You'll also need to have some types ready to deserialise to - if you can't get this information off the service provider then you'll need to infer them from the response json.
There is a service discovery standard called WADL which is supposed to do for http what wsdl does for SOAP. However unless the service provider has published one you're out of luck.