Send SOAP service reponse without client requst in Axis2 - web-services

I want to send response(I am getting the data from my DB) continuously every 5 minutes without any request from client by using SOAP and Axis2. I have created the SOAP server by using following link. http://www.eclipse.org/webtools/community/tutorials/TopDownAxis2WebService/td_tutorial.html
But I don't know how to response continuously from server. Please help me.

A webservice cannot send a response without being called because it won't know where to send the data nor what function is being invoked (a ws could have many functions).
The idea of a WS is to offer a service to everyone who can access it, so the response destinies are multiple.
If you want to get the data from your DB every 5 minutes, your client will have to call the WS every 5 minutes or less (take into account the server processing time).

Related

Choosing the scenario of using Web Sockets in standard HTTP REST API

I will be happy to get advice from more experienced developers about adding Web Sockets into my HTTP-based project.
That’s the thing. I have developed the REST API based service. Everything works well enough, but… In some special cases my server needs a long time to serve client requests. It may be from 1 minute to several hours (and even days)! I implement some not-so-good algorithm to address this issue:
Client sends HTTP request
Server replies about registering request
Client starts sending HTTP requests to get necessary data (if response does not have needed information the client sends another request and so on)
That is all in a nutshell.
And it seems to be a bad scenario and I am trying to integrate web sockets for adding duplex-channels in this architecture. I hope that my API will be able to send info about updated data as soon as possible without the necessity of many requests from the client.
But I am a bit confused in choosing one of two ways to use web socket (WS).
Variant A.
The server only tells the client via WS that data is ready. And the client gets data by standard request-response HTTP method from REST API.
Variant B.
The server sends all data to the client via WS without HTTP at all.
What variant is more suitable? Or maybe some other variants?
I do not want to remove HTTP at all. I just try to implement WS for a particular kind of end-points.
Variant A would be more suitable and easy to implement. You can send message to the client after the data is ready, and he can then send request for the data. It will be like a simple chat websocket, and will serve your purpose.

How are request response tracked in a application server

Look at this scenario in a massive webserver/application server
The user sends multiple requests that get processed async and call an webservice.
How is the request response cycle?
How does the application server know which packet of response goes to which request?
I know this is a very silly question, however i am not able to find any documentation on how this is handled?
How does the application server track the request and the response?

Asynchronous Web Service & Web Service without response?

The concept of Asynchronous Web Service is a web service where the client does not have to wait to receive a response from the server. in AJAX this is implemented by having a callback function to process the response. So the server indeed still sends the response to the client.
Is it possible to have an Asynchronous Web Service without response? Is there any platform that provide this?
Thank you.
I have done asynch web services in the past. They are very useful. YOu do not need a detailed response but you at least need an HTTP response, like 200 OK. If the client that makes the request provides some sort of ID or key for that request, then the client can use the same ID/key to later on query for the result/response of the request.
As far as frameworks that provide this, I do not know of any. In the past I would just have a shared memory store, like Memcache, to store the state and result of the request. As long as the state is shared across all nodes, any node can then process the call back request.
EDIT: Providing a key in the request can be done in either REST or SOAP environment. HTTP provides multiple places where a key can be communicated.
GET query param (REST)
HTTP header (SOAP/REST)
Added to the message body of a POST request. This can be done through two ways.
param in the message body (REST)
variable or attribute in serialized object (SOAP/REST))

Apache Axis - Java WS Client Code and SoapUI giving different responses

We are facing a strange issue of getting different number of records as response while making the same webservice API call from our WS client code and SOAP UI.
Lets assume the WS API is something like Foo[] getBar() and it is supposed to return 2 records.
So when we are making a call from SoapUI we get two records but when our client code makes a call it is getting only one record.
I have grabbed the request XML posted by my WS client code from logs and used it to request from SoapUI.
Can it be an issue of an old client stubs?
PS: We are using Apache Axis.

How to create a web wervice in java/Axis2 which should keep publishing data

I am a new to Axis2 and SOAP. I recently working on a Axis2 SOAP project, I have create a SOAP server and SOAP client by using java and axis2 implementing session scope. The problem is when I send a request, it returns response back only once. I am unable to make web service keep publishing data periodically untill the session end. Can any body help me...
Thanks in advance
I might be wrong, but I think since you work with HTTP you can't make the
response permanent until you make your client perform calls permanently / periodically.
Permanent Requests --> Permanent Responses
I echo KB22's response - HTTP has a request-response flow, so your service is receiving a single request and sending back a single response. Implementing session scope means that you have a logical session for multiple request/responses to be tied together. You have a few options here:
Make the client wait until you have all the data to send back in one response. However, if this takes too long you may well get timeout issues on the client.
Change your model, so that you send in multiple requests and get back the data in pieces.
Change your model to a polling style, where you keep sending requests (and receive empty responses) until all the data is ready to be sent back.
Change your protocol to something that is asynchronous (e.g. JMS) so that you send in a request to a queue and at some later time the response turns up on the queue for your client to read.