cancel
Showing results for 
Search instead for 
Did you mean: 

loading xml from url problem

Former Member
0 Kudos

Hi,

I wrote a wd java application to get weather information from google url for a city

('http://www.google.com.tr/ig/api?weather=istanbul') .

When i execute program it gets error below:

WDURLExceptionFailed to generate URL to deployable object 'http://www.google.com.tr/ig/api?weather=istanbul', application 'ApproverInbox'.

What must i do the program run properly? Does it need some configuration on portal?

Thanks.

Below is source code.

String l_strXMLPath = null;
	try {
		l_strXMLPath =	WDURLGenerator.getApplicationURL("http://www.google.com.tr/ig/api?weather=istanbul", "ApproverInbox");
		FileReader l_xmlTemplate = new FileReader(l_strXMLPath);
		InputSource l_inputSource = new InputSource(l_xmlTemplate);
		DocumentBuilderFactory l_dbf = DocumentBuilderFactory.newInstance();
		DocumentBuilder l_db = l_dbf.newDocumentBuilder();
		Document l_xmlDoc = null;
		l_xmlDoc = l_db.parse(l_inputSource);
		NodeList XML_BookNode = l_xmlDoc.getElementsByTagName("forecast_conditions");
		for (int i = 0; i < XML_BookNode.getLength(); i++) {
			Node XML_Node = XML_BookNode.item(i);
			IPrivateKurApp2View.IForecast_conditionsElement l_bookEle =
				wdContext.nodeForecast_conditions().createForecast_conditionsElement();
			l_bookEle.setDay_of_week(
				XML_Node
					.getChildNodes()
					.item(1)
					.getChildNodes()
					.item(0).getAttributes()
					.toString());
			l_bookEle.setLow(
				XML_Node
					.getChildNodes()
					.item(3)
					.getChildNodes()
					.item(0).getAttributes()
					.toString());
			l_bookEle.setHigh(
				XML_Node
					.getChildNodes()
					.item(5)
					.getChildNodes()
					.item(0).getAttributes()
					.toString());
			l_bookEle.setIcon(
				XML_Node
					.getChildNodes()
					.item(7)
					.getChildNodes()
					.item(0).getAttributes()
					.toString());
			l_bookEle.setCondition(
				XML_Node
					.getChildNodes()
					.item(9)
					.getChildNodes()
					.item(0).getAttributes()
					.toString());
			wdContext.nodeForecast_conditions().addElement(l_bookEle);
		}
	} catch (WDURLException e) {
		wdComponentAPI.getMessageManager().reportSuccess(
			"WDURLException" + e.getMessage());
	}  catch (FileNotFoundException e) {
		wdComponentAPI.getMessageManager().reportSuccess(
			"FileNotFoundException" + e.getMessage());
	} catch (FactoryConfigurationError e) {
		wdComponentAPI.getMessageManager().reportSuccess(
			"FactoryConfigurationError" + e.getMessage());
	} catch (SAXException e) {
		wdComponentAPI.getMessageManager().reportSuccess(
			"SAXException" + e.getMessage());
	} catch (ParserConfigurationException e) {
		wdComponentAPI.getMessageManager().reportSuccess(
			"ParserConfigurationException" + e.getMessage());
	} catch (IOException e) {
		wdComponentAPI.getMessageManager().reportSuccess(
			"IOException" + e.getMessage());
	}

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

who told you to use this WDURLGenerator.getApplicationURL?

Do you know what is this api for?have you ever read the api doc?

i think you should use java.net.URL

Edited by: John Wu on Oct 26, 2011 12:44 PM

Former Member
0 Kudos

Hi john,

How can i use java.net.URL?

is there a blog or sample code to use it with xml load operation?

thanks.

Former Member