Murray Brown
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.ope nConnectio n();
connection.setRequestMetho d("POST");
connection.setDoOutput(tru e);
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.get InputStrea m());
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) {
}
try {
// This will Post the xml string data...
URL url = new URL("http://IPAddress:Port/APIWebModule/APIServlet");
HttpURLConnection connection = (HttpURLConnection)url.ope
connection.setRequestMetho
connection.setDoOutput(tru
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.get
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) {
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much
You should probably simply ask the ASP people how to parse XML returned from the service in question