Deploying services and clients
ppoliani Nov 28, 2011 4:17 PMHi everybody,
I am following the instructions included in the development guide. More particullary, i put the war file in the C:\jboss-5.1.0.GA\server\default\deploy directory. The code of my client is the following:
.....
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
/*
* Write the HTML to the response
*/
out.println("<html>");
out.println("<head>");
out.println("<title> A very simple servlet example</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>This is a text</h1>");
URL wsdlURL = TradeFlightServicePorts.WSDL_LOCATION;
/**Code taken from jbossts xts example*/
System.out.println("CLIENT: obtaining userTransaction...");
UserTransaction ut = UserTransactionFactory.userTransaction();
System.out.println("CLIENT: starting the transaction...");
try {
ut.begin();
} catch (WrongStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
out.println("CLIENT: transaction ID= " + ut.toString());
out.println("CLIENT: calling business Web Services...");
/* ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry();
String activationCoordinatorURI = serviceRegistry
.getServiceURI(CoordinationConstants.ACTIVATION_ENDPOINT_NAME);
String coordinationType = "http://docs.oasis-open.org/ws-tx/wsat/2006/06";
CoordinationContextType contextType = ActivationCoordinator.createCoordinationContext(activationCoordinatorURI, "msgID", coordinationType, null, null);*/
TradeFlightServicePorts ss = new TradeFlightServicePorts(wsdlURL, SERVICE_NAME);
TradeFlightService port = ss.getTradeFlightService();
{
/**Calling flight web service*/
System.out.println("Invoking checkFlightAvailability...");
System.out.println("Dummy Implementation of operation checkAvailability in FlightService");
FlightRequestInfo req = new FlightRequestInfo();
req.setDestination("Athens");
FlightStatus status = port.checkFlightAvailability(req);
out.println("Flight service checkFlightAvailability the source city is=" + status.getSource() + "\n");
}
System.exit(0);
out.println("</body>");
out.println("</html>");
out.close();
}
......
However it throws me an exception on ut.begin();. Obviously UserTransactionFactory.userTransaction(); return null.
Could you help? What am i doing wrong