471,570 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,570 software developers and data experts.

InvalidOperationException

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
1 2499
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.

Similar topics

reply views Thread by Chi Tang | last post: by
2 posts views Thread by Spam Catcher | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.