Polling for FFs and Convert to Custom XML

Hi All. I apologize in advance for having such an open-ended general question but here it goes…

My company just got wM as part of a MUCH larger package. Anyway I never saw wM before last week and I have to develop a service in two weeks. Good thing the service is not too complicated.

Here is what I need to do:

  1. Pick up flat files from an AS400 server. Move them to wM server.
  2. Read the tab-delim, header/detail(s) file contents.
  3. Convert the contents to a custom XML format
  4. Write out the XML to file(s) and put the resulting files into another directory.

Because my deadline is so short I don’t want to get side tracked in different directions as I learn this development environment. So basically I want to know:

  1. What Approach I should take.
  2. Any Quick Start documentation?
  3. Any Reusable code.

From what I have read and investigated so far… It’s looks like I should do something like this.

  1. Build a ffSchema/DocType based on source ff format
  2. Use a ConvertToValues service to read and load and convert ff to DocTypes
  3. Use a BIS like DocToXMLString or custom java to convert DocType to Custom XML
  4. Use a FilePolling port in Integration Server to gather the files off of the AS400 and into the ConvertToValues service.

As you can see I have several details not figured out.

  1. How to convert the DocType into the Custom XML.
  2. How to write the XML string to a file.
  3. The difficulties associated w/FilePolling from an AS400 Library.

So any assistance/suggestions/direction would be appreciated. And I apologize again for the non-specific nature of this post.



First Goodluck on your project using WM product.Hope you guys on webMethods6.x version.

Based on your description you are trying to do FlatFile integration.So basically these are the basic procedure to do.

Make use of the WmFlatFile Adapter for parsing flatfiles to IDATA object(ffValues documentType using service called wm.flatfile:convertToValues)

1)Build a FlatFile Dictionary or FF Schema based on the AS400 flatfile format using FlatFile Editor in the Developer tool.
2)Once you created the Schema,test it using flatfile.txt and it should parse with out any errors.This option will be in the FlatFile editor panel.If no errors then there is an icon on the editor to create FlatFile Document structure.
3)Set up filepolling port in the IntegrationServer on a specific interval this will pull the flatfiles from the shared folder from the source system(so check the webMethods server has enough priviliges to pick up from AS400 system folders)
4)Build a flowservice(wrapper service) with Input ffdata (stream object-case sensitive)and specify the fully qualified name of the service in the filepolling port configuration page).The service logic steps will be pub.io:streamTobytes(covert ffdata to bytes)
pub.string:bytesToString(converts bytes to ffstring)
pub.flatfile:convertToValues(map the ffstring to ffData input and specify the FFSchema(fully qualified path) this will parse the ffstring to ffValues (flatfile document Type so use the recordReference of the above created flatfile document structure and directly map the ffValues to it.
Start mapping flatfile document structure to your customXML structure (i hope you have created this IS document type already exists).once you done with the mapping use the DocumentToXMLString service and map the input document(XML structure that you mapped)and specify docTypeName(fully qualified path)this will give output xmldata string.
Regarding writing the xml string to a file use this service located in the WmSamples package string folder writeToFile service it has inputs set the whole path in the filename and map the xmldata string to corresponding input.

Also please go thru the ISFlatFileSchemaserguide.pdf it helps regarding creating flatfile dictionary/schema,make use of WmFlatFile parsing services all the info etc…

Search in this site on flatfile parsing and filepolling procedure,you will find many results.

Sorry if my suggestions are not clear.


Thanks RMG!

That’s excellent information. It’s similar to what I was thinking, but you filled in a lot of the gaps for me. I am going to start going through this. I will let you guys know if I come across any hurdles along the way.

Thanks Again!

P.S. I welcome any additions to this!

I’m getting this error:

pub.io:streamToBytes java.lang.ClassCastException: java.lang.String

Looks like the file contents never makes it in the ffData input variable, but I’m not sure.

Any ideas?

Actually your Service input should be object named ffdata not ffData and it is casesensitive though.

please make sure once again.