Consommer un flux RSS

Fermé
cool-abdoul Messages postés 96 Date d'inscription dimanche 14 juin 2009 Statut Membre Dernière intervention 30 novembre 2010 - 4 sept. 2009 à 09:17
 cool-abdoul - 10 sept. 2009 à 14:03
Bonjour les amis,
je cherche à cosommer un plus ? Pouvez vous m'aider ?
* J'ai fait un test unitaire avec des System.out.println et je constate que je rentre dans le try mais
* et qu'une exception pête pour me renvoyer dans le catch
En fait la methode

String fluxConso = HtmlUtil.stripComments(HttpUtil.URLtoString(
"http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=vie"
));
ChangeXml wXml = new ChangeXml(fluxConso);
myChange = wXml.getSerializableChange();

qui me permet de consommer le flux RSS n'est jamais exécutée !
* je ne compreends pas !

* voici mon code !!




import change3.domain.ChangeXml;
import change3.domain.ChangeSerializable;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.kernel.util.HttpUtil;
import com.liferay.portal.kernel.util.Time;
import com.liferay.portal.kernel.webcache.WebCacheException;
import com.liferay.portal.kernel.webcache.WebCacheItem;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class ChangeWebCacheItem implements WebCacheItem {
protected static Log logs = LogFactory.getLog(ChangeWebCacheItem.class);
private static final long _REFRESH_TIME = Time.MINUTE * 20;
private String symbole;
private boolean euro;


public ChangeWebCacheItem(String symbol, boolean euro) {
symbole = symbol;
this.euro = euro;
}

public Object convert(String arg0) throws WebCacheException {
ChangeSerializable myChange = null;

try {
String fluxConso = HtmlUtil.stripComments(HttpUtil.URLtoString(
"http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=vie"
));
ChangeXml wXml = new ChangeXml(fluxConso);
myChange = wXml.getSerializableChange();
} catch (Exception e) {
throw new WebCacheException();
}

return myChange;
}


/*
public static void main (String[] args) throws WebCacheException {
String symbole ="";
ChangeSerializable mychange = null;
System.out.println("Avant le try !");
try {
System.out.println("Debut du try ");
String fluxConso = HtmlUtil.stripComments(HttpUtil.URLtoString(
"http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=cac"));
System.out.println(fluxConso);
ChangeXml wXml = new ChangeXml(fluxConso);
mychange = wXml.getSerializableChange();
} catch (Exception e) {
throw new WebCacheException();
//System.out.println("message du catch !");
}

}
*/

}

1 réponse

Les amis, je vous attends !! Quelqu'un peut-il m'aider ? je cherche toujours une solution sur ma consommation de flux mais je ne trouve toujours pas de solution ? Help me !
0