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
JBoss for z/OS
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?
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?
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.
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);
}
}
}