how to transfer files across network using service mix blueprint capabilities - apache-karaf

I am using apache-servicemix-4.3.1-fuse-01-15 and I am doing hot deployment.
I have placed one blueprint xml inside deploy folder of service-mix as shown below
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="file://D:/apache-servicemix-4.3.1-fuse-01-15/apache-servicemix-4.3.1-fuse-01-15/source/?recursive=true" /><!--sample path of source folder-->
<to uri="file:////192.168.68.215/Fuse"/><!--sample path of destination folder-->
</route>
</camelContext>
</blueprint>
As you can see I want to transfer files to another computer from my local pc.But in the log it is giving following error, though I have acess to the path mentioned in to.
Caused by: java.io.FileNotFoundException: \\192.168.68.215\Fuse\core_logs-12012012\core-logs_20110908 - Copy - Copy (4)\core-logs_20110908.log (The system cannot find the path specified)
If I replace the IP with my local directory path, it is working fine.
I am curious to know what went wrong here.
Shall I use ftp,sftps or ftp. Is it the case that what I am doing will never work.Do I need to mentioned username and password.

If you want to transfer files between computers, you would need to use a protocol that supports that such as:
file
ftp
scp
As you use windows, you can use the file system by setting up a network shared connection from your computer to the remote computer. eg mount the remote computer as if it was a local drive (eg H: or any free letter). Eg basically if you can get it working so you can see the remote computer using the Windows File Explorer. Hint: The file component in Camel uses Java's java.io.File API. So whatever you can get working with that, is supported then.
FTP would require the other computer to have a FTP server.
SCP is often not supported on Windows, and you would need to install software to support that.

i am not sure if camel file component which is using java's file api can do this out of the box . But if you are hell bent on using a camel route for doing this , you can write a custom bean in the part which takes in the file/filepath and copies it to the remote machine via sftp or scp as claus mentioned
if it is a linux machine you can easily do sftp/scp via jsch , check the examples
if its a window machine you can setup a ftp server and use apache commons VFS

Related

A directory path result in FILE_IS_NOT_DIRECTORY error

