Calling webservice via server causes java.net.MalformedURLException: no protocol
Posted
by Thomas
on Stack Overflow
See other posts from Stack Overflow
or by Thomas
Published on 2009-12-03T11:29:12Z
Indexed on
2010/04/10
19:03 UTC
Read the original article
Hit count: 371
I am writing a web-service, which parses an xml file. In the client, I read the whole content of the xml into a String then I give it to the web-service.
If I run my web-service with main as a Java-Application (for tests) there is no problem, no error messages. However when I try to call it via the server, I get the following error:
java.net.MalformedURLException: no protocol
I use the same xml file, the same code (without main), and I just cannot figure out, what the cause of the error can be.
here is my code:
DOMParser parser=new DOMParser();
try {
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema",true);
parser.setFeature("http://apache.org/xml/features/validation/dynamic",true);
parser.setErrorHandler(new myErrorHandler());
parser.parse(new InputSource(new StringReader(xmlFile)));
document=parser.getDocument();
xmlFile is constructed in the client so:
String myFile ="C:/test.xml";
File file=new File(myFile);
String myString="";
FileInputStream fis=new FileInputStream(file);
BufferedInputStream bis=new BufferedInputStream(fis);
DataInputStream dis=new DataInputStream(bis);
while (dis.available()!=0) {
myString=myString+dis.readLine();
}
fis.close();
bis.close();
dis.close();
Any suggestions will be appreciated!
© Stack Overflow or respective owner