Java Reference
In-Depth Information
listener loads the beans defined in
WEB-INF/applicationContext.xml
and binds them to the
root application context associated with the web application. Listing 5-33 shows this.
Listing 5-33.
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="
http://www.springframework.org/schema/beans"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
>
<bean name="policyQuoteApplicationService" class="com.apress.einsure.
å
business.impl.PolicyQuoteApplicationServiceImpl" />
</beans>
Finally, Listing 5-34 shows the actual application service implementation class.
Listing 5-34.
PolicyQuoteApplicationServiceImpl.java
public class PolicyQuoteApplicationServiceImpl implements
PolicyQuoteApplicationService{
public double calculatePolicyQuote(String productCd, int age,
double sumAssured, int term) {
//return calculated policy value
}
}
Now that the server-side components are ready, I will show how to build a sample
client to access the web service. As explained in Chapter 4, I will use a business delegate
because it is the most appropriate component to deal with remote services. Listing 5-35
shows the business delegate to invoke methods on the remote policy quote service.