I get below error when using file connector to write a file to a working directory (Windows host).
The File connector version is v1.3.4 and mulesoft runtime is 4.3.0
ERROR 2021-07-05 02:13:56,335 [[MuleRuntime].uber.125059: [my-process].inventory-snapshot-file-observer.CPU_LITE #1ee1dd59] [event: 238918e0-dd58-11eb-9534-0050569e1eb4] org.mule.runtime.core.internal.processor.LoggerMessageProcessor:
Error type: FILE:CONNECTIVITY
Error.description: ->Provided workingDir '\\HOST\SCDR-QA$\In' is not a directory<-
However, when I copy the workingDir above and paste into Windows, it can be opened without any issue.
Please share any idea if any, thank you.
The error is correct. '\\HOST\SCDR-QA$\In' is not a directory means that \\host\... is not a path mounted in the local host. It is a format called UNC which is used by Windows to access files remotely via a network protocol, usually the SMB protocol. The File connector can only open files in the same server or host, not over network protocols:
Anypoint Connector for File (File Connector) handles files and folders
on a locally mounted file system.
You can mount the remote path locally using Windows commands so applications can access the remote files with local file operations. You can also try to find an alternative connector for the SMB protocol. There is no official one from MuleSoft. Another alternative could be to develop your own SMB connector, though it probably would take a significant effort.

Deploying not happening in publishing process

I am trying to publish to local file system, however publishing is not happening properly and its failed to deploy in my 2011 GA VM environment.
I am getting "Polling for notification for destination: YTnMgU6u5Vh09cOGUG7ouA== has exceeded polling attempts for transaction: tcm:0-121257-66560" error in "Preparing Deployment" stage.
I have used the “Local File System” protocol in my publication target and I have provided path like d:\tridion\publish.
And I have provided the same path in cd_storage_conf.xml under the <storage type=”filesystem”>. All other storage types are commented.
And in cd_deployer_conf.xml , quee location path is c:\tridion\incoming.
When I publish any page into my publication target, the zipped package is placed in the d:\tridion\publish and it’s not deployed.
Do I need to do any other thing to deploy the zipped package?
The path provided in the cd_deployer_conf.xml (the one you specify in Queue/Location!!!) needs to be the same one you provide in your publication target (in your case you have in the publicationTarget some path on D drive while in the deployer conf you have another one from C drive). Then you also need make sure that your deployer is initialized. You can easily determine if your deployer is initialized by looking if the meta.xml is regenerated in the deployer incoming folder.
Not sure if this is relavant but you might be interested also in how to install the deployer: as a .NET WebSite, as a Java WebSite or Windows Service
Hope this helps.
You say your working sites use HTTP sender/deployer. In that scenario your deployer is triggered by the HTTP servlet which receives the transport package.
When you use local file system - you MUST configure your deployer to work in a different way. It has to run as some form of background service. Typically on a windows box this means installing the deployer as a windows service. Keep in mind that this will then probably have additional config files for the deployer and broker/storage.

Why file path is invalid in a MQ configurable service?

I have a configurable service (CDServer). When I try to deploy my WMB flow that uses a CDInput Node, which is using the configurable service I got the following error:
BIP7962E: File path '\\192.168.45.91\myfolder' specified for the property 'brokerPathToInputDir' in the CDServer configurable service is not valid.
The file path is accesible from my Windows Explorer. The folder "myfolder" is shared on the remote computer.
I don't know where could be the error. I've tried chanching the file path to a different format (192.168.45.91\myfolder), but still doesn´t work.
I'm using:
WMB 8.0.0.1
MQ 7
Sterling Connect Direct 4.6
Any help on this issue is very appreciated.
I'm up against the same problem. While I continue to hope for a solution that works like yours, my manager told me yesterday he had wrestled with the problem a year ago, and the only solution he found was to put an SFTP server in the middle. For his message flow, he used Attachmate Reflection.
The FileInput node has hooks for remote access. On the FTP tab, click Remote Transfer and fill in the Attachmate server and port, and other settings. Attachmate in turn is configured with a virtual folder, which accesses the actual remote server.
It seems like more machinery than is necessary, but you can't argue with the fact that it works and has been in production for over a year.

How can I have a file appearing on a WebDav server trigger a BizTalk event?

I have a legacy system which can create files visible in WebDav as an output. I'd like to trigger a BizTalk orchestration receive port when a file matching a filter appears - so a lot like the standard File adapter, but for WebDav.
I found the BizTalk Scheduled Task Adapter, which can pull in a file by HTTP, but it looks abandoned, poorly documented, and out of date.
So, how is it done? Can I use the standard HTTP adapter perhaps?
If you're able access the WebDAV via a UNC path from the BizTalk server the File Adapter should do the trick.
Have you tried to assign a drive letter to the WebDav folder?
http://en.wikipedia.org/wiki/WebDAV
We've had to go with a workaround on this where we made a completely unrelated separate process to make a copy of the file from the legacy system appear in a Samba share, which we in turn attach to with an ordinary FILE adapter.

Remote File Read

How can I read a text file resides in a remote machine? There is no share exists in that machine and I am not allowed to create any share or file in the remote machine. Also I am not allowed to run any client program in the remote machine. My program is a ASP.net in C# residing in a IIS webserver. For linux machine we used ssh connections and file reads are easy. Is there something by default available in windows similiar to it ?
Thanks,
Sreejith
The first question to ask is if there's a good business reason to read that file. If yes, the IT people will have to allow you a reasonable solution to the problem.
I have frequently used SFTP (secure FTP) for this kind of problem. Unfortunately SFTP is not part of Windows, but there are free and low-cost SFTP servers available. Here's a list from Wikipedia
Explain to IT why you need access to that file and discuss options including SFTP. If you have a valid business reason for this and they will "not let you because of policy", it's the job of your project manager or boss to clear out that roadblock. Ask them to help.
Finally, consider whether it's practical for the file on the remote machine to be pushed to you instead of you pulling it. If you can setup a file share on your PC, ask them to setup a job on the remote server that copies the file to your file share every time it is changed.
You could try accessing the Admin share of the machine. Windows by default created a share for all disks (named C$, D$ etc). But in that case the application you write should be running with the credentials of a user with rights to that share ((local) administrators have sufficient rights to do that).
If that doesn't work you need to create a share or install software to get files from that machine (like FTP). This is all because of security, it's a good thing you are not able to just read a file from any machine...
I have done this many time with the Remote File port 34
http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

Resources