Storing or looking up ISA numbers with BizTalk EDI - biztalk

My company uses BizTalk for our EDI and AS2 communications. One periodic issue is that a VAN or similar partner we transmit with will want to know whether we received a file by it's ISA #. We currently do use the ISA # for routing within our ports, but I can't seem to find anywhere that this information is stored in BizTalk. Is there a way to look up an EDI message that BizTalk recieved by ISA#? Or perhaps someway I could get a hold of it and store it on my own?

If you're not explicitly using Business Activity Monitoring (BAM) to track this, you may be able to use message tracking.
If you have:
message tracking turned on for the message properties at a point in processing the messages when the ISA number is used, and
if the ISA number is promoted in a published schema (which I'm guessing it is, if you're using the out-of-the-box EDI stuff)
...then you could use the admin console to look for tracked messages with that schema and based on the particular field in the schema (e.g., EDI.ISA08 or EDI.ISA06). Of course, if you are mapping the ISA# to a particular party through your BizTalk configuration, then you would just need to search for Tracked Message Events where the Party Name equals the name you configured for that ISA#.
There is also built-in EDI tracking (see http://msdn.microsoft.com/en-us/library/bb226464(v=bts.10).aspx), with its own reports, but I'm not familiar with it enough to say whether or not it'll give you exactly what you need.
Otherwise, you will want to look at setting up BAM to save the ISA info that you need.

These fields are available inside the Biztalk message if you do EDI receive.
msgIn(EDI.ISASegment) contains all ISA segments. Then you can do substring on control numbers and then put it in your outgoing filename:
ctrlnum (variable) = msgIn(EDI.ISA13)
newfilename = FILE.ReceivedFileName + ctrlnum ;
This way each control number will show up in your filename and you don't even need to open the file or check tracked messages.

Related

Transaction Scope in Pub/Sub + Message Label in Rebus

Currently I'm using WCF as service bus. But I want to switch to a more powerful service bus. I Chose Rebus.
I'm somehow new to Rebus. I have some problems :
1) My data is persisted in a DB table. I want publisher to read all persisted data every n seconds and publishes it to subscribers and then set a sent flag to data in DB.
Is there some timing for publishing?
Reading and publishing and changing (setting flag) data must be done in a transaction scope. Is there any defined solution in Rebus?
2) In Consumer, I want to save published data in some table. Reading message from message queue and saving in DB (in my handler) must be done in transaction scope. How Rebus do this?
3) Message label for published messages set to a random unique string. I want to set my custom label for created MSMQ message. is there any solution?
1) You are on your own when it comes to querying database tables at regular intervals – there's no built-in mechanism in Rebus that does this.
I can recommend you take a look at System.Timers.Timer or something similar.
2) You can enable automatic transaction scopes in your Rebus handlers by using the Rebus.TransactionScopes package.
3) Out of the box, it is not possible to specify the label to be used on the MSMQ message. It will be set by Rebus to a string consisting of the message type and ID as indicated by this extension method.

BizTalk 2013 - execute stored procedure on send port without orchestration?

A while back I set up BizTalk to pick up a file via FTP and drop it into a network directory. It's all passsthru so I didn't use an orchestration.
Now I've been asked to execute a stored procedure once the file is picked up. The procedure contains no parameters and I do not need the contents of the file.
It seems like such a simple request but I can't figure it out. Is there any way to do this without over complicating things?
This can be accomplished through the use of either the WCF-SQL adapter or the WCF_Custom adapter with a SQL binding. You can do this using messaging only with just a SendPort with a filter/map on it thus no orchestration needed.
For the SOAP action header use TypedProcedure/dbo/name_of_your_stored_procedure and in the messages tab you can specify the paramters to the stored procuders as well as add a payload in the following manner:
<name_of_your_stored_procedure xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo">
<parameter1>XXXX</parameter1>
<xml_parameter>
<bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="string"/>
</xml_parameter>
</name_of_your_stored_procedure>
In the above case xml_parameter will have the contents of the message payload passed to it.
The stored procedure should look something like :
CREATE PROCEDURE [dbo].[name_of_your_stored_procedure]
#parameter1 int,
#xml_parameter nvarchar(max)
AS
BEGIN
-- your code goes here
END
More details can be found here
Regards Hasse
This MSDN page describes the process and has this to say: "You must create a BizTalk orchestration to use BizTalk Server for performing an operation on SQL Server."
However if you're really desperate not to use an orchestration I believe you have the option of setting the operation context property in a custom pipeline component. Then you can initialise the message in a map on a port. In theory this should work but I can't guarantee it.

Biztalk EDI - View final outbound X12 interchange

