|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Error in Bank service application |
« View previous topic :: View next topic » |
Author |
Message
|
hoa_lan_trang1982 |
Posted: Tue Nov 21, 2006 11:51 pm Post subject: Error in Bank service application |
|
|
Newbie
Joined: 15 Nov 2006 Posts: 7
|
Dear!
When I try to do like sample name Bank service application in "WebSphere MQ Solutions in a Microsoft .NET Environment" ebook I have error.
Quote: |
MQQueueManager queueManager = null;
MQQueue queueIn;
String replyToQueue;
MQMessage custDetails;
MQGetMessageOptions gmo;
StringWriter sw = new StringWriter();
XmlTextWriter tw = new XmlTextWriter(sw);
// next create the XML stream
tw.WriteStartDocument();
tw.WriteStartElement("BSS");
tw.WriteAttributeString("BankID", textBox1.Text);
tw.WriteAttributeString("UniqueID", textBox2.Text);
tw.WriteAttributeString("Name", textBox3.Text);
tw.WriteAttributeString("Addr", textBox4.Text);
tw.WriteAttributeString("DOB", textBox5.Text);
tw.WriteAttributeString("IDType", textBox6.Text);
tw.WriteEndElement();
tw.WriteEndDocument();
// clean up
tw.Flush();
tw.Close();
sw.Close();
string message = sw.ToString();
try
{
// connect to QueueManager
queueManager = new MQQueueManager("QM_APPLE");
System.Console.WriteLine("Connected to QueueManager QM_APPLE");
}
// catch MQExceptions
catch (MQException ex)
{
System.Console.WriteLine("MQException: compCode: " + ex.CompCode.ToString()
+ " Reason: " + ex.Reason.ToString());
}
//Declare WebSphereMQ variable - queue
MQQueue queueOut = null;
// Open queue out (local queue on CCS)
queueOut = queueManager.AccessQueue("CreditCheck", MQC.MQOO_OUTPUT |
MQC.MQOO_FAIL_IF_QUIESCING);
// model queue used to create dynamic queue with unique name - Q2*
queueIn = queueManager.AccessQueue("CreditScore", MQC.MQOO_INPUT_EXCLUSIVE |
MQC.MQOO_FAIL_IF_QUIESCING);
// save dynamic queue name in a variable in order to define replyToQueue
//Error here
replyToQueue = queueIn.Name;
//There is no error if I change this become:
replyToQueue = "CreditScore";
// create new message
custDetails = new MQMessage();
// define message properties
custDetails.Persistence = 1;
// the messages’ replyToQueue is now unique dynamic queue
custDetails.ReplyToQueueName = replyToQueue;
// set message type to request and format to string
custDetails.MessageType = MQC.MQMT_REQUEST;
custDetails.Format = MQC.MQFMT_STRING;
// put message on queueOut
custDetails.WriteString(message);
queueOut.Put(custDetails);
// create new message
MQMessage creditScore = new MQMessage();
// assign the correlation ID the value of the messageID of the message that
//was sent
creditScore.CorrelationId = custDetails.MessageId;
// set getmessageOptions so that there is a 10 seconds wait but stop if
//problems occur
gmo = new MQGetMessageOptions();
gmo.Options = MQC.MQGMO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING;
gmo.WaitInterval = 10000;
//This line of code also caused error but I don't know why
//Can you tell me know?
// get message
queueIn.Get(creditScore, gmo);
// close queueOut
queueOut.Close();
// close & delete queueIn (dynamic queue)
queueIn.CloseOptions = MQC.MQCO_DELETE_PURGE;
queueIn.Close();
// disconnect QueueManager
queueManager.Disconnect();
|
|
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 22, 2006 6:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Could this be because in .NET your variable is stored in Unicode ??  _________________ MQ & Broker admin |
|
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
|
|
|
|