I am trying to do run a java app from an ASP page. I had success with the sample apps on 4Guys and webmonkey. What I am attempting now is to start do an MQSeries put, and return a message.
The MQ Message gets put, but nothing gets returned. Any thoughts??
Here is the code... quite simple actually:
ASP Code:
<%
set javaObject = GetObject("java:javaput"
strResult = javaObject.start()
Response.Write("Result: " & strResult)
set javaObject = nothing
%>
Java Code:
import com.ibm.mq.*;
public class javaput
{
public static void main(String[] args)
{
//do nothing
}
private String hostname = "XXX";
private String channel = "YYY";
private int port = 999;
private String qManager = "XXX";
private MQQueueManager qMgr;
public void init()
{
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
MQEnvironment.port = port;
}
public String start()
{
try
{
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_OUTPUT;
MQQueue system_default_local_queue =
qMgr.accessQueue("PIPInput",openOptions);
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Yo"
MQPutMessageOptions pmo = new MQPutMessageOptions();
system_default_local_queue.put(hello_world,pmo);
system_default_local_queue.close();
qMgr.disconnect();
}
catch (MQException ex)
{
return "An MQSeries Error Occurred : Completion Code " + ex.completionCode + " Reason Code " + ex.reasonCode;
}
catch (java.io.IOException ex)
{
return "An Error occurred while trying to write to the message buffer: " + ex;
}
return "Finised";
}
}
The MQ Message gets put, but nothing gets returned. Any thoughts??
Here is the code... quite simple actually:
ASP Code:
<%
set javaObject = GetObject("java:javaput"
strResult = javaObject.start()
Response.Write("Result: " & strResult)
set javaObject = nothing
%>
Java Code:
import com.ibm.mq.*;
public class javaput
{
public static void main(String[] args)
{
//do nothing
}
private String hostname = "XXX";
private String channel = "YYY";
private int port = 999;
private String qManager = "XXX";
private MQQueueManager qMgr;
public void init()
{
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
MQEnvironment.port = port;
}
public String start()
{
try
{
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_OUTPUT;
MQQueue system_default_local_queue =
qMgr.accessQueue("PIPInput",openOptions);
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Yo"
MQPutMessageOptions pmo = new MQPutMessageOptions();
system_default_local_queue.put(hello_world,pmo);
system_default_local_queue.close();
qMgr.disconnect();
}
catch (MQException ex)
{
return "An MQSeries Error Occurred : Completion Code " + ex.completionCode + " Reason Code " + ex.reasonCode;
}
catch (java.io.IOException ex)
{
return "An Error occurred while trying to write to the message buffer: " + ex;
}
return "Finised";
}
}