ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Problems Reading the content of a Message with asp.net

Post new topic  Reply to topic
 Problems Reading the content of a Message with asp.net « View previous topic :: View next topic » 
Author Message
varholl
PostPosted: Mon Sep 18, 2006 7:38 am    Post subject: Problems Reading the content of a Message with asp.net Reply with quote

Novice

Joined: 23 May 2006
Posts: 21
Location: Argentina

Hey friends!, hi all!!
I am facing a new problem right now, i write a message, and send it, aparently it works, but sadly it's not working fine.. i don't know why, but i write the message with the method WriteString, and in the next line y try to read the content to try it, with this method ReadString(Message.MessageLenght), in the program guide said thats the way to read the message, the other way is with UTF format, with WriteUTF and ReadUTF methods, i tried too, but it doesn't works, alway i want to read the message it raises an error, in the case of ReadString, it says that ir cant read beyond the end of the stream, (i tried to read 1 length, and it didnt work too), with readUTF it says that the startIndex parameter is negativo or 0.
HELP ME PLEASE I CANT READ MESSAGES!!
Thank you!!
_________________
Consulting on web based Systems.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jefflowrey
PostPosted: Mon Sep 18, 2006 7:43 am    Post subject: Re: Problems Reading the content of a Message with asp.net Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

varholl wrote:
but sadly it's not working fine.. i don't know why,


Then you need to use a process known as "troubleshooting" to find out why.

If you want our help with this process, you must be much more specific about everything that you are doing, and you must spend more of your time trying to solve this problem than you expect us to spend.

Start by reading the Application Programming Guide.

And then read about the command 'amqsbcg'.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
varholl
PostPosted: Mon Sep 18, 2006 7:50 am    Post subject: Reply with quote

Novice

Joined: 23 May 2006
Posts: 21
Location: Argentina

i think you dont understand the meaning of FORUM, if i knew all this stuff i wouldnt ask you, And i'm not asking you, because you always answer me to read the guide.., i'm a grand master in other forum about .net, and i answer all the questions trying to solve the people problems, not saying them "read the .net guide", because its not helpfull, understand that i have my reasons to not read the entire guide, i Cant read the entire guide, and i read the blocks i needed. I dont want to be an MQ Expert, i dont need to be an MQ expert, i just need to send messages, recieve and reply another ones..
If you want to help me, just perfect, if you dont, then just let another people to answer, maybe they want to help people.. ok?
Dont Mad with me.. but i need someone to help me.. not to send me to read.. otherwise i wouldnt even asked the question here..
WHY EXISTS A FORUM, IF PEOPLE WONT ANSWER QUESTION FOR NEWBIES?
_________________
Consulting on web based Systems.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jefflowrey
PostPosted: Mon Sep 18, 2006 7:54 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Every forum exists for different reasons.

I can't answer your question as written, because it does not provide enough information.

How do you answer a .NET question when someone says "Help me urgently my .NET program doesn't work and I don't know why!"?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Sep 18, 2006 7:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Also, I'm not an ASP.NET expert, but my understanding is that ASP uses VBScript.

So you can look at the VB .NET samples that come with MQ, which will be installed in <mq_install_root>\Tools\dotnet\samples\vb if you installed the SDK.

Also, the most frequent problem that people have with ASP.NET is that they do not authorize the ASP user against MQ.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
varholl
PostPosted: Mon Sep 18, 2006 8:03 am    Post subject: Reply with quote

Novice

Joined: 23 May 2006
Posts: 21
Location: Argentina

I ask Data, i dont send them to read.. my friend..

I will tell my problem.. if you want to help me..

I made two .net programs.
One just send messages and wait the replies..
the other one, recieve those messages and replies them..
they are just simulators to test queues..

when i send one message from the first program, it send it perfectly, but i dont know why, in the second program when i get that message, i cant read the string i wrote in the first program.. it says that i'm trying to "read beyond the end of the message", the method i used was MQMessage.ReadString(MQMessage.MessageLength), i tried to write the message with writeUTF and read it with ReadUTF, but it still doesnt work, its like i write the message but it doenst really write it..

What can it be?
_________________
Consulting on web based Systems.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
varholl
PostPosted: Mon Sep 18, 2006 8:37 am    Post subject: Reply with quote

