Java Reference
In-Depth Information
<bean id="policyQuoteWebService"
class="org.springframework.remoting.jaxrpc.
å
JaxRpcPortProxyFactoryBean" >
<property name="serviceInterface"
value="com.apress.einsure.business.api
.PolicyQuoteApplicationService"/>
<property name="wsdlDocumentUrl" value="
http://localhost:7001/
<property name="namespaceUri"
<property name="serviceName" value="PolicyQuoteService"/>
<property name="portName" value="PolicyQuoteService"/>
<property name="serviceFactoryClass"
value="org.apache.axis.client.ServiceFactory" />
</bean>
</beans>
You can see from Listing 5-36, the Spring Framework uses a factory bean:
JaxRpcPortProxyFactoryBean
. This class finds the web service from the web service registry.
It returns a proxy object implementing the business service interface. Finally, I will put
the business delegate into action from a stand-alone Java client, as shown in Listing 5-37.
Listing 5-37.
PolicyQuoteClient.java
public class PolicyQuoteClient {
public static void main(String[] args) throws ServiceException, AxisFault {
accessViaSpringClient();
accessViaNonSpringClient();
}
}
public static void accessViaSpringClient() {
String configFile = "com/xpress/channel/springws-config.xml";
ApplicationContext ctx = new ClassPathXmlApplicationContext(configFile);
PolicyQuoteBusinessDelegate delegate = (PolicyQuoteBusinessDelegate)
ctx.getBean("policyQuoteDelegate");
delegate.execute();
}
