Reputation: 7106
I have an interface that I've exposed as a regular SOAP web service. One method of the interface consists for the client to send a file to the server, then the server processes the file and returns a result file. Processing the file may take some time, so I think using asynchronous invocation of this method is a better idea. I thought about the following flow:
The client invokes the asynchronous method and sends the file using an attachment (MTOM). When the file is received by the server, a response is sent back to the client indicating that the file has been received and that it will be processed shortly. Once the file is processes, a response is sent back to the client indicating it has been processed and a result file is returned in the response also as an attachment.
Is it possible using SOAP with CXF?
Thanks
Upvotes: 3
Views: 15270
Reputation: 580
If you use some tool like WSDL2Java for client generation, you can even choose to generate an asynchronous client. It will generate for you a callback handler with empty methods for each of the service operations and exceptions of the service. You then can just implement those methods to set the actions to do when the response is received. Remember that when an asynchronous call is done a new thread is started.
Upvotes: 1
Reputation: 9914
You can use Callback
approach of Asynchronous InvocationModel
.
Callback approach - in this case, to invoke the remote operation, you call another special method that takes a reference to a callback object (of javax.xml.ws.AsyncHandler type) as one of its parameters. Whenever the response message arrives at the client, the CXF runtime calls back on the AsyncHandler object to give it the contents of the response message
More information can be had from the following:
Upvotes: 2
Reputation: 2036
Yes, Once you receive the file, you may return the request id to client and start processing on server side and do maintain various states of processing. Client can come back in different interval, and will receive the processing status or the output if it is completed.
Upvotes: 0