Receive XML file through FTP

I have a flow service that accepts XML document from FTP port. Our security team will not allow us to open our Business Connector ftp port for external users. I can use an FTP site that is on a different server to receive the external XML file. How do I automate my flow service to run immediately when I receive an XML file to this FTP site that is not within the business connector server?

I appreciate your answers.

Regards,
Roger

RMG or someone,

I appreciate your help.

Regards,
Roger

Hi,
I don’t think there is something like trigger or notification u will have in FTP server which will notify IS that there is a new file.

The best you can do a schedule a service which will login to the FTP box and see if there is any file. Say every 5 min for what ever frequency you are looking. And get the file and process it.

Thanks
Bibek

Bibekananda,
Thanks for the reply. I am trying to look at examples to use the ftp service from pub.client.ftp:login, mget etc.,

I cannot find examples anywhere to determine the values/sequence that I should be using login, cd, mget. I would appreciate if you can point me in the right direction.

Regards,
Roger

Is there webMethods installed on your machine where files are placed through FTP? If so, you can configure a file polling port on that IS, to monitor the folder in which the files are being dropped (the poller can be configured to poll the folders recursively - ie poll sub-folders too). The file poller can be configured to pass on the file to a service that will process it.

For information on File Polling port, read up the ISAdministratorGuide

HTH, Roh

Roger,

These are the steps and build a ftp processing service,
pub.client.ftp:login(session)
pub.client.ftp:cd
pub.client.ftp:ls(to list the files in that directory)then loop over the list and use
pub.client.ftp:mget or get service
pub.client.ftp:logout (session).

HTH,
RMG.

RMG,
Thanks for the reply. I am using the same steps as you have mentioned. But, I am not even able to go beyond the login step. I can login successfully through command prompt. I cannot figure out what I am missing here.

I am assigning IP address to serverhost, username and password to service in parameters of login step. PLEASE help me out here.

Roger

I would like to more about where you are going wrong.

when you run the service what is the output you are getting?

You don’t have to invoke “ls” command and loopover if you know the file pattern.

In your case you can give *.XML , if you want to dump all the files into local directory. And the other part is you have to give the localdirectory(where IS is installed) name where you want to place the above files.

May help you if you give us some more details/error messages you are getting.

Prashanth

Here is a example of flow service to get files from FTP server:

Flow Overview

    1    MAP  
    2    SEQUENCE  
            2.1    SEQUENCE  
                    2.11    INVOKE  
                    2.12    BRANCH on '/successFlag'  
                            2.121    true: SEQUENCE  
                                    2.1211    INVOKE login  
                                    2.1212    INVOKE cd  
                                    2.1213    BRANCH on '/returncode'  
                                            2.12131    250: SEQUENCE  
                                                    2.121311    INVOKE ls  
                                                    2.121312    BRANCH on '/returncode'  
                                                            2.1213121    226: SEQUENCE  
                                                                    2.12131211    INVOKE get  
                                                                    2.12131212    BRANCH on '/returncode'  
                                                                            2.121312121    226: SEQUENCE  
                                                                                    2.1213121211    INVOKE bytesToString  
                                                                                    2.1213121212    MAP  
                                                                                    2.1213121213    BRANCH on '/deleteFile'  
                                                                                            2.12131212131    yes: SEQUENCE  
                                                                                                    2.121312121311    INVOKE delete  
                                                                                                    2.121312121312    BRANCH on '/returncode'  
                                                                                                            2.1213121213121    250: MAP  
                                                                                                            2.1213121213122    $default: MAP  
                                                                                    2.1213121214    INVOKE logout  
                                                            2.1213122    $default: MAP  
                                            2.12132    $default: MAP  
                    2.13    MAP  
                    2.14    EXIT '$parent'  
            2.2    SEQUENCE  
                    2.21    INVOKE logout  
                    2.22    INVOKE getLastError  
                    2.23    EXIT '$flow'

Roger,

From the error log, it looks like you’re trying to connect to FTP server through a proxy server. Is this the case? There are gozillion types of FTP proxies – Well, actually five (5) according to IS settings. Are you sure it’s not a problem with your FTP proxy setting? If you can FTP directly to the FTP server, do try turn off the proxy to make sure that proxy’s not the issue.

