technique to transfer xml from jsp to servlet
I'm making a web app (standard JSP and servlet) that will consume a certain web service. the data that the user will feed to the web service is in the form of xml file (data.xml). Let's say the user, the web app server and web service server are all in different PC1, PC2 and PC3 respectively. The user has data.xml in PC3 accessing web page from PC2 (jsp). My question is what's the better way to transfer the XML? scenario 1: transfer in the form of filestream (file upload) from jsp -> servlet -> web service -> servlet -> jsp
scenario 2: jsp accesses data.xml, read the contents, store it in string object and then pass the xml string to servlet -> web service -> servlet and finally return the response as object to jsp (not xml, not string, but object).
which is better?
First you determine , how are you going to read the XML file ? If the file is in some machine where you application deployed in another machine , then you should need to upload the file to your application , then you start reading the file for further process. Any scenario you should need to upload file to server , where it will read from specified path and then connect to webservice send the data, after processing done get the response return back to JSP.