none
create a new message in Visual studio of the specified schema RRS feed

  • Question

  • Hi,

    i need to create a message from the existing schema with my own values so let me know how can i create message from that schema in the visual studio 

    Regards,

    Gyan

    Wednesday, February 18, 2015 5:37 AM

Answers

  • There is no out-of-the-box automated way of doing this. Also I would ask the question: why would you need this?

    In general if a new message is needed inside an Orchestration, you use a Message Contruct Shape with either a

    - Transform Shape (calling a Map that maps from the the source message you already have inside your Orchestration to the desired new message type)

    - Message Assignment Shape (can be used for creating a new message from scratch)

    An example inside a Message Assignment Shape:

    varXMLDoc.LoadXml(@"<ns0:root xmlns:ns0="yournamespace"><ID>10</ID></ns0:root>");  
    newMessage = varXMLDom;

    Morten la cour

    • Marked as answer by Angie Xu Wednesday, February 25, 2015 11:02 AM
    Wednesday, February 18, 2015 6:24 AM

All replies

  • Hi Gyan,

    You need generate a sample instance message from your schema. In Solution Explorer, right-click the schema for which you want to generate an instance message, and then click Generate Instance.

    For step by step process refer the MSDN article: How to Generate Instance Messages

    Once you have the message/instance you can modify the values.

    Rachit

    Please mark as answer or vote as helpful if my reply does




    Wednesday, February 18, 2015 5:50 AM
    Moderator
  • Hi Rachit,

    Thanks for reply.

    but i need to generate instance at run time like in orchestration.

    Regards,

    Gyan

    Wednesday, February 18, 2015 6:18 AM
  • There is no out-of-the-box automated way of doing this. Also I would ask the question: why would you need this?

    In general if a new message is needed inside an Orchestration, you use a Message Contruct Shape with either a

    - Transform Shape (calling a Map that maps from the the source message you already have inside your Orchestration to the desired new message type)

    - Message Assignment Shape (can be used for creating a new message from scratch)

    An example inside a Message Assignment Shape:

    varXMLDoc.LoadXml(@"<ns0:root xmlns:ns0="yournamespace"><ID>10</ID></ns0:root>");  
    newMessage = varXMLDom;

    Morten la cour

    • Marked as answer by Angie Xu Wednesday, February 25, 2015 11:02 AM
    Wednesday, February 18, 2015 6:24 AM
  • "create a message from the existing schema with my own values" at runtime this can be done using Message-assignment not the Transform shape as in the map you generally transform the data from one schema to another (off course you can set default values in the map), but Map are to map from one schema to another not for creating a message with own values.

    In Message-assignment, you can as suggested assign your values to the schema as shown. But Message-assignment shape has restrictions when you it comes to complex message assignment.

    Other option using Message-assignment is to call a C# helper where in the helper construct a message based on the schema and return the constructed message in the C# helper. For this create a typed class based on your schema using XSD.exe. And construct this typed class in C# helper and return the message back.

    Regards,

    M.R.Ashwin Prabhu


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

    Wednesday, February 18, 2015 10:26 AM