cancel
Showing results for 
Search instead for 
Did you mean: 

Get file from Webpage

christian_pichler
Participant
0 Kudos

Hello,

We have to collect the actual exchange rates from the European Central Bank every day. The link for the file is http://www.ecb.int/stats/eurofxref/eurofxref.zip?

Is there a possibility to download the file automatically to the PI system? The next steps (unzip, map to SAP IDoc) are already working fine but the download of the file is still manual work.

Thanks in advance!

Chris

Accepted Solutions (1)

Accepted Solutions (1)

sunilchandra007
Active Contributor
0 Kudos

1) You can write OS script to download the file as suggested in /people/michal.krawczyk2/blog/2010/01/22/pixi-how-to-get-an-xml-file-from-a-web-page-without-own-development if it helps.

2) or create a dummy ineterface with java mapping inside to download the file and use ATP for scheduling the channel for this interface on daily basis.

Regards,

Sunil Chandra

Former Member
0 Kudos

Sunil,

could you please explain how to use the second option... this ia urgent.. pls

thank you

yash

Answers (1)

Answers (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi try this UDF code in message mapping, this code will work for you to read data from Web Site.

i have used same code one year back to read data from my partner website as a xml file.

AbstractTrace trace = container.getTrace();
String var1 = null;
try{  
  
	URL url = new URL("http://www.ecb.int/stats/eurofxref/eurofxref.zip?");
	URLConnection uc = url.openConnection();
                     BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));
                     String inputLine;
	while ((inputLine = in.readLine()) != null) {
    	   if (inputLine.indexOf("	<cb:value") != -1) {
    	       var1= (inputLine.substring(inputLine.indexOf('>')+1,inputLine.indexOf('<',2)));
           }
       	}
      	 in.close(); 
 }
catch(Exception e) {
trace.addInfo(e.getMessage());
}
result.addValue(var1);

Regards,

Raj

christian_pichler
Participant
0 Kudos

Hi Raj,

thanks for your help!

Did you use a user-defined function with this code within the message mapping?

Thanks!

Chris

Former Member
0 Kudos

Hi Raj,

Can u briefly explain me ,How to use this udf.

Warm Regards,

SAI.P.

Edited by: sayee.p on Jun 10, 2011 7:31 AM

Former Member
0 Kudos

Hi Raj,

Could you please help me how to use this code given by you in the mapping and how would be the directory steps... I have been struggling with the same scenario but i am unable to do it. I am working with the basis to get the AXIS adapter installation (some components are missing). . it would be great if you can guide me on this issue asap....

thank you....

Yash