locked
How to move files with BizTalk? RRS feed

  • Question

  • I have a BizTalk orchestration which consumes a web service. The web service, provides a message with 2 file paths: SourceFilePath and DestinationFilePath. After the web service is invoked, I have to move the file located at SourceFilePath to DestinationPath. I tryed to do this using an Expression shape, with the following expression : System.Io.File.Move( SourceFilePath,  DestinationPath) but no result and no error in event viewer also. please suggest a better approach to do this.
    Friday, June 26, 2009 9:05 AM

Answers

  • In this scenario I would read the file from the source file location and load into XMLDocument. Use Dynamic File Send Port and assign Address= Destination File Location. Send this XMLDocument to the dynamic Send Port.

    But in this case you will not be able to delete the file from source location.
    Ajeet Kumar
    Friday, June 26, 2009 3:28 PM
  • Alex,

    I could successfully move files using the command System.Io.File.Move( SourceFilePath,  DestinationPath)  in the Expression shape, but with hard coded values for SourceFilePath and DestinationPath. This should not be any different for values returned from the web service as long the file path values are correct. I would suggest to write SourceFilePath,  DestinationPath values in to event log just before calling the Move method or write a .NET helper class and pass source & destination paths and invoke it from Expression shape, then you can add break point and verify the values for correctness.

    Edit #1: Also I would suggest to replace Biztalk orchestration with some .NET app, if this is the only functionality you have in the orchestration.

    HTH,
    Rajesh

    Sr Consultant
    Friday, June 26, 2009 4:03 PM

All replies

  • Have you checked the response from web service i.e. its having the complete file name and also file is present in the location.
    Also i would suggest to use System.IO.File.Exists before moving the file.

    Also is the Source File location will be fixed or it can change? If it is fixed then you can have receive location polling the file location and send the file dynamically to destination location.


    Ajeet Kumar
    Friday, June 26, 2009 9:37 AM
  • The response of the web service contains the file path, and the file exists at the source location.

    I've already created send and receive ports/locations to move the files, but in my case, both the source and the destination locations are not fixed so that approach is not suitable.
    Friday, June 26, 2009 11:11 AM
  • In this scenario I would read the file from the source file location and load into XMLDocument. Use Dynamic File Send Port and assign Address= Destination File Location. Send this XMLDocument to the dynamic Send Port.

    But in this case you will not be able to delete the file from source location.
    Ajeet Kumar
    Friday, June 26, 2009 3:28 PM
  • Alex,

    I could successfully move files using the command System.Io.File.Move( SourceFilePath,  DestinationPath)  in the Expression shape, but with hard coded values for SourceFilePath and DestinationPath. This should not be any different for values returned from the web service as long the file path values are correct. I would suggest to write SourceFilePath,  DestinationPath values in to event log just before calling the Move method or write a .NET helper class and pass source & destination paths and invoke it from Expression shape, then you can add break point and verify the values for correctness.

    Edit #1: Also I would suggest to replace Biztalk orchestration with some .NET app, if this is the only functionality you have in the orchestration.

    HTH,
    Rajesh

    Sr Consultant
    Friday, June 26, 2009 4:03 PM
  • to debugging thread: use simple System.Diagnostics.Trace.Writeline() to output the debugg info. And use DebugView to catch this debug output.
    Leonid Ganeline [BizTalk MVP] http://geekswithblogs.net/leonidganeline
    Tuesday, June 30, 2009 3:23 AM
    Moderator