Fetching FTP files with the WebSphere JText adapter

Today I have been configuring the WebSphere JText adapter. It is going to be used to suck down XML files from a remote FTP server, and drop them onto MQ queues serviced by WebSphere Message Broker. The BLOB data handler from SupportPac IA9F is also being used.

I’ve had some interesting times trying to get the adapter configured. The requirement is to fetch the files from the remote FTP server, archive them (copy them to one side) remotely, and not keep a local archive copy. After a bit of trial and error, I found the following settings to work:

Attribute Example value Meaning
JText meta-object
EventDir ftp://
andyp:pw@ftphost:
/rmt/xmlfiles
This is the FTP URL the adapter is going to poll for input files. When it sees a file with an extension which matches the EventExt attribute setting (which might be xml in this case), it grabs it.

In the example here, I’ve encoded my username:password before the FTP hostname – you can also specify these in the FTPUserId and FTPPassword attributes.

FTPArchiveDir /rmt/archivefiles This is the directory on the FTP server to which files should be archived. Note that is is not an FTP URL, it is an absolute path from the root of the FTP server.
FTPLocalEventDir /some/local/dir This is the directory local to the adapter to which event files will be downloaded.
FTPRenameExt psd If specified, this will be used as the new file extension on the archived file, i.e. input.xml will become input.xml.psd in the remote archive dir.
ArchiveDir /tmp/archive If specified, and if archiving is enabled at a connector level (see below), files will be archived to this directory with a new file extension matching the one in the SuccessArchiveExt attribute (.success by default).

Important note – this cannot have an FTP URL as a value, even though the documentation currently says that it can…

EndBODelimiter EOF This specifies the delimiter for the Business Object. By setting it to EOF, we are saying that we want the whole file to be a single message.
Connector Configurator
ArchivingEnabled false Setting this to false prevents the adapter from performing local archiving of files. Slightly confusingly, remote archiving will still occur.

If this is set to true, then local archiving will occur, and the value of the ArchiveDir attribute in the JText meta-object will be read and used (an exception is thrown if it is blank). You will potentially end up with 3 copies of the file – one in FTPLocalEventDir, one in ArchiveDir, and one in FTPArchiveDir.

I don’t know if anyone else out there is puzzled by this stuff – if you are, then maybe this guide will be helpful.

References:
JText adapter Infocenter
Adapters compatibility matrix
Using WBI Adapter Framework with WMB v6

Advertisements

2 responses to “Fetching FTP files with the WebSphere JText adapter

  1. Hi.

    I have a question.. i have configured the Jtext Connector to Poll from the FTP, the connector is trying to connect to the FTP. But its returns with a exception.

    read: appPolling (#658969372)] [Type: Warning] [MsgID: 106005] [Mesg: **** WARN
    NG :: Internal error: Exception :: org.apache.commons.net.MalformedServerReplyE
    ception: Could not parse response code.
    erver Reply: Red Hat Linux release 9 (Shrike)
    at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:313)
    at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:391)
    at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:5
    3)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:202)
    at com.crossworlds.connectors.jtext.ftp.FTPWrapper.connectAndLoginIfRequ
    red(FTPWrapper.java:2196)
    at com.crossworlds.connectors.jtext.ftp.FTPWrapper.connectAndLoginWhenPo
    ling(FTPWrapper.java:1458)
    at com.crossworlds.connectors.jtext.ftp.FTPWrapper.remoteGetExt(FTPWrapp
    r.java:691)
    at com.crossworlds.connectors.jtext.Workbin2.FTPCallBack(Workbin2.java:8
    2)
    at com.crossworlds.connectors.jtext.Workbin2.handleFTPPolling(Workbin2.j
    va:354)

    Is this a Jtext specific error or the Linux FTP Specific

    Like

  2. Well I haven’t seen this before, but I haven’t used JText extensively either.

    Can you actually login to the FTP server manually using the credentials that you have configured the adapter to supply?
    It looks like there’s something odd going on with the response from the FTP server. I guess it should be giving you a login prompt, but is giving you a server header instead.

    Red Hat 9 is fairly old. There’s a possibility that this could be specific to the way that the FTP server works. Which FTP server is it?

    If that doesn’t point you in the right direction, by all means open a support request, or perhaps wander over to the forums at http://www.mqseries.net where other users might have seen the same problem.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s