Novice

Joined: 23 May 2006
Posts: 21
Location: Argentina

And how can i give that users permissions because i'm not the MQ administrator, so i have to asq him, the weird thing is that i test it some months ago and it worked fine.. how could it be..
_________________
Consulting on web based Systems.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jefflowrey
PostPosted: Mon Sep 18, 2006 8:41 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

First thing I would try is using ReadFully instead of ReadString.

But you would be getting an error trying to connect to the queue manager or trying to Get from the queue if you were having a security problem.

If you do get an error doing that, and the MQ Reason Code is 2035, then you should talk to your MQ administrator, and ask him or her to grant the necessary authorities to your ASPNET user.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
varholl
PostPosted: Mon Sep 18, 2006 9:05 am    Post subject: Reply with quote

Novice

Joined: 23 May 2006
Posts: 21
Location: Argentina

Didn't work , i tried with ReadFully, setting the format to String and Reading with ReadString, but it's still dont working.

I dont think it's a configuration problem, i'm sure it maybe something i miss in the code..

the code to put the message is this

MQMessage MqMsg =new MQMessage();
//MqMsg.WriteString(Msg);
MqMsg.WriteString(Msg);
MqMsg.Format = MQC.MQFMT_STRING;

MqMsg.ReadString(MqMsg.MessageLength); //put this code to see if it is erally writing
MqMsg.ReplyToQueueName = "IXOS.SGN.CONS.RESP";


//specify the message options...
MQPutMessageOptions pmo =new MQPutMessageOptions();

//accept the defaults,
//same as MQPMO_DEFAULT constant
//put the message on the queue
MqMsg.CorrelationId = correlId;
system_default_local_queue.Put(MqMsg,pmo);

//get the message back again...
//First define a WebSphere MQ message buffer to receive the message into..

byte[] msj=MqMsg.MessageId;

system_default_local_queue.Close();

MqM.Disconnect();

Where msg is this..

<MOTIVOS_CONS_I_IX><HEAD_SGN><SERVICIO>MOTIVOS_CONS</SERVICIO><USUARIO>IXOS</USUARIO><MAX_REG>999</MAX_REG><COD_RET></COD_RET><DESC_ERROR></DESC_ERROR><MSG_ERROR></MSG_ERROR></HEAD_SGN><BODY_SGN><LEGACY>SOMETHING</LEGACY><COD_MOTIVO>2</COD_MOTIVO><DESC_MOTIVO></DESC_MOTIVO></BODY_SGN></MOTIVOS_CONS_I_IX>
_________________
Consulting on web based Systems.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jefflowrey
PostPosted: Mon Sep 18, 2006 9:15 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Ah!

In order to read back the buffer that you have just written to, you will have to MQMessage.Seek(0) first.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Sep 18, 2006 9:17 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

In addition, reading the buffer back won't really do a lot to verify what you've written in a meaningful way.

You are better off using the presupplied sample program amqsbcg to read your messages off a queue and examine the output.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
varholl
PostPosted: Mon Sep 18, 2006 9:19 am    Post subject: Reply with quote

Novice

Joined: 23 May 2006
Posts: 21
Location: Argentina

ok, i didnt knew that, but, i get the same problem when i get the message, i mean, in my second program when i search in the queue, i can get the message but cant read it..thats why i put the readstring when y write the message..

Do know why i cant read the message when get it?
thanks
_________________
Consulting on web based Systems.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jefflowrey
PostPosted: Mon Sep 18, 2006 9:28 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Is it a different error message in the reading program?

Again, try using amqsbcg. See if *it* can read your message.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
varholl
PostPosted: Mon Sep 18, 2006 9:41 am    Post subject: Reply with quote

Novice

Joined: 23 May 2006
Posts: 21
Location: Argentina

look, i solved the problem, i dont know why, because i didnt see it in any sample, but, i did this..

msj.Seek(0);

doc.InnerXml=msj.ReadString(msj.MessageLength);

and it worked perfectly.. it seems that i need to seek before reading..

Thank you Jeff..
_________________
Consulting on web based Systems.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Problems Reading the content of a Message with asp.net
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.