Page 1 of 1

JBoss for z/OS

Posted: Thu May 07, 2009 9:01 am
by usaajrm
Are there any samples / guidance on creating a simple web service (server) under JBoss that will receive a message and echo on to the MVS console using the WTO method within MvsConsole?
John

Posted: Thu May 07, 2009 9:17 am
by dovetail
This is really two questions:

1) How to create a simple web service / web application that uses the JZOS MvsConsole class to write WTOs.

-- Take a look at the latest JZOS cookbook, available from the JZOS alphaWorks site. There is a chapter on using MvsConsole, as well as a couple of chapters on creating web services. You may want to start by writing a web service / servlet / web application and deploying it on z/OS Tomcat using T:Z Quickstart for Tomcat.

2) How to run JBOSS on z/OS.

-- We were successful getting JBOSS to run under the JZOS batch launcher serveral years ago, but haven't done anything with it lately. It is basically Tomcat plus a ton of jars to support the rest of the EJB / J2EE stack. For your requirement - do you really need / want it?

Posted: Thu May 07, 2009 3:43 pm
by usaajrm
I understand and agree. Unfortunately that is driven by a group I don't really think they are in I/T. :-) Onward, JBoss is it for now. I'll start on the cookbook and see what I can gleem. Thanks.

Posted: Thu May 07, 2009 3:45 pm
by dovetail
Just run Tomcat if you don't need the extra baggage and tell them that it is "JBoss lite" :-)

Posted: Fri May 08, 2009 1:16 pm
by usaajrm
I just might if it turns out to be quick. At Share in Austin, one of the labs showed us how to start a personal copy of tomcat in short amount of time. Is there an express example of creating a simple web service. All we want is a service to accept a string, then send the string to the MVS console using MvsConsole.wto. We've done a batch vesion. Its the web service piece we and I are stuck on. Thus leaves room for rehortic on JBoss / WebSphere / and on and on it goes. That was my attempt at humor. :P

Posted: Fri May 08, 2009 4:13 pm
by dovetail
Something like the following should work - you'll have to test it, since I haven't :-)

Code: Select all

/**
 * Simple Web service / servlet to issue a WTO.
 * Requires that you use HTTP "POST" with a single line message <= 256 characters
 * contained in "text/plain" content.
 */
public class WtoServlet extends HttpServlet {

	protected void doPost(HttpServletRequest request, 
			HttpServletResponse response) throws ServletException, IOException {

		BufferedReader rdr = new BufferedReader(
								new InputStreamReader(
										request.getInputStream(), 
										"ISO8859-1") );
		String message = rdr.readLine();
		if (message == null || message.length() == 0) {
			throw new ServletException("No input message");
		} else  if (message.length() > 256) {
			throw new ServletException("Message too big");
		}
		
		try {
			MvsConsole.wto(message, 
				WtoConstants.ROUTCDE_PROGRAMMER_INFORMATION,
				WtoConstants.DESC_IMPORTANT_INFORMATION_MESSAGES);
		} catch (ErrnoException ene) {
			throw new ServletException("Wto failed", ene);
		}
		
    }
}