Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net VB.net project using Java

Hi. I have an ASP.net project where I have to call an XML engine. I was given the following Java code. Can this be converted to VB.net 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();
      connection.setRequestMethod("POST");
      connection.setDoOutput(true);
      PrintWriter out = new PrintWriter( connection.getOutputStream());
      String data = "The XML string request";
      out.print(data);
      out.flush();
      out.close();



      // This will read the XML response data...
      InputSource inSource = new InputSource(connection.getInputStream());
      DOMParser dp = new DOMParser();
      dp.parse(inSource);
      Document doc = dp.getDocument();
      // This gives you an XML DOM document to work with
     
    }
    catch (SAXException ex) {
    }
    catch (MalformedURLException ex) {
    }
    catch (IOException ex) {
    }
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

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
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thanks very much