Calling webservice via server causes java.net.MalformedURLException: no protocol
- by Thomas
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!