Sidebar

Can I set a web service connection to try again rather than throw an error?

0 votes
561 views
asked May 24, 2016 by marc-m-9513 (570 points)
commented May 24, 2016 by marc-m-9513 (570 points)
Thanks, I wasn't sure where to put the try/catch, but wouldn't your example below still throw an error? Depending on how busy the HISP is, it may take 3-4 tries before it is able to go through.

1 Answer

0 votes
 
Best answer

This is accomplished by wrapping the call to the webservice with a try/catch.

Here is a code sample.

var parameterMap = qie.newParameterMap();
var soapEnvelope = qie.evaluateTemplate("<?xml version='1.0' encoding='UTF-8'?>\n" +
   "<soapenv:Envelope>\n" +
   "   <soapenv:Header>\n" +
   "   </soapenv:Header>\n" +
   "   <soapenv:Body>\n" +
   "   </soapenv:Body>\n" +
   "</soapenv:Envelope>", parameterMap, "xml", qie.getWsEndpointUrl("wsdl test"));
 
var value;
try {
   value = qie.callSOAPWebService(
      "wsdl test",
      "XDS_soap12_binding",
      "ProvideAndRegisterDocumentSetRequest",
      soapEnvelope,
      false,
      parameterMap,
      60000);
} catch (err) {
   try {
      value = qie.callSOAPWebService(
         "wsdl test",
         "XDS_soap12_binding",
         "ProvideAndRegisterDocumentSetRequest",
         soapEnvelope,
         false,
         parameterMap,
         60000);
   } catch (err1) {
      throw err1;
   }
}
 
answered May 24, 2016 by brandon-w-8204 (33,270 points)
...