BizTalk Server Orchestration - Accessing Promoted Properties in Pipeline

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > May 2004 > Accessing Promoted Properties in Pipeline





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Accessing Promoted Properties in Pipeline
Scot

2004-05-12, 9:54 am

Hi
I am not able to access the promoted properties inside a pipeline
Any ideas
Regards
Scot
Matt Milner

2004-05-12, 1:19 pm

you might need to wait until the stream is done being read before the
properties will be there. Look at the SDK pipeline samples for how you can
use a steram that raises an event when it is done being read.

Matt


"Scot" <anonymous@discussions.microsoft.com> wrote in message
news:9A93DFD1-9E30-447D-9F76-C42A443DEF74@microsoft.com...
> Hi
> I am not able to access the promoted properties inside a pipeline
> Any ideas
> Regards
> Scot



scot

2004-05-13, 4:34 pm

Hi Mat,
what am trying to do is to insert some records into a table as i am receiving documents.
eg i get a a PO. i have promoted 3 fields from schema. and i use the receive pipeline to get the flat file. Now the schema specified converts it to xml and i call a custom component to make the inserts of the promoted values.
the problem is am not able to get the properties when it reaches the component.
any pointers???
TIA
Matt Milner

2004-05-13, 7:36 pm

If you are doing what I indicated in the last post, which is waiting for the
stream to be completely read, then I'm not sure what the problem is. Do you
get an error message, or just null/no value for the property? Can you
include the snippet of code that you are using to read the properties from
the message context?

Have you considered doing this work in the orchestration, or using BAM to do
some of this tracking? It might tie in nicely if you are going to be doing
reporting or analysis on it.

Matt


"scot" <anonymous@discussions.microsoft.com> wrote in message
news:E15ACCF4-A90F-4ADC-9A62-F855BA82941B@microsoft.com...
> Hi Mat,
> what am trying to do is to insert some records into a table as i am

receiving documents.
> eg i get a a PO. i have promoted 3 fields from schema. and i use the

receive pipeline to get the flat file. Now the schema specified converts it
to xml and i call a custom component to make the inserts of the promoted
values.
> the problem is am not able to get the properties when it reaches the

component.
> any pointers???
> TIA



scot

2004-05-14, 12:56 pm

Hi Matt,

I am using FixMsg component comes with the SDK samples. As i have told you i need to insert promoted value into the database. By using FixMsg component (FixMsg.cs file and IComponent Region) i am trying to insert the value into DB right in the code given
below i have hardcoded the values but i am interested to insert the promoted values of the schema but i am interested to know how to access promoted values here in the code given below.

#region IComponent

/// <summary>
/// Implements IComponent.Execute method.
/// </summary>
/// <param name="pc">Pipeline context</param>
/// <param name="inmsg">Input message.</param>
/// <returns>Processed input message with appended or prepended data.</returns>
/// <remarks>
/// IComponent.Execute method is used to initiate
/// the processing of the message in pipeline component.
/// </remarks>
public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
IBaseMessagePart bodyPart = inmsg.BodyPart;
if (bodyPart!=null)
{
// byte[] prependByteData = ConvertToBytes("HEMAL");
// byte[] appendByteData = ConvertToBytes("MEHTA");
// Stream strm = new FixMsgStream(bodyPart.GetOriginalDataStream(), prependByteData, appendByteData, resManager);
// bodyPart.Data = strm;

string myConnectionString = resManager.GetString("ConnectionString");
SqlConnection myConnection = new SqlConnection(myConnectionString);
string myInsertQuery = "INSERT INTO WST860Tracking(PONum, TransactionNum, Status, MsgLength, TimeIn) " +
" Values('PONUM', '860', 'NP', " + bodyPart.Data.Length + ", getDate())";
SqlCommand myCommand = new SqlCommand(myInsertQuery);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();

myCommand.Connection.Close();
pc.ResourceTracker.AddResource( bodyPart.GetOriginalDataStream() );
}

return inmsg;
}
#endregion

Thanks for your help waiting for reply.

----- Matt Milner wrote: -----

If you are doing what I indicated in the last post, which is waiting for the
stream to be completely read, then I'm not sure what the problem is. Do you
get an error message, or just null/no value for the property? Can you
include the snippet of code that you are using to read the properties from
the message context?

Have you considered doing this work in the orchestration, or using BAM to do
some of this tracking? It might tie in nicely if you are going to be doing
reporting or analysis on it.

Matt


"scot" <anonymous@discussions.microsoft.com> wrote in message
news:E15ACCF4-A90F-4ADC-9A62-F855BA82941B@microsoft.com...
> Hi Mat,
> what am trying to do is to insert some records into a table as i am

receiving documents.
> eg i get a a PO. i have promoted 3 fields from schema. and i use the

receive pipeline to get the flat file. Now the schema specified converts it
to xml and i call a custom component to make the inserts of the promoted
values.
> the problem is am not able to get the properties when it reaches the

component.
> any pointers???
> TIA




Matt Milner

2004-05-14, 3:37 pm

YOu can do inmsg.Context.Read("namespace", "name") to get the value you
want. However, you probably need to wait for the stream to be read in order
to do this. If you look at hte custom party resolution example in the sdk,
you'll see how they use a custom stream to indicate when the whole stream
has been read, then get the property from the message context. This sounds
like exactly what you want to do.

I'll also reiterate that you may want to look at BAM if you are interested
in tracking this information. It does not require coding a pipeline
component and would let you simply indicate the measures you want from your
message. It also provides nice aggregate functionality for analysis.

Matt


"scot" <anonymous@discussions.microsoft.com> wrote in message
news:0791BB66-DC29-4AA2-A856-362F673DA9F9@microsoft.com...
> Hi Matt,
>
> I am using FixMsg component comes with the SDK samples. As i have told you

i need to insert promoted value into the database. By using FixMsg component
(FixMsg.cs file and IComponent Region) i am trying to insert the value into
DB right in the code given below i have hardcoded the values but i am
interested to insert the promoted values of the schema but i am interested
to know how to access promoted values here in the code given below.
>
> #region IComponent
>
> /// <summary>
> /// Implements IComponent.Execute method.
> /// </summary>
> /// <param name="pc">Pipeline context</param>
> /// <param name="inmsg">Input message.</param>
> /// <returns>Processed input message with appended or prepended

data.</returns>
> /// <remarks>
> /// IComponent.Execute method is used to initiate
> /// the processing of the message in pipeline component.
> /// </remarks>
> public IBaseMessage Execute(IPipelineContext pc, IBaseMessage

inmsg)
> {
> IBaseMessagePart bodyPart = inmsg.BodyPart;
> if (bodyPart!=null)
> {
> // byte[] prependByteData = ConvertToBytes("HEMAL");
> // byte[] appendByteData = ConvertToBytes("MEHTA");
> // Stream strm = new

FixMsgStream(bodyPart.GetOriginalDataStream(), prependByteData,
appendByteData, resManager);
> // bodyPart.Data = strm;
>
> string myConnectionString = resManager.GetString("ConnectionString");
> SqlConnection myConnection = new SqlConnection(myConnectionString);
> string myInsertQuery = "INSERT INTO WST860Tracking(PONum, TransactionNum,

Status, MsgLength, TimeIn) " +
> " Values('PONUM', '860', 'NP', " + bodyPart.Data.Length + ", getDate())";
> SqlCommand myCommand = new SqlCommand(myInsertQuery);
> myCommand.Connection = myConnection;
> myConnection.Open();
> myCommand.ExecuteNonQuery();
>
> myCommand.Connection.Close();
> pc.ResourceTracker.AddResource(

bodyPart.GetOriginalDataStream() );
> }
>
> return inmsg;
> }
> #endregion
>
> Thanks for your help waiting for reply.
>
> ----- Matt Milner wrote: -----
>
> If you are doing what I indicated in the last post, which is waiting

for the
> stream to be completely read, then I'm not sure what the problem is.

Do you
> get an error message, or just null/no value for the property? Can

you
> include the snippet of code that you are using to read the properties

from
> the message context?
>
> Have you considered doing this work in the orchestration, or using

BAM to do
> some of this tracking? It might tie in nicely if you are going to be

doing
> reporting or analysis on it.
>
> Matt
>
>
> "scot" <anonymous@discussions.microsoft.com> wrote in message
> news:E15ACCF4-A90F-4ADC-9A62-F855BA82941B@microsoft.com...
> receiving documents.
the[vbcol=seagreen]
> receive pipeline to get the flat file. Now the schema specified

converts it
> to xml and i call a custom component to make the inserts of the

promoted
> values.
the[vbcol=seagreen]
> component.
>
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com