The title of this section is a bit misleading. It seems to imply that there might be a single best way of using Struts with a Web Service. This isn't the case. There are many options that could make sense based on your specific environment and application. However, that being said, this chapter provides a specific recommended approach. This recommended approach is illustrated in the sample application presented in the next section. But first, here are some key points to the design:
If you read the previous chapter regarding integration of EJBs with Struts, this should all sound familiar. In fact, you'll see that the sample applications in these two chapters are virtually identical except that the facade class developed in the previous chapter is replaced with a different facade class. By isolating the communications in the Action class and using a facade class to hide the implementation details, the design itself has actually been validated ! The entire back-end system has changed, but the only portion of the Struts code that has to be modified is a single facade class! In reality, it's not quite that simple and you'll still need to understand how to implement things on the server side. But the point remains that this design is solid and could be used as the basis for a larger, production application. |