0

i am working on big web application which is developed in java, using jsf framework, running on jboss server.

I face a problem: I have a function in which we call some soap web services. This works fine in normal situation, but sometimes, server load increase or may be server slow down, then function code run multiple time when the user makes only one request, and i don't understand why this happens.

ex. suppose in my code have 10 lines then it execute 1 to 5 and agian same code execute 1 to 5

DamCx
  • 1,047
  • 1
  • 11
  • 25
  • can you share some code snippet? – user1474111 Feb 22 '17 at 10:46
  • public String genxml(some parameters) { – shrawan tiwari Feb 22 '17 at 10:59
  • public String genxml( some parametres ) { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); // code for creating xml file // – shrawan tiwari Feb 22 '17 at 11:43
  • TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); DOMSource source = new DOMSource(docss); transformer.transform(source, result); String xmlString = sw.toString(); FileWriter fw1=new FileWriter(curfile,false); BufferedWriter bw1 = new BufferedWriter(fw1); bw1.write(xmlString); bw1.flush(); – shrawan tiwari Feb 22 '17 at 11:45
  • // then we call soap web service have another methode in diffrent class there we send created xml // bellow sample code for web service calling DecryptEcrypte ed=new DecryptEcrypte(); String ecntext=ed.encryptXML(createdxml.toString()); URL url = new URL(web service url); URLConnection connection = url.openConnection(); HttpURLConnection httpConn = (HttpURLConnection)connection; ByteArrayOutputStream bout = new ByteArrayOutputStream(); String xmlInput=" – shrawan tiwari Feb 22 '17 at 11:47
  • ---standard xml xmlInput+=""; byte[] buffer = new byte[xmlInput.length()]; buffer = xmlInput.getBytes(); bout.write(buffer); httpConn.setConnectTimeout(5000); OutputStream out = httpConn.getOutputStream(); out.write(b); out.close(); InputStreamReader isr = new InputStreamReader(httpConn.getInputStream()); BufferedReader in = new BufferedReader(isr); while ((responseString = in.readLine()) != null) { outputString = outputString + responseString; } – shrawan tiwari Feb 22 '17 at 11:48
  • // then cntrol return main methode // here and web service return data into xml formate // we use some db insertion updation and redirect ot another page – shrawan tiwari Feb 22 '17 at 11:49
  • Next time please edit the question by using the 'edit' button below it – Kukeltje Feb 23 '17 at 14:54

0 Answers0