Archive for the 'Java' Category

Web Services, WS-Policy, Implementation

After a talk with my supervisor and getting deeper into WS-Policy, it seems that it is not only for security policies and can represent all other types of policies as well. The formal description of WS-Policy can be found here.

So the problem was to implement a web service and attach a ws-policy to it. I’ve used to work with JBoss and BEA weblogic workshop but no Tomcat (a little bit). The astonishing thing I found about weblogic was that they were bought by oracle and now you are using oracle bea weblogic workshop. It also provides the simplest way to use WS-Policy with the web services (with this help) you can figure out how easy is attaching a ws-policy to a web service.

Anyway, thinking of open source and being able to have a defence of why did I use an application server, I tried to put the service into Tomcat and/or Jboss. Jboss version 5 is in its Candidate release at the time of my coding While Tomcat has its 6th version coming out.

Tomcat was lighter and took less time to run and start while Jboss has its huge attachments and take almost 3 to 5 minutes on my computer to run. The deployment of the codes is not considered in the times mentioned.

AXIS is an important part of my work done, it is not my work but it is a library that I used. The funny thing about AXIS is that recently it come to version 2 and the community call it AXIS 2 while also having the versions beside it, like AXIS 2 ver 1.4 which at the beginning confused me a lot. I was looking for downloading AXIS 2 but I got to AXIS2 ver 1.4.

Finally within Eclipse, I tried using two version of Tomcat server (both 5.5), JBoss (ver 5, candidate release) and one Tomcat (ver 6.0), I don’t know what was going on but at the beginning I got a lot of exceptions at the time of generation which lead me to this bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=84843), reading that it should be solved on the later versions but somehow it was not.

After overcoming the errors generated by AXIS, I didn’t get the results I wanted, the results I want want basically being able to generate a web service based on a function / WSDL file. I switched to AXIS2, The reason was basically to be updated with the latest technology besides being compatible with WS-Policy.

After doing that I got to the problem of getting errors like “Servlet.service() for servlet AxisServlet threw exception java.lang.NoSuchMethodError” finding this page (http://blogs.msdn.com/dotnetinterop/archive/2005/03/31/404087.aspx) figured out that this is not only my problem and is for all other ones using AXIS and AXIS2 together.

So I finally implement a web service with the help of AXIS2 on a Tomcat server which is functional, I’m sending soap messages through the interface and getting response, although it is a sayHello example it shows that everything is in place and working. some address like : http://localhost:64825/wsexplorer/wsexplorer.jsp?org.eclipse.wst.ws.explorer=0 the WSDL address was http://localhost:8080/webserviceSH/services/HelloWorld?wsdl . Although it gives some exceptions in the meantime (mentioned above), it is running smoothly.

The only thing remaining is to check if I attach a WS-Policy to it how it behaves, It should be simple like the one Oracle described.

  • AXIS : http://ws.apache.org/axis/
  • Tutorial Basic : http://www.roseindia.net/webservices/buildingsimplewebservice.shtml
  • WS-Policy in BEA Weblogic : http://edocs.beasys.com/wls/docs92/ConsoleHelp/taskhelp/webservices/ConfigureWSPolicyFile.html
  • WTP Tutorial : http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html

Drools , run an example

I was wondering in the drools to run an example myself and there were nowhere on the net telling you (or better saying explicitly telling you) that for running the example you need to have a backbone class defined behind it, a class with some simple functions and some variables, it should be in the same package, but it should also be imported to your rule file (.drl).

So a Rule in Jboss Rules (Drools) just play with class attributes and you can not define classes in its environment,  after writing the code for classes you need to come up with rules, the only good thing is that it has an integrated environment that suggests you functions and variables as programming the rules.

Drools Tutorial

Drools

I’m now working on Drools, it is a Jboss product (whish itself is now under redhat umbrella).
If you need to run drools on eclipse remember the following things :

  1. Compile under java 1.4 only and not upper (till Drools 4.0.3)
  2. After making a sample project (for a test purpose) you definitely will get an error message if you don’t manually add org.eclipse.jdt.core_ to your java library

For mor information see the posting below :

  1. Same problem and the solution from Jboss
  2. A good resource to find out what JavaDialectConfiguration is

Close
E-mail It