Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: dnib on October 09, 2012, 10:55:18 AM

Title: access URL from GVP application
Post by: dnib on October 09, 2012, 10:55:18 AM
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]
Title: Re: access URL from GVP application
Post by: Fra on October 09, 2012, 12:17:43 PM
networks 101 + google: how http addresses are resolved.

Good luck

Fra
Title: Re: access URL from GVP application
Post by: dnib on October 11, 2012, 08:42:35 AM
Hi,

Maybe I am missing something. Because the link can be accessed from the same server using a jsp file containing the same code as the GVP studio application.

Maybe when Studio compiles the code it alters something... so i don't think is caused by the url not being resolved.


PS: in both attempts the same Apache server is being used.