I have created and registered a web service. Now I wish to make a simple web app to access the web service. I used axis2 for the web service server. the client is provided with the data to be processed by the web service in the form of xml format file (data.xml). My jsp form has a textbox (to provide the location of the data.xml) and an "invoke" button that will access call the web service. I assume the jsp will first send the request to servlet and then the servlet will be the one responsible to call the web service.
lets say the web service is hosted in PC1, the web apps server that will access the web service is in PC2. I have the data.xml in PC3, so I will open the internet browser in PC3, access the jsp from PC2 which will then "invoke" the web service.
1. What's the syntax to call web service from servlet? I wonder if the axis2 is usable in the client side.
2. how do I construct the SOAP request (I assume the SOAP request is constructed in the servlet)? hopefully I don't need to construct the SOAP request string by string.
3. regarding data.xml, I assume jsp will upload the file to servlet, so the servlet will receive a file as parameter. Is this the correct way?
0: You do NOT write the web service client in JSP, you write the client as a support class that can be tested outside the servlet/jsp environment.
1. Syntax is the same no matter where the client lives of course - nothing migic here. Note that if you want the request thread to carry out the SOAP client call to the service you better provide for all the possible things that can go wrong. See - 0 about testing outside the servlet environment first.
2. You can have traditional SOAP client tools build a SOAP request, but it will be MUCH simpler to have a stored template into which you insert current variable values (I guarantee it).