Asynchronous webservice in cxf - cxf

I need to send a response unsolicitedly from my server side to client side using cxf.I am very much comfortable in making synchronous JAX-WS calls from client to server(I used SOPAUI to invoke my server which is a webservice_..I am following JAX-WS wsdl first approach.I am using cxf 'wsdltojava' to convert wsdl to java classes.
To make it simple,my question is 'how to send a response(without a request from client) from server to client in CXF,JAX-WS wsdl first approach?

Related

how can I send emails from react using sendinblue?

I am working in React applications (using the .net core in the back-end)
I have to send emails from the client side , we have to use sendinblue instead of mailgun , I need your help
You should not send emails from the client side.
Consider that in doing so, you're going to expose your API Key to any client, leading to a severe vulnerability for your application (anyone could impersonate you and send emails as if they were you).
In order to really make that work, you should perform an AJAX request to your server and there, connect to the Sendinblue API and make the request to send the email. In this case, the API Key could be safely stored in your server.

Apache Camel request-reply pattern failing over 3 or more micro-services

I'm trying to make a request-reply return a response over three microservices. So,
1. api
2. backend service
3. another backend service
However, the message is not making it back to the api (which is blocking) and I get a timeout issue. I've troubleshooted the service to service communication and this leaves me with camel as the cause.
I have read camel in action and various other sources, but am unsure what the best way to implement a synchronous transaction over 3 or more micro services. The EIP patterns usually only accommodate 2 services communicating.
Here is an overview of the camel routes for each service.
API
rest("/api")
.post("/apply").route()
.inout(APPLY_QUEUE)
Backend Service 1
from(APPLY_QUEUE)
.bean(somebean, "checkApplication")
.to(REGISTER_QUEUE)
Backend Service 2
from(REGISTER_QUEUE)
.bean(somebean, "createApplication")

Rest service request (>8KB) fails

A Java server exposes REST services using Apache CXF 3.1.10. Trying to call a GET service with a URL longer than 8K, the service gives error.
The REST server uses JAXRSServerFactoryBean that launch a Jetty server. I can not find a way to allow the server to accept request of more than 8K.
Get requests have a query size limit, both on client and server side. (check this for details: maximum length of HTTP GET request?)
Maybe you should move to POST services. Or if you control both the client and server, you may use the request body. (That is allowed for GET requests but there are some clients/servers not supporting that)

Difference between API calls from frontEnd and Api calls from Backend to any external Backend server Code

since i was struggling in making API calls to apache server from my angular app running in node-express,
So i was unable to call apache server with POST calls inspite of setting the CORS filter in most of the ways available,
So someone suggested rather of making calls from AngularJs(Frontend) , make it from NodeJs(Backend-server) which serves your angulas(frontEnd) code.
So kindly assisst me in this as to what exactly is the difference between making API call's from frontEnd to any server or from the backend(server) of the same frontEnd ??
What factors makes it more preferable over the other one ?
Is it proxy or CORS thing which effects FrontEnd based API calls ?
Thanking all in advance
Shohil Sethia
CORS is a policy that is voluntarily enforced by the browser (chrome, firefox, etc.). The decision to allow or deny a request is based on the presence of a certain header (Access-Control-Allow-Origin: *) in a response from the server. There is no equivalent policy in a server side setting, so you are free to make cross-origin requests all day.
From enable-cors.org:
[CORS] prevents JavaScript from making requests across domain boundaries
This is why I usually build a small server api in Node to grab data from external 3rd party servers.
When the user makes a request on the front end the request is sent to the backend function with optional parameters which the end-user specified.
Depending on the parameters supplied, different functions might be run before the backend queries the third party API.
3rd party API response is returned to the backend.
Backend either passes the response along or does more stuff before passing the response along.
Then the frontend does stuff with the data based on the response received (ie there were less than 5 results so adding pagination is not necessary).
If developed this way you gain access to the following which all benefit your application/website.
Keep any necessary credentials on the server. ( extremely important )
Obtain logs.
Validate on both the server side and the client side for an added layer of security.
Use the server to filter sensitive results if necessary before they reach the frontend.
Vary which parts of the heavy lifting are done on the server vs the device in order to improve the application performance.

Create proxy for Apache CXF Web services in wso2 ESB

I am a very beginner in ESB. So, kindly excuse me for this basic question.
Currently we have web services created with Apache CXF and Spring running. Now, we need to create proxy services for these in WSo2 ESB. Can someone please let us know how can we do this?
I created Pass Through proxy and use wsdl definition as from URL, but when i use try it option i get he endpoint reference (EPR) for the Operation not found is /services/ and the WSA Action = null.
If this EPR was previously reachable,please contact the server administrator.
Since ESB 4.6, pass-through transport is enabled by default : The message body is not build so, SOAP Body based dispatching is not supported => in this case, the error you're speaking about is thrown
One solution could be to add this parameter in your proxy conf : <parameter name="disableOperationValidation" locked="false">true</parameter>
Have a look there for other options : Using WSO2 ESB PassThrough Proxy on WebLogic (Spring) Web Service
How did you create the proxy service? If you have the wsdl of the Backend service you can use it to create the proxy service like follows.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="testProxy2" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<wsdl service="SimpleStockQuoteService"
port="SimpleStockQuoteServiceHttpSoap11Endpoint"
uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
</endpoint>
</target>
<description/>
</proxy>
The ESB gets the endpoint url from the Service name and Port defined in the WSDL. For SOAP 1.1 the WSA action will be the SOAPAction header and for SOAP 1.2 the WSA action goes with the action element of Content-Type header. For example,
Content-Type: application/soap+xml;charset=UTF-8;action="TheSoapAction"
Try to use a SOAP client like SOAPUI to test your proxy service.

Resources