Creating an FlatFile Document in an Orchestration programmatically
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server Orchestration > Creating an FlatFile Document in an Orchestration programmatically




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Creating an FlatFile Document in an Orchestration programmatically  
Pieter Bart van Straalen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-23-06 12:14 AM

Hi,

I have created an Orchestration that does some processing. It stores the
result of these processes in a variable. This variable is declared in the
orchestration of type string. Now i want to assign the content of this
varaible to a document of type flatfile and this is were i get stuck.

My orchestration has the following flow and my problem is with expression
box 2.

1. Expression Box : CreateFFDocument
FFDocument = "SENDER:" + Message_IN.Routing.CompanyID  + "'" +
Message_IN.DocumentData ;
tMapType = System.Type.GetType("TestProject.Map1,
TestProject, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=05857a55a5bdf5c1");

2. Expression Box : ConstructFFDocument <---- Problem here
construct FFMessageOut
{
FFMessageOut = FFDocument //Gives error : Cannot implicitly convert
System.String to FFMessageSchema
}
 ========================================
======================
second option for expression Box ConstructFFDocument
construct FFMessageOut
{
xpath(FFMessageOut ,"/*[local-name()='DocumentRoot'and
namespace-uri()='']") = FFDocument ;
}

When i now build the project i get the following errors:
1.'FFMessageOut ' is initialized but its value is never used
2.'FFMessageOut ': message has not been initialized in construct statement
3.use of unconstructed message 'FFMessageOut ' <-- When i double click this
error it opens ExpressionBox Map

If have to somehow initialize the message, if i add the statement
FFMessageOut = null;
everything compiles and deploys but then i get the following error in the
evenlog:
The part 'part' of message 'Message_1' contained a null value at the end of
the construct block.
Exception type: NullPartException

3.Expression Box : Map
construct XMLOut_Msg
{
transform (XMLOut_Msg) = tMapType(FFMessageOut);
}

I hope someone can point me in the right direction.

Regards,
Pieter.







[ Post a follow-up to this message ]



    Re: Creating an FlatFile Document in an Orchestration programmatically  
Greg Forsythe


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-23-06 06:15 PM

If you are using typed message within an orchestration, they are not flat
files.
The flat file schema you have designed enables the Flat File Disassembler to
parse a flat file into an Xml message and the Flat File Assembler will
serialize the Xml message into a Flat file. While it is inside the
orchestration the message is Xml.
To create your message you can make the two fields companyId and data,
distinguished fields in your schema and use logic like this in a
MessageAssignment shape

xmlDocument.LoadXml("<root><sender>SENDER</sender><companyId/><data/></root>
");
FFDocument = xmlDocument;
FFDocument.companyId = Message_IN.Routing.CompanyID;
FFDocument.data = Message_IN.DocumentData;

The xml string needs to match the schema you have defined - use Generate
Instance on the schema to get an example.

Greg




"Pieter Bart van Straalen" <pbstraalen@schouw.org[Remove]> wrote in mess
age
news:esaHiWdfGHA.1204@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I have created an Orchestration that does some processing. It stores the
> result of these processes in a variable. This variable is declared in the
> orchestration of type string. Now i want to assign the content of this
> varaible to a document of type flatfile and this is were i get stuck.
>
> My orchestration has the following flow and my problem is with expression
> box 2.
>
> 1. Expression Box : CreateFFDocument
> FFDocument = "SENDER:" + Message_IN.Routing.CompanyID  + "'" +
>                          Message_IN.DocumentData ;
> tMapType = System.Type.GetType("TestProject.Map1,
>                                TestProject, Version=1.0.0.0,
>    Culture=neutral, PublicKeyToken=05857a55a5bdf5c1");
>
> 2. Expression Box : ConstructFFDocument <---- Problem here
> construct FFMessageOut
> {
>   FFMessageOut = FFDocument //Gives error : Cannot implicitly convert
> System.String to FFMessageSchema
> }
>  ========================================
======================
> second option for expression Box ConstructFFDocument
> construct FFMessageOut
> {
>  xpath(FFMessageOut ,"/*[local-name()='DocumentRoot'and
> namespace-uri()='']") = FFDocument ;
> }
>
> When i now build the project i get the following errors:
> 1.'FFMessageOut ' is initialized but its value is never used
> 2.'FFMessageOut ': message has not been initialized in construct statement
> 3.use of unconstructed message 'FFMessageOut ' <-- When i double click
> this error it opens ExpressionBox Map
>
> If have to somehow initialize the message, if i add the statement
> FFMessageOut = null;
> everything compiles and deploys but then i get the following error in the
> evenlog:
> The part 'part' of message 'Message_1' contained a null value at the end
> of the construct block.
> Exception type: NullPartException
>
> 3.Expression Box : Map
> construct XMLOut_Msg
> {
>       transform (XMLOut_Msg) = tMapType(FFMessageOut);
> }
>
> I hope someone can point me in the right direction.
>
> Regards,
> Pieter.
>







[ Post a follow-up to this message ]



    Re: Creating an FlatFile Document in an Orchestration programmatically  
Pieter Bart van Straalen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-29-06 10:21 PM

Thanks for your reaction,

Ok, so all documents are xml in biztalk, even flatfiles.
But creating the new message the way you describe is not possible because
the message is to big and complex.

When i'm working in VS i can select a schema from the solution explorer and
do "Validate Instance". Biztalk creates the xml flatfile structure for me. I
want to do this from within an orchestration.

So in my orchestration i want to do the following:
1. Create the new document and put it in a string var.
2. Parse string var to biztalk xml
3.Create new message --> xmlDocument.LoadXml (Parsed String)

Can this be done?

Regards,
Pieter.

"Greg Forsythe" <greg.forsythe@gmail.com> wrote in message
news:uUHXWnmfGHA.2032@TK2MSFTNGP02.phx.gbl...
> If you are using typed message within an orchestration, they are not flat
> files.
> The flat file schema you have designed enables the Flat File Disassembler
> to parse a flat file into an Xml message and the Flat File Assembler will
> serialize the Xml message into a Flat file. While it is inside the
> orchestration the message is Xml.
> To create your message you can make the two fields companyId and data,
> distinguished fields in your schema and use logic like this in a
> MessageAssignment shape
>
> xmlDocument.LoadXml("<root><sender>SENDER</sender><companyId/><data/></roo
t>");
> FFDocument = xmlDocument;
> FFDocument.companyId = Message_IN.Routing.CompanyID;
> FFDocument.data = Message_IN.DocumentData;
>
> The xml string needs to match the schema you have defined - use Generate
> Instance on the schema to get an example.
>
> Greg
>
>
>
>
> "Pieter Bart van Straalen" <pbstraalen@schouw.org[Remove]> wrote in
> message news:esaHiWdfGHA.1204@TK2MSFTNGP02.phx.gbl... 
>
>







[ Post a follow-up to this message ]



    Re: Creating an FlatFile Document in an Orchestration programmatically  
Greg Forsythe


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-30-06 12:15 PM

Pieter,

All typed documents are Xml in Biztalk.
The use of transforms, promoted properties and distinguished fields are only
possible with Xml data.

The "Validate Instance" command will take a flat file, disassemble it into
Xml and compare with the schema.
The "Generate Instance" will produce an example flat file or Xml. If you
chose flat file then an Xml file is created and "assembled" into the flat
file output.

The standard way of handling flat files is to disassemble into Xml in a
pipeline, perform necessary processing and then assemble into a flat file in
the send pipeline.
Creating a string and then disassembling into Xml in the orchestration is
redundant, you might as well create the Xml and save yourself a step.

Automatically creating a sample instance is fine in a design time situation,
doing this in the runtime is very difficult. There are too many variables.
Do you include optional fields?, What about dates. what date do you use,
numbers are the same. If a element has a data type on xs:int then it must
contain a valid integer if the node exists. It would be very difficult to
create a single method that would suit everybody.

One way you can create this message is to use C#. You can create .Net class
based on your schema (xsd.exe), in a class library create an instance,
populate with data and serialize into Xml. This class can be compiled,
GAC'ed and called from your orchestration.
e.g.
static public System.Xml.XmlDocument MyNamespace.CreateMessage()

from an orchestration:
FFDocument = MyNamespace.CreateMessage();


Greg


"Pieter Bart van Straalen" <pbstraalen@schouw.org[Remove]> wrote in mess
age
news:eyqUP7xgGHA.1208@TK2MSFTNGP02.phx.gbl...
> Thanks for your reaction,
>
> Ok, so all documents are xml in biztalk, even flatfiles.
> But creating the new message the way you describe is not possible because
> the message is to big and complex.
>
> When i'm working in VS i can select a schema from the solution explorer
> and do "Validate Instance". Biztalk creates the xml flatfile structure for
> me. I want to do this from within an orchestration.
>
> So in my orchestration i want to do the following:
> 1. Create the new document and put it in a string var.
> 2. Parse string var to biztalk xml
> 3.Create new message --> xmlDocument.LoadXml (Parsed String)
>
> Can this be done?
>
> Regards,
> Pieter.
>
> "Greg Forsythe" <greg.forsythe@gmail.com> wrote in message
> news:uUHXWnmfGHA.2032@TK2MSFTNGP02.phx.gbl... 
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:25 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register