Service. xml file, placed under the WEB-INF
<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <! Doctype beans public "-// spring // DTD bean // en" "http://www.springframework.org/dtd/spring-beans.dtd"> <br/> <beans> <br/> <! -- All Web service information will be written here in the future. --> <Br/> <! -- Introduce xfire pre-configuration information --> <br/> <import resource = "classpath: ORG/codehaus/xfire/spring/xfire. xml"/> <br/> <! -- Define the access URL --> <br/> <Bean class = "org. springframework. web. servlet. handler. simpleurlhandlermapping "> <br/> <property name =" urlmap "> <br/> <map> <br/> <! -- Display the WebService access path. You need to configure several paths when there are several paths. --> <Br/> <Entry key = "/jbtm. ws"> <br/> <ref bean = "jbtmws"/> <! -- Corresponds to the following. --> <Br/> </entry> <br/> </map> <br/> </property> <br/> </bean> <br/> <! -- Use the xfire export tool --> <br/> <bean id = "basewebservice" class = "org. codehaus. xfire. spring. remoting. xfireexporter "lazy-init =" false "abstract =" true "> <br/> <! -- Reference the factory defined in xfire. xml --> <br/> <property name = "servicefactory" ref = "xfire. servicefactory"/> <br/> <! -- Reference xfire. xfire instance in XML --> <br/> <property name = "xfire" ref = "xfire"/> <br/> </bean> <br/> <bean id = "jbtmws" parent = "basewebservice"> <br/> <! -- The address of the service request, which corresponds to the URL accessed above --> <br/> <! -- Business service Bean --> <! -- Implementation class of the interface I defined --> <br/> <property name = "servicebean" ref = "jbtmserviceimpl"/> <! -- Corresponds to the spring configuration file --> <br/> <! -- Narrow Interface Class of Business Service Bean --> <! -- Interface I defined --> <br/> <property name = "serviceclass" value = "com. mainone. WebService. server. jbtmservice"/> <! -- Interface, implementation class interface --> <br/> </bean> <br/> </beans>
Applicationcontext. xml file injection:
<! -- Web Service --> <br/> <bean id = "jbtmserviceimpl" parent = "txproxytemplate"> <br/> <property name = "target"> <br/> <Bean class = "com. mainone. webService. server. jbtmserviceimpl "> <br/> <property name =" daoa "> <ref bean =" daoa "/> </property> <br/> <property name =" codesetservice "> <ref bean = "codesetservice"/> </property> <br/> <property name = "buyproductcommonservice"> <ref bean = "buyproductcommonservice"/> </property> <br /> <property name = "productcommonservice"> <ref bean = "productcommonservice"/> </property> <br/> </bean> <br/> </property> <br/> </bean>
Load the service. xml file in the web. xml file
<Context-param> <br/> <param-Name> contextconfiglocation </param-Name> <br/> <param-value>/WEB-INF/applicationcontext. XML,/WEB-INF/action-servlet.xml,/WEB-INF/service. XML </param-value> <br/> </context-param>
<! -- WebService --> <br/> <servlet-Name> xfireservlet </servlet-Name> <br/> <servlet-class> Org. codehaus. xfire. spring. xfirespringservlet </servlet-class> <br/> </servlet> <br/> <servlet-mapping> <br/> <servlet-Name> xfireservlet </servlet-Name> <br/> <URL-pattern>/servlet/xfireservlet/* </url-pattern> <br/> </servlet-mapping> <br/> <servlet-mapping> <br/> <servlet-Name> xfireservlet </servlet-Name> <br/> <URL-pattern>/services/* </url-pattern> <br/> </servlet-mapping>
This is the file to be configured. You need to introduce the jar package of spring-1.2.6 under Lib.