1. Create a new Web project (no processing required)
2. Add the jar files required by Xfire
3. Configure Web. XML for details see my Space log
4. Create the Xfire framework publish file Services.xml, create the directory under the class folder:
Web-inf\classes\meta-inf\xfire\services.xml
5. SRC create interface and interface implementation class
6, modify the Services.xml, publish the service
Note: If your Web App uses the spring framework, you need to introduce Xbean-spring.jar
Unrecognized Xbean element mapping:services in namespace:
Http://xfire.codehaus.org/config/1.0 the solution to this problem is:
In the Services.xml file:
<beans xmlns="http://xfire.codehaus.org/config/1.0" > <service> </servie> </bean>
Switch
<beans > <service xmlns="http://xfire.codehaus.org/config/1.0"> </servie> </bean>
When adding Xfire to a project, an error occurred as follows:
Org.xml.sax.SAXParseException:Document root element "Beans", must match DOCTYPE root "null ”.
Cause:
XFire 1.2 in Core libraries Spring-1.2.6.jar conflicts with Spring2 in the project.
FIX:
MyEclipse6.5 in
window->preferences->myeclipse Enterprise workbench->project capabilites- >web services-xfire
Select Spring-1.2.6.jar->remove->ok
Method Two:
You can also add a XFire framework to a common WEB project item by Right-click the project name >myeclipse>add XFire Web Service capabilities to make this project functional XFire project.
Common exceptions when integrating spring WebService with Xfire
1, Provider com.bea.xml.stream.MXParserFactory not found The reason is the missing jar package Wstx-asi.jar and Stax-api.jar
2, Java.lang.noclassdeffounderror:javax/wsdl/wsdlexception0 The reason is that Wsdl4j.jar
3 is missing, the servlet Xfireservlet is currently unavailable (Xfire error) when accessing the WSDL because of the lack of Xbean-spring.jar
4, Java.lang.classnotfoundexception:o Rg.apache.commons.fileupload.FileItemFactory reason is missing Commons-fileupload-1.2.1.jar
5, spring1.x
<?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 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> </beans>
attribute is not allowed in beans, should be
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" " http://www.springframework.org/dtd/spring-beans.dtd"> <beans></beans>
How to build WebService in Web applications with Xfire