cancel
Showing results for 
Search instead for 
Did you mean: 

How to pick a file from a website

Former Member
0 Kudos

Hi All,

I have a requirement like this. I need to pick a file from a website for which i have the link and the file name . Its a .csv file. can i use file adapter to pick that file? can i mention the http link in the source directory field? or suggest me some way to pick that file . Its a website not a web service.

reagrds

jhansi

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member192343
Active Contributor
0 Kudos

first of all you need get file from http and place it to your folder. It can be any script, for example php, or java. Script takes file from http and saves it in your folder. And only then, XI takes it from your folder and process it.

former_member192892
Active Contributor
0 Kudos

Perfect from Mikhail...

I have given the code to download the file using java....

I'd have look into the URL class methods to get more info on what else can be achieved, like if there are multiple files in the URL and havind random names...

Former Member
0 Kudos

can u suggest me a blog or some link , to do a sample scenario on this.

and in my requirement , the file name is dynamic.

jhansi

prabhu_s2
Active Contributor
0 Kudos

is ur file an attachment in the website or is it a link from where u can download or open?

Former Member
0 Kudos

Ya it is a link. not the attachemnt

prabhu_s2
Active Contributor
0 Kudos

maybe u can try with this:

1. get the source location of the file (not the link in the web but the source location from the server the hyperlink is pointing to).

2. If you can get this link u can have a RFC f/m in R3 that wuld get the data from that location and have the file placed in the application server else using FILE adapter u can access the server provided it is FTP enabled.

Former Member
0 Kudos

can this be possible using java proxies. any idea?

please suggest something.

thanks

former_member192892
Active Contributor
0 Kudos

HI Hema,

A work around i see is to use run operating system command before message processing option in sender file adapter.

Here I'd write a .bat file which which will execute a java class..

Basically I'll write a java class to download the file from the URL and keep it. And this file will be picked up by XI.

May be the same thing can also be achieved using scripts but i have no idea on dat...

Any how, my java code segment wud be something like

try {

String webFile =

"http://www.dilbert.com/comics/dilbert/archive/images/dilbert2002222271107.gif";

URL url = new URL(webFile);

InputStream is = url.openStream();

FileOutputStream fos=new FileOutputStream("C://MyFolder//dilbert2002222271107.gif");

int oneChar;

while ((oneChar=is.read()) != -1)

{

fos.write(oneChar);

}

is.close();

fos.close();

} catch (Exception e) {

// TODO: handle exception

e.printStackTrace();

}

prabhu_s2
Active Contributor
0 Kudos

hema

as prateek pointed u cannot access file in the website.....stored as an attachment

prateek
Active Contributor
0 Kudos

<i>can i use file adapter to pick that file?</i>

No. File adapter cannot pick the file if the system involved in not an FTP server.

<i>can i mention the http link in the source directory field?</i>

Not possible

Even if u use http adapter, the attachment for sender http is not supported. U said u have url. How exactly does the system storing the file and please clarify the method of accessing the file

Regards,

Prateek