Processing Empty Files in BizTalk 2010 - biztalk

I have a receive location in my BizTalk 2010 project, and sometimes that receive location will receive an empty file. The receive pipeline is PassThruReceive. We then have a Send Port that has a filter for that Receive Port Name. So all we are doing is moving the file from the receive location to the send location.
The issue that I'm running into is that in the event that we get an empty file in the receive location, my client wants the file to still be moved to the send port. I know that out of the box, the FILE adapter discards empty files and writes an event to the Event Log stating that it was deleted.
I have followed articles that show a custom FILE adapter accomplishing this task. I have had some success with this custom adapter. The file is picked up. Received by BizTalk and the Send Port successfully sends the file. However, even with this solution, I'm running into an issue in the receive side where the file is locked and cannot be deleted. I have followed various articles on this subject, and I get the same issue every time where the file is locked and can not be deleted.
My question is. Even though batchMessage.Message.BodyPart.Data.Close(); is being called, the stream is still locked. Is there any way for me to find where else BizTalk may be locking the file? Is there any other way of handling this?
One of the articles that I followed is located here: http://biztalkwithshashikant.blogspot.com/2011/04/processing-empty-files-in-biztalk.html

It seems to me that you are running into issues when running your custom FILE adapter multi-server. I bet you are running more than 1 server in the BizTalk Group?
I haven't done this myself, but I heard that getting an adapter to run smoothly multi-server is one of the hardest things to do in BizTalk. The trick is to find a way to be able to share the load between multiple instances of the same BizTalk host.
Do you still have the same problem when running the instance only on 1 server instead of 2?

in the custom pipeline component code method:
IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
You should return pInMsg, not set to null, and the .BodyPart stream positioned at the end. If pInMsg is null BizTalk will discard the message silently. You don't need to close it but you do need to move it to the end to let BizTalk know you read and processed it all.

A way around this is to use the FTP adapter instead to pick up the files, the FTP adapter does not discard empty files.
It is quite possible that to system creating the files, it is still a file location, but also accessible via FTP.

Related

BizTalk 2013 Save a copy of received EDI file

I am trying to save copies of the EDI files I am receiving from an ftp server. I have tried using a send port to a file, but the parties will not resolve and it is using Fallback settings so I cannot set up proper validation, specifically allow leading and trailing zeros. Is there a better way to save a copy of the received EDI file.
Adding a Archiving Custom Pipeline component to the Receive Pipeline works for most scenarios.
The solution of Dijkgraaf (archiving pipeline component) makes a lot of sense, but just to provide you with other options:
The EDI files come in from somewhere. If this is a FILE or an FTP server for example, you could consider to script the archival of the file, by scripting the file move from the incoming folder to a folder where BizTalk is listening to. At that point it is very easy to make an extra copy of the original file before BizTalk is actually even seeing this. This can be done by a Scheduled Task or by BizTalk itself (PassThru pipelines).
Typically, it's not a bad design to separate your incoming folder from the folder where BizTalk will pick it up. This mostly depends on your own preferences. Do consider however that your BizTalk Server is often monitored and logged and your external scripts/scheduled tasks are not.
In that case I always tend to choose for the BizTalk 'PassThru' solution, since if this fails, you will be notified via the event log.
Before doing any custom work, take some to see if any of the built it BizTalk features can satisfy your requirement. There are two features specifically that address your situation:
EDI and AS2 Status Reporting - Stores incoming and outgoing EDI transactions and interchanges with their delivery status (997). The UI is built into BizTalk Administrator. Details here: EDI and AS2 Status Reporting
BizTalk Tracking: Can store any incoming or outgoing message. The search and retrieve UI is also part of BizTalk Administrator. Sample of how to use Tracking to archive messages: BizTalk Archiving, The BizTalk Way
Finally, you can consider a fully out-of-band solution by saving copies of the files before they even get to your BizTalk app.

BizTalk file Archive