Two more things:

  1. There are two modes of operation for FTP servers (Active / Passive). Try the other in your service and see if it helps. I’m too lazy to go over the differences…

  2. What version of SAP BC are you using? FTP services have a bit of problems associated with them, and I think it’s not fixed until one of the Fixes for BC 4.6. An alternative to doing FTP would be to use OpenSSH. OpenSSH is a family of protocols, and webMethods have a free (but unsupported) package to do OpenSSH (scp, sftp, and ssh). They might also satisfy your network admins, as the protocol passes data encrypted (only!), and can use PKI to do client authentication. I prefer it to doing FTP. Search “SSH” in wMUsers to find articles discussing OpenSSH.

Yuan,
Thanks for your reply.

I can connect to the ftp site through command prompt without any problem. I tried both active and passive modes and I cannot login.

I have specified the following in the login service.
serverhost
serverport
username
password
transfertype (tried both active and passive)

I am lost trying to figure this one. We are on BC 4.6. I appreciate your help.

Regards,
Roger

Roger,
Is your problem solved? I’ve same issue can’t find reason…

Thnks in advance

Hi Groupies,
We are a staffing and placement company in Atlanta, GA…We are in need of a Web Developer for IBM in California…The Client is Looking for Someone who has webMethods (3 years) and Java Experience…
If interested Please Mail Me:
michelle@esolutionsoft.com

We appreciate if you discuss it with your friends and send your updated resumes ASAP…

Thanks…
Michelle
770-456-5757

Michelle,

Actually you have posted in a wrong place this section is exclusively for questions/discussions.So please do post this kind of stuff in the Wmusers/Jobs section area.

So that everyone will notice and will reply to you.

HTH,
RMG

Hi,
I want to write a Java service which takes an XML file as input from HTTP request, do some processing, and send back another XML file as output using HTTP response. How can i read xml file from the IData Object? How can i read the field values? and how to send an XML file back with HTTP response?
I am new to webMethods.
Can anybody help me achieving this?

Thanks.

Shency,

Any reason why you want to write a javaservice?instead you can do this using flowservice in a easier way.what you have to do is set the service input node(object)this will be in the pipeline for Http requests with content-type “text/xml”.So the flow will be XMLNodeToDocument(this will parse the IDATA structure gives output xml record structure then read the field values do mapping what ever your requirement says and finally pub.flow:setResponse for sending HTTP response.

XMLNodeToDocument
Read values
pub.flow:setResponse(in the same http session)

Please

HTH,
RMG

Shency,

You are in luck. What you want to do can be done very easily the built-in capabilities of Integration Server and Developer.

The Developer has a wizard to generate a Flow service that will receive an XML file and convert it to a document type. Click on the folder where you want the service to exist, hit Ctrl-N, choose “Receive An XML Document” and then follow the prompts to specify what source to use to describe the structure of the XML document to expect to receive (schema, DTD, etc.).

After processing the XML document using Flow, populate a response document type created from the schema (or sample XML) that describes what you want to return to the sender. Convert that doc type into an xml string using pub.xml:documentToXMLString and then map that to the “string” input of the pub.flow:setResponse service. When the service completes the string (xml doc) will be returned to the sender.

Since you are new to Integration Server, be sure to work through the Developer 4.6 tutorial available on Advantage (there’s not one for 6.x, but the 4.6 one is still very useful). Also, be sure to use try-catch sequences in your Flow so that you can handle exceptions properly.

Finally, take advantage of the existing documentation found in the Developer User’s Guide and the IS Built-In Services Guide. The built-in services I mentioned above are described in detail there. You will find these essential documents in the <wm_home>/Developer/doc folder.

Good luck!

Mark

Not to get too complicated right off the bat, but if you documents can get large it would be worth looking at WmSamples sample.complexMapping.largeDoc. It will show you how to process a chunk of your XML doc at a time without requiring it all in memory.

Cheers,
Fred

Thank you very much RMG, Mark Carlson and Fred Hartman,

This is really useful information for me.
Now, as you suggested i have written a flow service with the following steps

xmlNodeToDocument
MAP
documentToXMLString
setResponse

The service is working fine when i test from developer. (using Test/Send XML File option). But i have the following problems to resolve.

  1. When i use the below given html to invoke the service i am getting the following message ->java.lang.Exception: missing required parameter ‘document’

<html><head><title>Sample File Upload Form</title></head>
<body>

Sample File Upload Form

<form>
File to upload: <input>
<br><input> to upload the file!</form>
</body>
</html>

Can you tell me what could be wrong here?

2)Once the above problem is resolved, i need to do the processing of input XML by using one of the JAVA services.(now i am just doing a mapping from input xml fields to out xml fields). The Java service will be using the values in the input XML file and generate the values for the output XML files. How can i achieve this?

Thank you all,
Shency.