By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 2,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

InvalidOperationException

P: n/a
Hi,

I am trying to use the following code to send data over a Message
Queue. The following error is being given:
"An unhandled exception of type 'System.InvalidOperationException'
occurred in system.xml.dll

Additional information: There was an error generating the XML
document."

Can someone help me solve the problem out.
Thanks in Advance

** Code **
MessageQueueCommunication m = new MessageQueueCommunication("myPath");
CommunicationUnit cu = new CommunicationUnit(m, "Test");
MessageQueue mq = new MessageQueue(myPath);
mq.Send(cu);
public abstract class ICommunicationTuple
{
public ICommunicationTuple(){}
}

public class MessageQueueCommunication : ICommunicationTuple
{
private string msgQueuePath;
public MessageQueueCommunication(){}

public MessageQueueCommunication(string messageQueuePath)
{
MessageQueuePath = messageQueuePath;
}

public string MessageQueuePath
{
set { msgQueuePath = value;}
get { return msgQueuePath; }
}
}

public class CommunicationUnit
{
private ICommunicationTuple communicationTuple;
private string communicationType;

public CommunicationUnit(){}
public CommunicationUnit(ICommunicationTuple commTuple, string
commType)
{
CommunicationTuple = commTuple;
CommunicationType = commType;
}

public ICommunicationTuple CommunicationTuple
{
get { return communicationTuple; }
set { communicationTuple = value; }
}

public string CommunicationType
{
set { communicationType = value; }
get { return communicationType; }
}

Dec 5 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Curious,

By default, the message queue classes use an XmlMessageFormatter to
serialize information into the queue (God knows why).

If you have a .NET application listening on the other end, then I would
recommend setting the Formatter property to the BinaryMessageFormatter
class. This will mean that your classes have to be marked as serializable,
but I think you will get better performance as well.

Also, your abstract class should not be named ICommunicationTuple, but
rather, CommunicationTuple, since it is an abstract class, not an interface.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Curious" <th****@mail.global.net.mt> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi,

I am trying to use the following code to send data over a Message
Queue. The following error is being given:
"An unhandled exception of type 'System.InvalidOperationException'
occurred in system.xml.dll

Additional information: There was an error generating the XML
document."

Can someone help me solve the problem out.
Thanks in Advance

** Code **
MessageQueueCommunication m = new MessageQueueCommunication("myPath");
CommunicationUnit cu = new CommunicationUnit(m, "Test");
MessageQueue mq = new MessageQueue(myPath);
mq.Send(cu);
public abstract class ICommunicationTuple
{
public ICommunicationTuple(){}
}

public class MessageQueueCommunication : ICommunicationTuple
{
private string msgQueuePath;
public MessageQueueCommunication(){}

public MessageQueueCommunication(string messageQueuePath)
{
MessageQueuePath = messageQueuePath;
}

public string MessageQueuePath
{
set { msgQueuePath = value;}
get { return msgQueuePath; }
}
}

public class CommunicationUnit
{
private ICommunicationTuple communicationTuple;
private string communicationType;

public CommunicationUnit(){}
public CommunicationUnit(ICommunicationTuple commTuple, string
commType)
{
CommunicationTuple = commTuple;
CommunicationType = commType;
}

public ICommunicationTuple CommunicationTuple
{
get { return communicationTuple; }
set { communicationTuple = value; }
}

public string CommunicationType
{
set { communicationType = value; }
get { return communicationType; }
}

Dec 5 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.