How to execute wM service via FTP

Hello All,

I have a client who will be ftp’ing a flat file. The data in the file is fixed width. I would like to translate the file into a record so that I could insert the data into a database. I just don’t know how to get my flow service to work properly. Any ideas? I assume the client will write a script to ftp to the server put the file into the correct location (/ns/packagename/testFTP).

Structure of the file:
System Name 1-10
Vendor Name 11-43
Vendor Key 44-57

Service: testFTP (Input=inputNode object)
Steps ?

noyb,

There are lot of discussions posted in this site about this procedure.you can use the search functionality and may find solution before posting.

I believe you are using webmethods 4.6 server.

First you need to create flatfile template or its ok if you already have it.

your Service:testFTP (set Input=contentStream object)

Flow Steps:Invoke the following
pub.io:streamToBytes
pub.string:bytesToString
wm.b2b.edi:convertToValues (WmEDI Package service)

HTH,

Thanks RMG for the quick response. I was overwelmed with information after searching the forum. Thank you for your response.

RMG,

Don’t I need to create a map step to define my flatfile template? After that, where is it being used?

your welcome,Nice you are on the track.

RMG,

I was thinking. Instead of an object, shouldn’t my testFTP input service be just a string?

No,The input should be stream object,because when the flow service receives any .txt or dat file from FTP a java InputStream object will be loaded.So set the service input to contentStream object.

Debug this if you want.

HTH,

RMG,

I did what you said. I would I test to see it this works. I cannot use the “Test/Send XML File…”

noyb,
the test, send xml file is for XML files, not flat files. It attempts to convert the XML file into a node object, which is not going to work too well with a flat file.

If you want to test your service, perhaps look at creating a service that takes in a String and converts it into a stream (look at the pub.io folder for the services) called contentStream, and then invokes your actual service. This will then simulate what will happen when they invoke your service via an FTP upload of the file.

Alternatively you could have it take in a filename and read from that file using pub.file:getFile with loadAs set to “stream”. then just pass that returned stream as the input for your service.

Regards,
Nathan Lee
WmUnit - The webmethods testing framework.
http://www.customware.net/wmunit