I have an business requirement where each input file received on FTPS adapter at input location in BizTalk want to send back to client in original format at Archive location (FTPS).
Each input port have inbound map so original message converted and submitted to message box and when I read message on send port its already converted.
How do I get original message and send back to client.
Here as some options to look at
By using a File Archiving Pipeline component as the first thing in the pipeline and writing it to a folder and then having BizTalk pick it up from there using a pass-thru to send it on again.
Have a send port that also subscribed to the converted message that maps it back to the original message and sends it back. This will only be possible if you the original mapping is loss-less (don't lose any information).
Some of the FTP type adapters have the option to move the file after it is transferred rather than just deleting it, if it has use that.

Outbound Map not being used

I have a receive port. It calls a stored procedure for transport, then the receive pipeline is just passthrureceive (I tried XMLReceive, but that caused many more issues). I have a send port that has the filter set so it picks up the type of the receive port. The send port has a map and send pipeline. The map maps the xml from the receive port to a flat file schema, and then sends it to it's location. THe send pipeline has a flat file assembler.
So the map never runs. I just get errors from the send pipeline saying it can't match the document. No it can't, because it wasn't mapped. I read that you need an XML Disassembler on the recieve pipeline of the receive location. I added that, and that just started destroying my messages. They just get turned into a blank message or just a " in the message. So the XML disassembler is clearly not working right. I'm not sure what to do at this point.
OK, I figured it out. I have to use the XML disassembler to make the map run. The reason it was erasing my messages is, well I don't know the reason, but when I set the schema to "elementFormDefault = Qualified", it worked. I'm not really sure what that did, as I really don't have a good understanding of the whole qualified message thing, but that was the problem for me.
There is a wizard in Visual Studio to help you create the schemas and bindings that you use to communicate with stored procedures. I guess you didn't use that? (Right click on the project, hit "Add", then "Add Generated Items", then "Consume Adapter Service")
I'm calling my stored procedure from an orchestration hooked to two way send/receive port. I'm using a custom WCF type port with XMLTransmit and XMLReceive for the pipelines. This seems to work fine. The caveat being it's always a bit fiddly getting WCF to work since there are so many options.
In order to map from one format to another on ports, you need to have MessageType promoted. In your case it can be accomplished by using XMLReceive on the receive pipeline.

Best way for making a singleton socket for web application in .net?

I am having a lot of problems with the behaivour of the socket (not closing or opening correctly) used in a webapp to communicate with another program running on a server. The problems I hava found is that the socket either ends up being opened or closed various times during the same request or it does not ends even when I kill the active session.
Currently I save the socket in a Session Variable and I check whenever it should be created or if the value of the variable should be referenced, although I am still having a lot of problems.
Have you faced something similar and would you share some of your experience with me?
Also at first I tried to make it Static although I had even more problems with it.
Thank you.
You put your active open sockets in cache or application object in dictionary or whatever suits you provided by asp.net. Before opening new port you check if it is already open by looking in dictionary stored in application or cache. Remove the entry from dictionary when conection is lost.

Channel.Ping.Failed error Detected duplicate HTTP-based FlexSessions What's the root cause?

Hi
I've downloaded the Cairngorm3 Simple Sample Application from here.
There's a few steps.
a) Download the server-side zip. It contains a PDF instructing how to start a HSQLDB database and get a Tomcat instance up an running (I used catalina.sh start).
b) Check out the source with Subversion, and load it up into Flashbuilder 4. (You need Flex 3.4 SDK)
When I run the app (an Outlook like app written in Flex), I have issues at the point I try and save a contact. I'm assuming it's on a remoteobject call.
But it I get this:
Send failed
faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Ping.Failed error Detected duplicate HTTP-based FlexSessions, generally due to the remote host disabling session cookies. Session cookies must be enabled to manage the client connection correctly. url: 'http://localhost:8400/messagebroker/amf;jsessionid=5765DDDB6E2D54BD03D3E636B0E8C03E'''
I'm wondering if this is something you need to tweak in services-config.xml?
Located in flex-frameworks/tomcat/webapps/ROOT/WEB-INF/flex folder (flex-frameworks comes from the server-side zip download:
Anyone got any ideas?
This is Christophe Coenraets baby.
I also subsequently found a blog post by Alexander Glosband, but couldn't ascertain from it, what you need to do as a work around. i.e. Is this something that is configurable?
The way to reproduce the error consistently is to try and activate the web camera from the app. Then instead of clicking accept, reload the screen. Then when you try and take a photo after subsequently granting access to camera, you get the duplicate session error.
I think there is an issue with the code pertaining to the Camera, that's not cleaning up after itself correctly, the session is probably not being tidied up correctly.
You are right, problem comes from services-config.xml. Change your url from
http://localhost:8400/messagebroker/amf
to
/messagebroker/amf
I found solution from here send failed error
"Compiler EMBEDS channels, endpoints and destinations into SWF" video tells.

Resources