|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 3 of 6
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<name>Banking</name>
<namespace>mybank</namespace>
<serviceClass>com.mybank.xfire.example.IBankingService</serviceClass>
<implementationClass>com.mybank.xfire.example.BankingService</implementationClass>
</service>
</beans>
Let's see what we have here. The definition of our Web service is contained inside a <service> element, which contains a few child elements. The first child element is <name>, which can be any valid XML name you provide. This will be used by client programs and other components to locate your service.
For example, after the service is up, you'll use this name on a browser to see the WSDL.
The next child element is <namespace>. Any valid XML name is fine. <namespace> will be used to uniquely identify various parameters of your service.
The <serviceClass> element contains the Java class name that specifies the method signature. In our example, it is the interface IBankingService. If your Java class does not implement any interface, you'll put that class name here. You may have several methods in your
Java class or interface. Just one entry is needed to expose them all as Web services.
The <implementationClass> holds the Java class name that has the method implementations. This is an optional element. If the previous element <serviceClass> contained an interface, the corresponding implementation class must be named here.
That's it. Configuration of our Web service is complete.
Now we come to the last step, which is to get all necessary library files. How do we get them? Go to the XFire Website, download xfire-distribution-1.0.zip, and unzip it in a local folder. Copy the following jar files from the distribution and its lib directory into the WEB-INF\lib:
We are done. Let's deploy and start the application. To deploy the example application, just copy websvc.war into the webapps directory in your Apache Tomcat environment and wait a few seconds. It should start automatically. The application's complete source code is also contained in this war file. Our program is now ready as a Web service.
To see if the Web service is working, we'll have to test. First, we test to see if the WSDL is available. Let's type the URL
on a browser. Which URL? Since our application's war file is websvc.war and the service name given in services.xml is Banking, the WSDL URL would be: http://localhost:8080/websvc/services/Banking?wsdl.
Please note: The first part of your URL, i.e., http://localhost:8080, may differ depending on your application server's setup.
Regardless, as you type the URL, you'll see an XML document whose root element is <wsdl:definitions>. This document is called the service's WSDL. If you see it, this is the first verification that your application is available
as a Web service.
Archived Discussions (Read only)