I am doing some study on SOAP based web services with JAX-WS, and i am finding very complicated to understand the part regarding to the clients. If some one could give me a hand explaining me some of the topics, i would appreciate it a lot. I am using a SOA book and also google, but i am getting really confused, so that's why i think here i can get a more accurate answer, focused on what i need.
So we can communicate with web services in a synchronous and an asynchronous way. Synchronous communication has the lack that both sides have to wait for each other until the processing ends.
Asynchronous clients allows us to communicate in an asynchronous manner using 2 programming models: 1- Callback and 2- Polling
When talking about asynchronous communication i also understand that there should be a way for the producer(Web Service), to find the consumer(client) once the processing is finished.That is why we have addressing.
Just one more thing. The Dispatch API is also confusing me a lot. Because they keep talking about dynamic clients.
Callback: implementation is not straight forward.
- Advantage: this approach is more elegant/systematic comapred to the polling approach.
- Disadvantage: the client should have a mechanism so that the server can call it back using the callback.
Polling: implementation is straight forward.
- Advantage: becuase of it's simplicity of techique, it is universal, even an ajax enabled webpage can use this technique to check if the update to the request is available.
- Disadvantage: huge wasteage of bandwidth, also server client timing issues, like how long should the server hold the response incase polling request from client did not yet come.
2.Could you briefly explain how addressing works? And also How is Addressing related to callback and polling techniques?
Addressing makes it possible for the webservice to understand the information which was shared previously between messaging systems and transport providers only. Consider this usecase, Initially transport used would be HTTP for both sending request as well as response.And then you might want to change a part of this transport, say while sending the response back,only to SMTP protocol. Incase you were using ws addressing, the whole information related to transport and addressing would be part of the soap envolope itself which would make it possible for your webservice to dynamically change the transport to response sending.
Webservices addressing can also be used for callback, from the server to the client. The service informs port type of the callback required by it in the WSDL. the client implements this port type and then informs the service, of the callback endpoint, using the WS addressing.
In simple words, WS addressing adds extra tags to the soap envolope which includes information which would be present in the transport headers only, like from address, to address, action name etc.
3.How is the Dispatch API related to Asynchronous communication if they are talking all the time about dynamic clients?
Future<?> response = dispatch.invokeAsync(T, AsyncHandler);
invokeAsync method is a polling method. The response, returns to the user immediately and may be polled for completion. In the meantime, the client program can do other work.The javax.xml.ws.Response implements the java.util.concurrent.Future interface that is included in J2SE 5.0. The Response object returns the actual response via its get method, which blocks if the response is not ready to be returned.
4.The 2 usages modes of the Dispatch API(MESSAGE and PAYLOAD), what are used for, and how are they related to the Asynchronous communication model of JAXWS?
Messaging modes are not directly related to asynchronous communication. The messaging modes define the amount of information sent in the web service request.
MESSAGE MODE can only be used if SOAP binding is used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With