|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
UPES |
« View previous topic :: View next topic » |
Author |
Message
|
mahek |
Posted: Wed Dec 22, 2004 3:25 pm Post subject: UPES |
|
|
Voyager
Joined: 10 Sep 2004 Posts: 87
|
Hi all,
I want to send data to an activity outputdatacontainer from a java program the activity name is (A) and the data structure for this activity outputcontainer is INFO with members are FIRSTNME and LASTNAME(BOTH ARE STRINGS) I have some knowledge that we can do this by using UPES can any please guide me with the java code to solve this senario.
Thanks |
|
Back to top |
|
 |
CHF |
Posted: Thu Dec 23, 2004 5:38 am Post subject: |
|
|
 Master
Joined: 16 Dec 2003 Posts: 297
|
Refer to the examples in the Workflow Programming guide.
Part 10 - Chapters 70 thru 75 _________________ CHF  |
|
Back to top |
|
 |
vennela |
Posted: Thu Dec 23, 2004 9:06 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
I am posting a sample here. I haven't tested it.
See if this helps. If not modify it to your needs.
Code: |
import com.ibm.mq.*;
import java.io.IOException;
import java.io.*;
public class UPESProcesserSample extends Object {
public static void main (String args [] ) {
MQMessage outMessage = new MQMessage() ;
String msgTxt = "";
try {
String EXEXMLINPUTQ = args[0];
String UPESQ = args[1];
String QM1 = args[2];
MQQueueManager qmgr = new MQQueueManager(QM1 ) ;
System.out.println("Connected to Queue Manager : " + QM1);
int openOptionsForGet = MQC.MQOO_INPUT_SHARED ;
MQQueue OutQueue = qmgr.accessQueue(UPESQ , openOptionsForGet, null, null, null);
System.out.println("Opened Queue " + UPESQ + " to GET : ");
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_CONVERT;
MQMessage inMsg = new MQMessage();
OutQueue.get(inMsg, gmo);
int msgLength = inMsg.getMessageLength() ;
System.out.println(" msgLength " + msgLength);
msgTxt = inMsg.readString(msgLength);
OutQueue.close();
System.out.println("Closed the Queue ");
System.out.println("Parsing the message to get the actImplCorrelID \n");
String S1 = "<ActImplCorrelID>";
String S2 = "</ActImplCorrelID>";
System.out.println("msgTxt length " + msgTxt.length());
String actImplCorrelID = msgTxt.substring(msgTxt.indexOf(S1) + S1.length(), msgTxt.indexOf(S2));
System.out.println("actImplCorrelID is " + actImplCorrelID);
String XMLMessage = "";
XMLMessage = XMLMessage + "<?xml version=\"1.0\" standalone=\"yes\"?> ";
XMLMessage = XMLMessage + "<!-- This document is generated by UPES Response class --> ";
XMLMessage = XMLMessage + "<WfMessage> ";
XMLMessage = XMLMessage + "<WfMessageHeader> ";
XMLMessage = XMLMessage + "<ResponseRequired>No</ResponseRequired> ";
XMLMessage = XMLMessage + "</WfMessageHeader> ";
XMLMessage = XMLMessage + "<ActivityImplInvokeResponse> ";
XMLMessage = XMLMessage + "<ActImplCorrelID>" + actImplCorrelID.trim() + "</ActImplCorrelID> ";
XMLMessage = XMLMessage + "<ProgramRC> 0 </ProgramRC> ";
XMLMessage = XMLMessage + "<ProgramOutputData> " ;
XMLMessage = XMLMessage + "<INFO>";
XMLMessage = XMLMessage + "<FIRSTNAME> BalaKrishna </FIRSTNAME> \n";
XMLMessage = XMLMessage + "<LASTNAME> + Nandamoori </LASTNAME> \n";
XMLMessage = XMLMessage + "</INFO>";
XMLMessage = XMLMessage + " </ProgramOutputData> </ActivityImplInvokeResponse> ";
XMLMessage = XMLMessage + "</WfMessage>";
System.out.println("\n \n -------------------- \n \n");
System.out.println("---- Workflow response ------ \n \n");
System.out.println(XMLMessage);
System.out.println("\n \n -------------------- \n \n");
System.out.println("---- Workflow response ended------ \n \n");
System.out.println("\n \n -------------------- \n \n");
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_SET_IDENTITY_CONTEXT ;
MQQueue InQueue = qmgr.accessQueue(EXEXMLINPUTQ , openOptions, null, null, null);
System.out.println("Opened XML Input Queue " + EXEXMLINPUTQ + "to PUT : ");
MQMessage inMessage = new MQMessage();
inMessage.userId = "ADMIN";
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_SET_IDENTITY_CONTEXT;
inMessage.writeString(XMLMessage);
InQueue.put(inMessage, pmo);
InQueue.close();
qmgr.disconnect() ;
System.out.println("Disconnected from the Queue Manager ");
}
catch(MQException ex){
System.out.println("MQ Error Occurred " );
System.out.println("MQ Error - Reason code :" + ex.reasonCode);
}
catch (Exception e){
System.out.println("Non MQ ERROR occurred");
System.out.println("Error : " + e);
}
}
} |
|
|
Back to top |
|
 |
mahek |
Posted: Thu Dec 23, 2004 11:57 am Post subject: |
|
|
Voyager
Joined: 10 Sep 2004 Posts: 87
|
Thanks venella I will try this out |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|