java - Why did my application stop connecting using HTTP, and how can I debug it? -


i have program includes http connection plm application runs on sql server. program scheduled run daily. collects data few sources, issues query plm store data, , reads plm's reply verify if data stored.

the application ran ok, until upgraded both db (into sql server 2012) , plm.

since upgrade, when program establishes connection receives ok status; however, data setting query not affect data base, , there no answer received. there no error messages - malfunction.

my major question - how debug it. know whet send , receive. how can more data on happens in between?

i attach code review. didn't add here query itself, wml-like string. plm should fire answer regardless query receives, if error message. however, null.

public boolean amlarascommunication (string data , int targetdbtype, string password) {         final string url = "http://plm-srv/innovatorserver/server/innovatorserver2012.aspx";         final string schemeurl = "'http://schemas.xmlsoap.org/soap/envelope/'";         string answer =””;         string database = data base name;         writer wout;         httpurlconnection amlconnection = null;          try          { // instantiate httpurlconnection url object - new connection  // opened every time calling openconnection method of protocol  // handler url. point connection opened.             amlconnection = (httpurlconnection) new url(url).openconnection();             amlconnection.setdooutput(true);             amlconnection.setdoinput(true);             amlconnection.setrequestmethod("post");             amlconnection.setrequestproperty("soapaction", "applyaml");             amlconnection.setconnecttimeout(10000);             amlconnection.setreadtimeout(10000);             amlconnection.setrequestproperty("authuser", "admin");             amlconnection.setrequestproperty("authpassword", calcmd5(password));             amlconnection.setrequestproperty("database", database);              string query = "<?xml version='1.0'?>\r\n" +                  "<soap-env:envelope xmlns:soap-env=" + schemeurl + ">\r\n" +                  "  <soap-env:body>\r\n" +                  data  +                  "  </soap-env:body>\r\n" +                  "</soap-env:envelope>\r\n";  // instantiate outputstreamwriter using output stream, returned getoutputstream, writes // connection. if i/o error occurs while creating output stream, ioexception fired.             wout = new outputstreamwriter(amlconnection.getoutputstream());             wout.write (query);             wout.close();  // @ point, we've sent data. outputstream closed, while connection still open             int result;             if ((result = amlconnection.getresponsecode()) == httpurlconnection.http_ok)             { // communication results plm                 inputstream ac = amlconnection.getinputstream();                 inputstreamreader isr = new inputstreamreader (ac);                 bufferedreader in = new bufferedreader(isr);                 string readresult = in.readline ();                 int count = 0;                 while (readresult != null)                 {                     answer += readresult + "\n";                     readresult = in.readline ();                     count++;                 }                 in.close();                 if (answer.contains("fault"))                     system.out.println ("error message: " + answer + "\nquery: " + query);                 else                      log.message ("lines count=" + count + "; com status=" + result + "; reply: " + answer, false);             }             else  // error code returned, or no status code returned, stuff in else block                 system.out.println("connection failed following code: " + result);         }         catch (ioexception e) { ; }          if (amlconnection != null)             amlconnection.disconnect ();         return true; } 

i think have log files of plm application find out why not http response. there might number of possible reasons why application not working anymore after upgrade.

i guess difficult debug problem based on client code only. server seems accept http, expect event , errors written log file somewhere. might want try graphical tool soap ui test soap service.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -