how to ping an ftp site after fixed time interval

Hello friends , how can i ping an ftp site after fixed time interval and pick up a flat file if a new file has come on that ftp site.

also is there any way i can store that flat file say txt file or xml file in some format within web methods(so that i can further process it ) , if yes then, in what format can i store it ??

thanks in advance

One way we could do is by constantly login to ftp server with pub.client.ftp.login and do a pub.client.ftp.ls to see if the file exists. You can ftp the file to local webMethods server and process it accordingly. WebMethods can handle txt files and xml files…FlatFileSchemaDevGuide.pdf and XMLServicesDevGuide.pdf guides will help

ok ram , thanks for your quick reply, let me check how i can store the files on to local files within webmethods

Rohit,

If you wanna run a job periodically, the webM scheduler would be your best bet. Create a service (service A) that does ftp, and gets the file if one exists, then create a scheduler job that invokes service A at the required periodicity.

As for the second part of your question, I don’t quite understand you. What do you mean by ‘store a file within webMethods’? :-/ You mean you want to store the file on the filesystem of the machine where IS is installed? For that you can create a simple java service to write the file to the file system (I think there is already one available in the WmSamples package). An alternative is to store the contents of the file is to use ‘repository data store’. Use the services in the folder pub.storage to achieve this.

HTH, Rohit

hey taurean, thanks a lot for your reply,i got your point but can u also tell me how to create a webM scheduler, is it also an another service availaible with WM.

and regarding my second question, i have to read an XML file from an ftp site, and further transform that XML file ino some other format and put it in a JMS queue, so how do i do it .

Thanks,
Rohit

WM scheduler invokes “normal” flow service after specified time interval.

Go to wM administrator window, on the top-left side you will find scheduler. click on it
Click on create a scheduled task tocreate scheduled tasks, which will invoke your flow service periodically/at the specified time.

HTH.

Regards.

hey dhimate, thanks for your help
i currently dont have wM administrator window and only have client. However i came across this flow service pub.scheduler.addRepeatingTask, i tried calling my ftp flow Service which basically mget’s some xml files on to local directory but this is not working.

The schedular is not invoking my flow service, forget periodically but not even once , i mean the schedular service executes without any error but without desired result. I then tried running my ftp flow service independently and it works.
So why isnt the schedular flow service calling my ftp flow service even though i give all required inputs

Rohit,

I assume that you are giving correct runAsUser parameter for the scheduler service.
Can you please verify like everytime you are using ftp:login service which is followed by ftp:mget service?

You can ask your administrator to get the error (if any) which is being logged in the error log.

Regards.

i wasnt giving runAsUserParameter till now , but yes gave it now, still not working
and yes everytime i am using ftp:login service followed by ftp:mget

Rohit,
Did you get any information about error log that is being updated?

May be you can try pub.flow:getLastError which may give you some error info, if your service is generating any runtime error.

Your inputs are too insufficient to answer the question quickly.

Regards

hey dhimate, thats fine , appreciate your help
neither is pub.flow.getLastError fetching any result, lets see , will find a way out of it , thanks once again

Rohit,

I would recommend using the the Wm Administrator page to schedule your task… if you don’t have the admin rights, ask someone who does. Its best that way.

The pub.scheduler.addRepeatingTask does not invoke your service when you execute it (pub.scheduler.addRepeatingTask)… it just adds your service to the scheduler at the interval you specified inthe addRepeatingTask. When you execute the service addRepeatingTask, with all appropriate inputs, it will add task in the scheduler and will return to you a ‘task id’. If you are not sure if your task was actually added to the scheduler, use the ‘getTaskInfo’ service (takes ‘task id’ as input) in the scheduler folder, to check.

Btw my name too is Rohit. HTH

Hey Rohit , thats a very important peice of information you have given me , i almost spent 3-4 hours trying to make that run :slight_smile: , thanks for the information

Im glad you got it to work.

Rohit :slight_smile: