File Polling issue

I was able to setup a service to read a Flat File using pub.file:getFile and pub.flatFile:convertToValues services.
Then I set up a new port to perform file polling every 15 seconds, and it process the input file and puts it in the error folder.

How can I modify my service to start reading the file from the polling input directory, instead of the hardcoded (string entries)?

What are the sequence of service that I need to call?

Have anyone done this before? If so, can you post your steps?

thanks,
Vendy

Hi Vendy,
To start reading the file from the polling input directory instead of hard coding, you should have an input variable to the pub.flatFile:covertToValues service as an object (say ffdata).When the file polling takes place the contents of the file are read and stored in the ffdata object variable as a stream.That ffdata object should be mapped to ffData of the pub.flatFile:covertToValues service with the appropriate template set to ffSchema service-in variable of convertToValues service.

If you are not dealing with any of the EDI formats or not dealing with any of the flatfiles with templates, and if you just want to read the contents of the file using the file polling then you should have an input variable ffdata as object to pub.io.streamToBytes service which converts the stream into bytes and then use pub.string.bytesToString service to convert it to string .

Make sure you disable all the steps that use hardcoded values to read the file.

Thanks
sivaram

Hi Sivaram,
Thanks for your reply. Since I am not dealing with EDI, I tried your second method using pub.io.streamToBytes which take ffdata (Object type) as my input variable and followed by pub.string.bytesToString.

When I drop a test file to the monitored folder, it picks up the file, and immediately throws it to the Error directory.

At this point, I did not even setup any process on the file.
Not sure whether the polling is the problem…

How can I test whether the service actually got invoked and if the ffdata is ever got filled with the test file?

Vendy

Hi Vendy,
I guess you had not given the access mode permission to your file polling service. To set the access mode permission,click on the Edit link on your file polling port.Then click on Add Folders and Services to Allow List link and add the name of the service (along with the namespace of the service)…For instance, if your FilePollingSvc service resides in Default package under folder test1 then the namespace of the service is test1:FilePollingSvc.Then click on Save Changes.

Thanks
Sivaram

Hi Sivaram,
Unfortunately, I set up the Access Mode permission already. I tried to delete and resetup again, and it still kicking out the file to the Error folder.

Is there a way for me to test whether the service actually got invoked and if the ffdata is ever got filled with the test file?

Hi Vendy,
I have the following parameters set up for the file polling port.

Package Name WmPublic
Monitoring Directory C:\data\test
Content Type (optional) application/x-wmflatfile
Allow Recursive Polling No
Run services as user Administrator
Processing Service test1:FilePollingSvc
File Polling Interval (seconds) 15
Maximum Number of Invocation Threads 1

And all other parameters are left at their defaults.

Note: If you are using pub.flatFile:convertToValues or pub.flatFile:convertToString then you have to use the package name as
WmFlatFile while configuring the port for file polling.

Hope you have a variable ffdata (Object type) defined in the Input/Output tab of the service.

Thanks
Sivaram

Hi Sivaram,
Thanks for the detailed information.
I finally get it working. I have been building the Processing Service in a custom Package. I ended up moving the Processing Service under the WmPublic package to get it working.
Is there any way I can keep my Processing Service under a separate Package besides the WmPublic?

thanks,
Vendy

Hi Vendy,
Its not required to move the Processing Service under the WmPublic Package. You can have the Processing service under your own custom package. The reason you need to set the Package name as WmPublic while configuring the file polling port is because you are using the services of the WmPublic package (pub.io.streamToBytes and pub.string.bytesToString services).

If you have used the services of the WmFlatFile package (pub.flatFile:covertToValues or pub.flatFile:covertToString) you should set the package name to WmFlatFile.

Thanks
sivaram

Hi Sivaram,
It is very interesting.
Originally I have my service that uses the pub.io.streamToBytes under a custom package. The Polling picks the file, but spits it out to the Error directory immediately. However, when I move my service unser the WmPublic, it works…

thanks,
Vendy

Hi fellows,
I was checking the file pooling issues and come up with two questions.
I have set up a file pooling port that runs every 15 seconds: if the file “test.txt” (Flat File) exists, it invokes a flow that reads data from the file. The name of the file is hard coded to the flow, so I’m considering using the ffdata input and pub.io.streamToBytes to get the file data.
My two questions are:
First: is there another input variable to get just the file name, instead of its contents? (get the file name that triggered the pooling)
Second, when I put the file on its directory, the IS does the pooling correctly and invokes the flow, but removes the file from the monitored directory (IntegrationServer/Files) before the flow starts! I tried changing my flow to read the file from the IntegrationServer/work directory instead of the monitored one, but still it won’t find the file. Pls help!

Thanks,
Daniel

Hi,
I have the same issue as described by Daniel.In our application we use a xml file instead of a flat file.The moment we place the file in the monitoring directory,it removes the file,when we enable file polling.The target service is being invoked,but does nothing.I have included a debug step in my flow…to see the service is being invoked or not.Interesting part is the service is indeed invoked and it does nothing after that.There are no errors in the error log too.When I run the service manually,it gets the file from the monitoring directory and does process the xml file.When there is no file in the monitoring directory it throws an error,if I execute the target service manually.

TIA

Krishnaa,

what is the content type that you have set for the file polling port and what is the name of the input variable in your service?

The moment you place a file in the Monitor directory and when the IS polls, it moves the file from Monitor to Working directory and starts working there. Once the execution is successful, it moves the file from Working to Completion directory. If it fails, it moves the file to Error directory.

As you are working with xml files, try setting Content Type as ‘text/xml’ and input variable as xmldata.

Thanks,
SATYA.

Satya,
Thnx for the response.I did not specify the working directory and the completion directory and the error directory.I left them to defaults.Interesting part is I have lost the package on which am working on,which invokes the processing service of file polling.I can see it physically on the packages directory and not on the admin console nor the developer.I have created one more package and configured the file polling again.Now I have specified the working,completion and the error directories.I have set the content type to “text/xml”.Now the file is being placed in the completion directory with out processing the file.
These are the steps in the service I invoke:
pub.file:getFile
pub.web:stringToDocument
pub.web:documentToRecord
and the further processing steps…

Am I missing anything else?

TIA

Krishna,

Did you tried to debug using savepipeline/ and later restorepipline see if the file hitting ur service.

I see you are using getFile.if you using IS filepolling mechanism then it is not necessary and ur service input should be node object for content-type=“text/xml”.
Just start with
pub.web:stringToDocument
pub.web:documentToRecord

Please let us know if still problem persists.

HTH,
RMG

RMG,
I removed the getFile in my flow.Did a restore pipe line.
I have got a value of the node object.
I have used pub.xml:xmlNodeToDocument instead of pub.web:stringToDocument & pub.web:documentToRecord

It worked perfect

Thanks
Krishna

RMG,
I have just bounced the IS…I have lost the file polling configuration.What should I do to retain the file polling configuration settings,if I bounce my IS.

TIA

Hi,

I am trying to poll a directory for a flat file and then process it.
Parameters set up for the file polling port as suggested above my Sivaram(expcect package name is WmFlatFile).

My processing service uses ConvertToValues, and i defined a input variable in input/output tab of type object(ffdata) which is mapped to ffData of the ConverToValues service.
when i put a file in the monitoring directory it is directly moved into the error directory and in the error log i see an error as

“com.wm.app.b2b.server.ServiceException: [FFP.0018.0009] Input parameter ffData cannot be null.”

but when i read my text file using pub.file.getfile and set loadAs to bytes and then map bytes to ffData of convertToValues service it works fine.

what am i doing wrong?

i also don’t see “application/x-wmflatfile” in MIME-types under IS/lib folder, Is this causing the problem ???

thanks in advance

Hi,
I’m using getfile service to read file from a folder mapped to the integration server. The mapped folder requires userid/password to connect and given while mapping it to integration server. The IS runs as windows service using a admin user id and password. The user id used for running IS is differnet than user id required to map the restricted folder.
Getfile service cannot read file from mapped folder. Can anyone tell me why ? I would be grateful if anyone give solution to acces the file from mapped folder.

Regards,
Rajesh

Rajesh,

The User ID used for running the IS (admin user id and password), should be same as the one used to access the shared folder, and should be provided with read and write permission on that shared folder

I found some related info at these link
[url=“wmusers.com”]wmusers.com
[url=“wmusers.com”]wmusers.com

Sai

Hello Everybody,

In reference to Post 4 answered by Sivaram, i have a query.

I created a File Polling service mentioning the name of the package as the one which had the mapping logic. The incoming file is an EDI file and i am using convertToValues of the WmEDI package. The file gets picked correctly but is moved to the error directory giving the error message saying “Null Pointer Exception”. Even after changing the package name to WmEDI i am getting the same error. Has anyone had the same experience.

Thanks
Gaurav