Xfire is out of date. It's okay to know about it. Go deeper
Xfire is a servlet-based SOA application development framework that requires the support of servlet containers. Xfire supports running in multiple servlet containers, including websphere, WebLogic, and tomcat. Xfire requires support from the xalan project, but 1.2.6 does not contain the corresponding JAR file. Therefore, visit xml.apache.org to download the Binary Package of the xalan project.
Create and publish a server
1. Create a web services Porject ( Create a Web Service)
The content of services. XML is as follows: <? XML version = " 1.0 " Encoding = " UTF-8 " ?>
< Beans xmlns = " Http://xfire.codehaus.org/config/1.0 " >
</Beans>
2. Compile the serverCode(Xfire requires one interface and one implementation, while Jax-ws only requires one implementation )(ImplementationWeb Services)
The adderimpl. Java code is as follows: PackageNet;
Public ClassAdderimplImplementsIadder {
Public DoubleAdd (DoubleA,DoubleB ){
ReturnA+B;
}
}
The Iadder. Java code is as follows:
Package Net;
Public InterfaceIadder {
Public DoubleAdd (DoubleA,DoubleB );
}
3. Click the new Web Services button in the toolbar and set it as follows. (ReleaseWeb Services)
After you click Finish, the content of services. XML is as follows: <?XML version = "1.0" encoding = "UTF-8"?>
<BeansXmlns= "Http://xfire.codehaus.org/config/1.0">
< Service >
< Name > Addin </ Name > // Service name
< Serviceclass > Net. Iadder </ Serviceclass > // Interface Name
< Implementationclass > Net. adderimpl </ Implementationclass > // Implementation Class Name
< Style > Wrapped </ Style >
< Use > Literal </ Use >
< Scope > Application </ Scope >
</ Service > </ Beans >
4. start Tomcat and test the server side (TestWeb Services)
Enter http: // localhost: 8080/xfire_src/services/addin? WSDL (Note: The difference between this path and Jax-ws). If the XML is correctly displayed, everything is OK!
Compile the client
1. Create a web services Porject (xfire project is required)
2. New-other-myeclipse-Web Services Client.
3. Compile the test class PackageNet;
Public Class Mrun {
Public Static Void Main (string [] ARGs ){
Addinclient Client = New Addinclient ();
Addinporttype Port = Client. getaddinhttpport ();
System. Out. println (port. Add ( 15 , 36 ));
}
}
PS: xfire Web Services Project is created on both the server side and the client side. Therefore, select xfire on the first page, on the second page, you can define services as needed. XML name and path, and how to insert the configuration to the Web. XML content (generally set by default). You can select different packages on the last page as needed.