I've been running Biztalk 2004 with the Covast EDI accelerator since 2004. I'm currently upgrading to Biztalk 2013 R2 and having difficulty viewing the final outbound interchange document for an X12 document. My final destination is an AS2EDISend port.
I can see the interchange information (sender/receiver/control ID) in the report "EDI Interchange and Correlated ACK status". I can see more information by viewing the "Interchange Status and ack Details" screen. I can view the transaction set. I can view the transaction set details and from there get the final transaction set (ST to SE segment) in raw ASCII format.
But I can't see the raw final outbound interchange complete with the ISA/GS segments.
I do have tracking turned on and when I look at the tracked message events, I can see receive/send events for the AS2EDI pipeline. When I look at the message on the receive event, it's the XML representation of the transaction set. When I look at the message on the send event, it's already been AS2 encoded and I'm unable to view the raw ASCII EDI file complete with ISA/GS segments.
Am I missing something? Is there somewhere else to look? Will I have to configure a secondary send port which only does EDISend and write to my filesystem and maintain/archive that information myself?
The ISA and GS segments will be promoted into the context of the message, as ISA_String and GS_String respectively. The individual segment values are also promoted as ISA01, ISA02, etc. and GS01, GS02, etc.
Since you're using AS2, I think the easiest solution would be to create a send port group, use your existing send port with AS2 in it, and another SendPort with EdiSend using the FILE adapter. Another option would be to add a custom pipeline component in the Encode stage that would archive the results from the EDI Assembler - which would be more efficient but more work as well.
if you simply want to see the interchange message for testing/develop propose, Put the send port to stop state, the message in this port will suspend. then you can view/save the message in admin console.
if you need a solution to "see" the interchange message in operation level. a second send port is an option.

Subscribe to all messages in BizTalk for logging

I want to create a send port that writes all messages going in and out of BizTalk to file.
My organization is using Splunk. Splunk will import data from the file directory to make sense of the various messages.
Is it possible to create filter in a send port that subscribes to "everything"? I could solve this by applying filter for each message type in my system. However, there is a lot of messages going back and forth and I'm wondering if there a simpler solution?
I'm using BizTalk 2013.
Yes, just filter on message type like you said, but rather than selecting = and specifying the message type, just select Exists. That will then match any message that has a message type.
EDIT:
As Johns-305 has pointed out if you have any messages that don't have a message type (e.g. pass through receive locations) you may want to pick BTS.MessageID as that will always exist for a message in the message box.

Pool Multiple Messages with BizTalk 2006 SQL Adapter

I have a StoredProcedure that returns a simple table containing several records:
DECLARE #STEPS_TABLE AS TABLE (OrchestrationID uniqueidentifier, [Message] nvarchar(1000));
-- LOADING THE VALUES HERE
SELECT * FROM #STEPS_TABLE As Step FOR XML AUTO, XMLDATA, ELEMENTS
I used the SQL Transport Schema Generation Wizard to create my schema and could configure the port correctly. If I use this schema on my orchestration, it works perfectly. BizTalk starts one instance of the orchestration everytime the #STEPS_TABLE has more than 1 record.
Reading Microsoft technical documentation, they recommend to get several messages in one call and then use the XML pipeline to disassemble the multi-row BizTalk message into a single-row BizTalk message.
I haven't used the XML pipeline before, so I tried the provided steps but couldn't get it to work.
Could somebody provide me a link to a "how to" (didn't find anything until now, after several hours of searching) or give me some hints to succeed.
Thanks in advance.
... some hours later I could figure it out myself. So if anybody comes across the same issue as me, here you have some guidelines to make it work on your environment.
At the end I followed a different walkthrough from Microsoft and avoided the pipeline recommendation altogether. The documentation I found is called "Disassembling Result Sets Using the SQL Adapter" and does exactly what i was looking for. You can just follow the whole walkthrough from Microsoft but avoid the creation of the send port and make some little adjustment on the receive port.
After following the technical document you will end up with two schemas, I will call them message and envelope (contains several messages) for the sake of this excercise. In your orchestration you can create a receiving port that maps to the message and then when you configure it as a SQL Port and you link it to your stored procedure (or select statement), you only have to change the Document Root Element Name to the envelope root name; the XML Receive pipeline (provided by default in BizTalk 2006) will do the magic of disassembling the messages contained in the envelope and instantiating an orchestration for each message.
The Microsoft "Disassembling Result Sets Using the SQL Adapter" walkthrough can be found under:
http://msdn.microsoft.com/en-us/library/aa562098(v=bts.20).aspx
Mission accomplished :)

Resources