Hello!
I am trying to access and URL (with returns a XML) from a GVP application. I have a jsp that can connect to the URL from my server, but when I insert the code into a CODE Block in GVP Studio i get “url cannot be resolved”.
Do you have any idea what can be the problem here?
Here is my code from CODE BLOCK:
[i]<%@ page language=“java” import=“org.w3c.dom.,javax.xml.parsers.DocumentBuilder,javax.xml.parsers.DocumentBuilderFactory,java.net.,java.io.*” pageEncoding=“ISO-8859-1”%>
<%!
public void processBegin(PageContext localPageContext){
}
public void processAnywhere(PageContext localPageContext){
String xml="";
String id ="http://www.yahoo.com";
try {
URL url = new URL(id);
url.openConnection();
}
catch (MalformedURLException e) {
System.out.println(e.getMessage());
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String InputLine = null ;
while ((InputLine = in.readLine()) != null) {
xml += InputLine;
}
in.close();
}
setPageItem (localPageContext, "vXML",xml);
}
//Can be used for writing the custom code that needs to get
//executed after the vxml page ends.can be used for doing cleanup
//Use "addStuff" variable for generating custom VXML code.
public void processEnd(PageContext localPageContext){
}
%>[/i]