Solved project using Java

Posted on 2012-08-13
Last Modified: 2012-08-16
Hi. I have an project where I have to call an XML engine. I was given the following Java code. Can this be converted to or used in my project?

  try {

      // This will Post the xml string data...    
      URL url = new URL("http://IPAddress:Port/APIWebModule/APIServlet");
      HttpURLConnection connection = (HttpURLConnection)url.openConnection();
      PrintWriter out = new PrintWriter( connection.getOutputStream());
      String data = "The XML string request";

      // This will read the XML response data...
      InputSource inSource = new InputSource(connection.getInputStream());
      DOMParser dp = new DOMParser();
      Document doc = dp.getDocument();
      // This gives you an XML DOM document to work with
    catch (SAXException ex) {
    catch (MalformedURLException ex) {
    catch (IOException ex) {
Question by:murbro
    LVL 86

    Expert Comment

    That code is not for a web application, ASP, Java or otherwise. It's code for a java 'desktop' application to invoke a web app

    You should probably simply ask the ASP people how to parse XML returned from the service in question
    LVL 83

    Accepted Solution


    Author Closing Comment

    Thanks very much

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now