Calling simple URL from servlet.

Hello,
i need your help. I must call a simple URL (for example) "www.sun.com" from my servlet. How can i do this ? Sorry for stupid question, but i don't know how...
Dmitri.

I didn't know, Lgmqy2000, that i can delete "Duke"....... i tried to cancel it, but without results...
Dmitri

Similar Messages

  • Not able to dispatch to an URL from servlet

    Hi ,
    I am trying to call a URL from a servlet, which is running in an oc4j instance of Oracle AS 10.1.2.0.2
    My servlet (session_servlet) basically reads the session id, whenever it is accessed. It then inserts this session id into a table in an oracle database. Then, I want to access my Oracle Forms application from session_servlet, by dispatching to the URL, say
    http://<my_host>/forms/frmservlet?config=test&session_id=<the_session_id_read_by_session_servlet>
    session_servlet and frmservlet are running on the same Oracle AS, but on different http servers, session_servlet on port 7777 and frmservlet on the default 80.
    <code snippet of my session_servlet, where I am dispatching to the URL>
    getServletContext().getRequestDispatcher("http://<my_host>/forms/frmservlet?config=test&session_id="+session.getId()).forward(request,response);
    But am getting the following error
    500 Internal Server Error
    java.lang.NullPointerException
    at session_tracker.doGet(session_tracker.java:54)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:826)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:332)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Can someone please help me on this.
    Thanks,
    Suresh

    getServletContext().getRequestDispatcher("http://<my_host>/forms/frmservlet?config=test&session_id="+session.getId()).forward(request,response)
    From the Javadocs for ServletContext.getRequestDispather():
    http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)
    The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a RequestDispatcher.
    -steve-

  • Calling a url from a pl/sql proc

    HI!
    I was wondering if anybody has code that they can share calling a url from a pl/sql proc.
    Thanks!!

    Thanks - tell me if I am wrong but it does not seem to be what I need. does this package have the capabilities of doing the following... I want to call a pl/sql procedure - I am not in any browser window and by calling this proc it will bring up a browser window with the given url.

  • How to call a URL from forms ?

    Dear All,
    I would like to invoke / call a URL from forms. I know we can make a call Using Web.show_document. But this will execute in a browser.
    What i need to do is, i have to send a request to by calling an URL, that should not visible to any body.
    This is my requirement, please help if you know.
    Thanks
    Balaji

    hi,
    here is a quick example : (data from url returns as a clob. you need to write it at db. and call from forms.)
    FUNCTION Get_DataFromUrl(pUrl IN VARCHAR2,pProxy IN VARCHAR2,pData IN OUT CLOB) RETURN NUMBER IS
    vRcv UTL_HTTP.HTML_PIECES;
    vData CLOB;
    eNoDataReceived EXCEPTION;
    BEGIN
    UTL_HTTP.SET_DETAILED_EXCP_SUPPORT(TRUE);
    -- Get data pieces from Url
    vRcv := UTL_HTTP.REQUEST_PIECES(pUrl,Proxy => pProxy);
    IF vRcv.COUNT < 1 THEN
    RAISE eNoDataReceived;
    ELSE
    -- Append varchar2 table data into clob variable
    DBMS_LOB.CreateTemporary(vData,FALSE,DBMS_LOB.CALL);
    FOR i IN 1..vRcv.COUNT LOOP
    DBMS_LOB.WriteAppend(vData,LENGTH(vRcv(i)),vRcv(i));
    END LOOP;
    -- Copy local data into return variable
    DBMS_LOB.Copy(pData,vData,DBMS_LOB.GetLength(vData));
    DBMS_LOB.FreeTemporary(vData);
    END IF;
    RETURN SUCCESS;
    EXCEPTION
    WHEN eNoDataReceived THEN
    RETURN FAILURE;
    WHEN UTL_HTTP.INIT_FAILED THEN
    RETURN FAILURE;
    WHEN UTL_HTTP.Request_Failed THEN
    RETURN FAILURE;
    WHEN OTHERS THEN
    RETURN FAILURE;
    END Get_DataFromUrl;
    hope this helps.
    Engin.

  • Calling a url from forms

    Hi!
    i have created a website using ARCIMS - (if you are not familiar with ARCIMS it is software that is used to create maps) I now want to call URL (website) from a button on my form. I have tried to use web.show_docuement and I am getting errors such as 'register failk'.
    I was able to run this same URL succesfuly from my browser. any ideas please?!?

    Kayla.
    web.show_document() is the right buit-in to do this and it works the same as calling a URL from a Browser. if it says "register failed" (not sure if I am correctimng your error message the right way) then this does not look like a Forms error message but one coming from teh program you call. Please check teh URL that is composed before calling web.show_document(). Check for invisible characters added to it.
    Frank

  • Urgetn - Can you call a url from a workflow?

    Hey,
    Does anyone know if you can call a url from a workflow?
    Your urgent attention would be grateful.

    I have done this in a form. You could put a manual action to call the form then display the url (Technical Reference 3-14)
    <Field>
    <Display class='Link'>
    <Property name='name' value='Request
    Group Access'/>
    <Property name='URL'
    value='user/processLaunch.jsp?newView=true'>
    <Property name='id' value='Group Request
    Process'/>
    </Display>
    </Field>
    Hope this helps
    BigBenny

  • Calling a URL from a Java Stored Procedure

    Hi,
    I'm trying to call a URL from a Java Stored Procedure in Oracle 8.1.7(Windows 2000). The ultimate goal is to call this stored procedure from a database trigger. The status of the object remains invalid in the database even after compilation and publishing without any errors. The code follows. Any suggestions/alternatives to accomplish this would be appreciated.
    Java Stored Procedure:
    CREATE OR REPLACE JAVA SOURCE NAMED "UPDATEATTR" AS
    import java.net.*;
    import java.util.*;
    import java.io.*;
    public class UpdateAttr {
    public static String testmain() {
    ObjectInputStream is;
    URL url;
    String uri =
    "http://www.yahoo.com";
    try {
    //calling the URL
    url = new URL(uri);
    URLConnection yahooConnection = yahoo.openConnection();
    } catch (Exception e) {
         e.printStackTrace(System.err);
    return "TEST_SUCCESSFUL";
    Code to Publish it:
    CREATE OR REPLACE FUNCTION setNewAttributes return VARCHAR2
    AS LANGUAGE JAVA NAME
    'UpdateAttr.testmain() return String';
    Thanks in advance.
    Ris

    Small mistake in the previous post. The object still has a status of "INVALID" though. The Java stored procedure should actually read:
    Java Stored Procedure:
    CREATE OR REPLACE JAVA SOURCE NAMED "UPDATEATTR" AS
    import java.net.*;
    import java.util.*;
    import java.io.*;
    public class UpdateAttr {
    public static String testmain() {
    ObjectInputStream is;
    URL url;
    String uri =
    "http://www.yahoo.com";
    try {
    //calling the URL
    URL yahoo = new URL(uri);
    URLConnection yahooConnection = yahoo.openConnection();
    } catch (Exception e) {
    e.printStackTrace(System.err);
    return "TEST_SUCCESSFUL";
    Code to Publish it:
    CREATE OR REPLACE FUNCTION setNewAttributes return
    VARCHAR2
    AS LANGUAGE JAVA NAME
    'UpdateAttr.testmain() return String';
    /

  • Calling URL from servlet

    Hi!
    I am trying to find a solution to this scenario:
    1) A cron job will call a servlet.
    2) Servlet calls a URL on remote server.
    3) Remote server returns an XML document.
    4) Servlet processes/parses the XML document.
    5) Servlet stores XML fields into DB.
    6) Servlet response (entry to log file) indicates status of transaction.
    I'm stuck @ #2. What mechanism can I use to make a call to remote URL? I do not want the returning XML document to display on the client's browser; I want to process it on the back-end.
    Thx!

    http://java.sun.com/docs/books/tutorial/networking/urls/readingURL.html

  • Calling JavaScript function from Servlet ?

    I have a Servlet that needs to call a general purpose JavaScript function to retrieve some data. The JavaScript function sits in a file on the web server called general.js.
    How can I call this function from my servlet to retrieve an integer result ?
    Sarah.

    http://developer.netscape.com/docs/manuals/js/client/jsguide/index.htm
    Look for Java to JavaScript communication.

  • Calling Java application from servlet

    Hi !
    I'm trying to run a Java application from within a servlet with Tomcat 4. I'm using the Runtime.getRuntime ().exec () method. So the application is run in a different JVM as a subprocess of the servlet. I use ObjectInputStream and ObjectOutputStream and a serializable object to enable communication between the servlet and the application.
    I tested the application and the serializable object with another Java application that works as the caller and it works fine. However, replacing the caller application with the servlet I get a StreamCorruptedException. The structure of the caller application and the servlet is the same.
    My questions are:
    - Is there something I should configure in Tomcat to create a subprocess ?
    - What is the cause of the StreamCorruptedException ? How do I get it with the servlet and not with the application ?
    - Should I use an environment with the call to Runtime.getRuntime ().exec () ? How do I use it ?
    - Is the called application forced to run in my servlet's context ?
    - Is there a better way to do this ?
    Thanks to all

    Here's my code:
    1. The serializable object:
    // Object Obj
    import java.io.*;
    public class Obj implements Serializable
    public int n;
    public Obj ()
    n = 0;
    public Obj (int n)
    this.n = n;
    public String toString ()
    return getClass ().getName () + " -> (n = " + n + ")";
    2. The application Sub (subprogram)
    // Application Sub
    import java.io.*;
    public class Sub
    private static File f;
    private static FileWriter fw;
    public static void main (String [] args)
    throws IOException, InterruptedException, ClassNotFoundException
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj;
    ois = new ObjectInputStream (System.in);
    obj = (Obj) ois.readObject ();
    f = new File ("Sub.txt");
    fw = new FileWriter (f);
    fw.write (obj.toString ());
    fw.close ();
    oos = new ObjectOutputStream (System.out);
    oos.writeObject (obj);
    ois.close ();
    oos.close ();
    3. The application AMain (caller application)
    // Application AMain
    import java.io.*;
    class AMain
    private static File f;
    private static FileWriter fw;
    public static void main (String [] args)
    throws IOException, ClassNotFoundException
    Runtime r;
    Process p;
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj, obj2;
    r = Runtime.getRuntime ();
    p = r.exec ("java Sub");
    oos = new ObjectOutputStream (p.getOutputStream ());
    obj = new Obj (5);
    oos.writeObject (obj);
    oos.flush ();
    B.comunica (obj);
    System.out.println ("AMain sends to Sub: " + obj.toString ());
    try
    p.waitFor ();
    catch (InterruptedException e)
    System.out.println ("Subprogram was interrupted");
    System.out.println (e.toString ());
    ois = new ObjectInputStream (p.getInputStream ());
    System.out.print ("Sub sends to AMain: ");
    obj2 = (Obj) ois.readObject ();
    System.out.println (" " + obj2.toString ());
    oos.close ();
    ois.close ();
    p.destroy ();
    4. The servlet SMain (the calling servlet)
    // Servlet SMain
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class SMain extends HttpServlet
    public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    Runtime r;
    Process p;
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj, obj2;
    int state, i;
    res.setContentType ("text/html");
    ServletOutputStream out = res.getOutputStream ();
    out.println ("<html>");
    out.println ("<head><title>Sub</title></head>");
    out.println ("<body>");
    out.println ("Invoking subprogram...");
    out.println ("<br>");
    try
    r = Runtime.getRuntime();
    p = r.exec ("java -cp .;c:\\Programs\\Apache~1.0\\webapps\\SMain\\WEB-INF\\classes Sub");
    out.println ("...invoked<br>");
    oos = new ObjectOutputStream (p.getOutputStream ());
    obj = new Obj (5);
    oos.writeObject (obj);
    oos.flush ();
    out.println ("<br>SMain sends to Sub: " + obj.toString () + "<br>");
    try
    p.waitFor ();
    catch (InterruptedException e)
    out.println ("<br>Subprogram was interrupted<br>");
    out.println ("<br>" + e.toString () + "<br>");
    state = p.exitValue ();
    out.println ("<br>Subprogram state: " + state + "<br>");
    ois = new ObjectInputStream (p.getInputStream ());
    out.print ("<br>Sub sends to SMain: ");
    obj2 = (Obj) ois.readObject ();
    p.destroy ();
    catch (SecurityException e)
    out.println ("<br>SecurityException<br>");
    out.println ("<br>" + e.toString () + "<br>");
    catch (IOException e)
    out.println ("<br>IOException<br>");
    out.println ("<br>" + e.toString () + "<br>");
    catch (Exception e)
    out.println ("<br>Exception<br>");
    out.println ("<br>" + e.toString () + "<br>");
    out.println ("</body>");
    out.println ("</html>");
    So, as you can see, both application AMain and servlet SMain invoke application Sub and pass it the serializable object Obj. Oddly enough, application AMain works fine whereas servlet SMain throws a StreamCorruptedException exception.
    johnpoole said:
    �It's hard to guess what would cause the exception without seeing code, but the interaction between the processes would differ from that between two applications, because the servlet process is started with a different class loader. I'm not sure which one the jvm started by the call would use.�
    How can I enforce that a System classloader be used in the call to Runtime.getRuntime ().exec () ? (I mean by System classloader a classloader equals to the one applications are launched from console).
    johnpoole said
    �Is there a reason why you aren't starting the second process manually and then connecting to it on a port?�
    The idea is providing a Web interface for an application running in the server. The servlet is used to restrict access to this application but once access is granted (passing the servlet) the application should not be constrained.

  • Calling a URL from WD for ABAP 2004s

    Hi,
    In our scenario we would like to call workflow items from a web dynpro for abap application. We do not use a portal.
    I have build an alv from where the user can select his workflow tasks. A button then calls a method to trigger workflow. Within the method I have te workitem and the correct url available.
    Please let me know how to call the url and if possible let the url start the session in the current browser window (the window from where I started the url).
    Message was edited by: Raymond Does
    Solved it. Solution can be found in the Quiz example.
    Message was edited by: Raymond Does

    Hi Yash,
    There is the code :-)
    <Field name='fieldname'>
    <Display class='Link'>
    <Property name='name' value='link to launch jsp'/>
    <Property name='URL' value='http://localhost:8080/idm/output?param="hello"'/>
    </Display>
    </Field>
    thanx
    Shant

  • How to encrypt Password while calling Portal URL from Abap

    Hi all,
    My requirement is to call portal from R/3 4.6C.  As part of it I'm calling Portal URL along with user id & Password by using the FM CALL_BROWSER. The problem here is User ID & Password are visible everyone in the URL.
    Is there any way that I can encrypt sothat it doesn't become a security issue?
    I really appreaciate for your help.
    Thanks
    Seshu

    can you please mention the abap code  by which you are sending the username and password to a portal via url.....
    are you able to log on to the portal...please share your code ......
    Edited by: Ashutosh Shukla on Apr 18, 2008 9:17 AM

  • How to call Web Service from Servlet !

    Dear All,
    I am in dire need to understand how to call a web service from Servlet.
    I need to develop a web service which will read LDAP Directory server to retreive information.
    How I should call that web service from a Servlet? What Servlet actions do I need to write etc.
    I need guidance about design of the above task please.
    I would higly appreciate any help and guidance in this regard.
    Thanks.
    Regards,
    Waqar

    You can use java.net.URLConnection for that.

  • Call external URL from ABAP userexit, capture data and return it to SAP?

    My apologies if this question has been asked before, but I've searched for a few hours today and haven't found anything directly related to my question.  Thank you in advance for any help you may be able to provide!
    I would like to be able to make a call from an SAP userexit during Sales Order Entry in the VA01 transaction in the SD module to an external website, allow the user to capture some data in the external site and then pass that data back into the userexit where I can use it to populate internal tables, etc.
    I'm completely unfamiliar with Web Dynpro programming, but this seems like a good place to start my search for a solution. 
    Does this sound like a problem that can be solved with Web Dynpro and what documentation or code examples should I reference to go about building such a solution.
    I should also note that I'm hoping to build a solution that could be called from any userexit in R/3, SAP ERP, SAP CRM, etc. and would obviously need to learn about what dependencies to consider (ex: SAP GUI version, SAP product release number, Web AS release, etc.).
    Eric

    Thank you for the response.  Let me provide some additional information.
    The external application will be a Hosted Web page.  It is not an SAP system. 
    The external application will be a web page served by a separate system outside of the company domain(shouldn't matter what the technology is I would think - but the web page will be hosted by a different company than the one calling the URL) that would appear as a web page in which the user will enter data, logic will be performed on that data and then some or all of the data would need to be passed back to the calling point in SAP.
    For practical discussions it doesn't matter to me if the call in ABAP occurs in an SD userexit, in a custom report, in an HR screen or in a CRM business partner screen.  There will be many places where this external application may be called from and I'm just trying to figure out how to call an external HTTPS URL and return data from that web page to the calling point in ABAP.
    I hope that clarifies my question.
    Thanks!
    Eric

  • Calling an applet from servlet

    Hi
    I'm devoloping a server side java software(on netbeans 6) and I want my gui classes(Designed as swing japplet application) to be executed on server side.
    I mean I have database operations on my applet and some logging functions and I want them to execute on server side not client side
    Is it possible to call applets from servlet and so its executed on server if it is possible how can i do that is there a tutorial for that ?
    If it is not is there any other solution? Its really urgent for me
    Thanks

    tolgatanriverdi wrote:
    I'm devoloping a server side java software(on netbeans 6) and I want my gui classes(Designed as swing japplet application) to be executed on server side.Call a company named Citrix, they do stuff like that using a special client.
    I mean I have database operations on my applet and some logging functions and I want them to execute on server side not client sideSo it's not the GUI classes but the rest of the business logic.
    Is it possible to call applets from servlet and so its executed on server if it is possible how can i do that is there a tutorial for that ?It's possible for a servlet to call any class. It's not easily possible for a servlet to connect to a certain applet instance running on a certain client, and neither should it. Hello - it's the server. It's supposed to answer to requests. It's not supposed to issue requests to the client. And considering your set-up as I understood it, you don't ned that anyway. Let the applet just tell the servlet to do action X or Y or Z.
    Its really urgent for meGood Thing that you wrote it here. If you had written it at the beginning of your post, I wouldn't have bothered to answer.

Maybe you are looking for

  • How to access MS SQL in Oracle BI Administration?

    Hi All, I'm a new in Oracle BI, I've just created an business application using Oracle BI Administration Tool of Oracle BI Server version 10.1.3.4.1: Steps: 1. building repository (through Physical, Business model and Mapping, Presentation), 2. makin

  • Error in spatial index

    Hi, everyone I created a spatial index on a table, but i get the error message: ORA-13033: the data in sdo_elem_info_array of sdo_geometry is unavailable How can i write a SQL command to delete those unavailable records?

  • Windows 7 Webcam driver?

    Hey, I have an X200 tablet that I just installed Windows 7 on. I've installed patches/drivers for almost everything, but I can't get the webcam to work.  Any help?

  • UCCX Modifying XML document in repository programatically

    Hi, I'm trying to write a web application that so that our non-admin users can have the ability to add holidays, turn on outage messages etc. The files that I need to manipulate are XML files that reside in the document repository. I had originally p

  • Seeking a LabVIEW Development Job in South India

    Looking forward to work for a reputed organization. Over 2 + years of experience in design and development of customized PC based Embedded software's, automation tool for audio and vision validation, Audio and Telematics Validation Test Cases design