Introduction to Top-Down Approach webservice using JAXB, JBOSS-WS and JBOSS with Eclipse IDE
Hope you are keen to explore on how to develop a top-down approach web service. Here I've used JDK 1.6, JBOSS 5.1.0 and a WSDL.
The IDE is Eclipse LUNA
Create a new dynamic web project using eclipse
File -> New -> Other -> Web-> Dynamic Web Project
Once you are done, its time for us to create the web service. Please ensure that you have JbossWS Preferences available under your Windows->Preferences->Web Services
I've highlighted it in the above screen shot
Also ensure that you have the below jar's in the jboss/lib/endorsed
activation.jar
jaxb-api.jar
jaxb-impl.jar
jaxb-xjc.jar
jaxb1-impl.jar
jbossws-native-jaxrpc.jar
jbossws-native-jaxws-ext.jar
jbossws-native-jaxws.jar
jbossws-native-saaj.jar
xalan.jar
xercesImpl.jar
Now go to File -> New -> Web Services - > Webservice and click next
Select it as Top down Java bean Web Service
Click next and then your web service codes will be generated. You can see your SOAP service implementation class. Now you can create a class and implement the SOAP service class and use the request and response methods.
Note that your web.xml looks like below
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>TestService</display-name>
<servlet>
<display-name>Test Service</display-name>
<servlet-name>TestService</servlet-name>
<servlet-class>com.temenos.maheshtest.impl.TestService</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestService</servlet-name>
<url-pattern>/TestService</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
Now that you have everything in place, build your war file and deploy in the JBOSS.
All the best :)



No comments:
Post a Comment