JBoss for z/OS

Discussions regarding Open Source Java projects under z/OS (other than Tomcat)
Post Reply
usaajrm
Posts: 87
Joined: Tue Feb 06, 2007 3:46 pm

JBoss for z/OS

Post 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
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post 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?
usaajrm
Posts: 87
Joined: Tue Feb 06, 2007 3:46 pm

Post 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.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Just run Tomcat if you don't need the extra baggage and tell them that it is "JBoss lite" :-)
usaajrm
Posts: 87
Joined: Tue Feb 06, 2007 3:46 pm

Post 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
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post 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);
		}
		
    }
}
Post Reply