I have just stumbled on the need to use SOAP in my final year project involving a web application. I have intermediate knowledge of Servlets & JSPs but not sure how and if its possible to integrate SOAP in my application. Could anyone please advise me on the challenges and how to approach this aspect of my project...
Paul Clapham wrote:First step: Decide whether your requirements are to host a web service using SOAP or to connect to some other web service which uses SOAP. In other words, are you the server or the client?
My requirements are to use tools provided on a 'major' website. They have provided some generic information on how to connect to their services using SOAP & REST and I wish to take advantage of this (on my website) but clueless on where to start.
Usually, SOAP web services are called as part of an application's business functionality.
In such a case, the (external) service may be called from, for instance, an (internal) service of the application in question - an Application Service.
When calling the external service, the Business Delegate design pattern may provide some ideas. With a SOAP web service, one would usually generate the stub classes from the WSDL and use these from within a Business Delegate that isolates the rest of the system from the generated classes.
A Business Delegate does not have to be used from an Application Service. If your application does not have a service layer, then the Business Delegate may be used from whatever component that orchestrates use cases in which usage of the service is included.
P.S. Haha, I see that since I use the words "design pattern", an automagic link to an article "Evil Design Patterns" is inserted. Those are the words of the Boss and should be treated accordingly.
Java Servlets and Java Server Pages are Presentation tier technologies. In practice, the two technologies never "touch" each other as they serve different purposes. Moreover, there is a business application component between them. In theory, there surely are wonderful ways that can be thought up, but in that is about it.
alex achike wrote:Just to help my imagination further, do I control the response once it comes back from the service? Put another way, do I need to generate the veiw (JSP) or does it generate it to complete the request?
A web service usually return only data, not a visual presentation of the data. Your application will, most likely, take the data returned from the external web service and perhaps do some additional procesing before rendering a web page.
I hear about using apache axis (never used it before btw), will this be necessary and does it do most of the work?
If you just want to develop a web service client, then you do not need Axis or any other web service stack. All you need is included in JavaSE 6.
If you do want to develop a web service, my personal advise is to choose some other web service stack. Metro, the reference implementation of JAX-WS, is very easy to work with. It is included as the default web service stack in GlassFish, there is excellent tooling in NetBeans, it can be used in a Tomcat instance if you feel GlassFish is too large.