Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Message Queue In GP

Posted on by Microsoft Employee

HI all,

I'm using Message Queue to send the data to GP.i'm getting XML data in Message Queue.but that customer data(when i try to insert the customer) is not syncing in GP.Please suggest me for this problem .

My code is below :

eConnectType eConnect = new eConnectType(); // Instantiate an eConnectType schema object
XmlSerializer serializer = new XmlSerializer(eConnect.GetType());// Create an XML serializer object
RMCustomerMasterType[] mySmCustomerMaster = { mySMCustomerMaster };
eConnect.RMCustomerMasterType = mySmCustomerMaster;// Populate the eConnectType object with the RMCustomerMasterType schema object
MemoryStream memoryStream = new MemoryStream();// Serialize the object to produce an XML document
serializer.Serialize(memoryStream, eConnect);
memoryStream.Position = 0;
XmlDocument createCustomerDocument = new XmlDocument();
createCustomerDocument.Load(memoryStream);

//Creating the customer entity
// customerResult = eConnectMethod.CreateEntity(sConnectionString, createCustomerDocument.OuterXml);

// HairDirect Customizations //

MessageQueue queue = new MessageQueue(@".\private$\econnect_incoming");
if (!MessageQueue.Exists(@".\private$\econnect_incoming"))
{
MessageQueue.Create(@".\private$\econnect_incoming");
}

Message message = new Message();
ActiveXMessageFormatter formatter = new ActiveXMessageFormatter();
MessageQueueTransaction transaction = new MessageQueueTransaction();
message.Label = "Customer Creation";
message.Body = createCustomerDocument.OuterXml;
message.Formatter = formatter;
queue.Send(message, "Customer XML Data", transaction);
formatter.Write(message, createCustomerDocument.OuterXml);
transaction.Begin();
transaction.Commit();
queue.Close();

 

Please tell me if i miss anything in this code.

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans