Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Sending Message Context properties to SQL Server DB
- This topic has 1 reply, 1 voice, and was last updated 9 years, 2 months ago by
community-content.
-
AuthorPosts
-
-
December 27, 2007 at 6:00 AM #18685
I am trying to grab a received file’s name and send it to a SQL
database via orchestration and a SQL send port. However, I am quite new
to orchestration and am quite sure I am not doing it right and haven’t
had any success in numerous attempts.Here is what I am doing:
I receive a flat file via FILE protocol, send it through a pipeline to
disassemble it into XML. I am creating a message (call it
IncomingMessage) based off the .xsd schema the flat file disassembles
into (call it schema1 for arguments sake). I set IncomingMessage’s
Message Type to schema1. I have a receive port shape and a receive
shape set to the same Message Type. I am then sending that message
through a construct message shape which constructs a message of type
schema1 called FileName (I am not sure if this is the message type I
should be using because it is the message I am trying to send to the
SQL send port to invoke my stored procedure, should I be setting this
to a System.String instead? The Stored Procedure takes this value (as a
varchar) and then inserts it along with a date and who did the insert
into the database).The next step is sending it through a MessageAssignment shape with this
expression: FileName = IncomingMessage(FILE.ReceivedFileName). I then
send this through a send shape to a static 2 way send port (Do I need
this? I assume I do because of the nature of the generated SQL schema
from the stored procedure) which sends off the message to the stored
procedure and gets back a success response (hopefully) which gets sent
to another receive shape and ends the Orchestration.I know that my SQL send port is set up right, using the correct Stored
Procedure and namespaces and has the correct credentials. But this
doesn’t insert anything into the database.For clarification the Stored Procedure simply takes the file name as an
input parameter and inserts it along with the system date and the name
of the person or thing (in this case the stored procedure itself) that
did the insert into the database for logging purposes.I really don’t know what I am doing wrong here.
-
January 7, 2008 at 7:47 PM #18735
Hello.
I’m not really sure about the message type of your sent message going to SQL. Did you use the Add Generated Item to generate the schema? Are you getting any errors? You do need the request-response send port in order to get a response back from the SQL Adapter.
Another way to do this is to simply use a helper .net component to take the property and make a direct database call (using something like Enterprise Library for data access). This would be a better preferment solution (since you by pass the message box) and would be my approach for this type of task.
Hope this helps.
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.