Expand my Community achievements bar.

Question about web service and timeouts

Avatar

Former Community Member

I have a form with a button script that invokes a synchronous soap web service request to an address validation service. It works nicely in testing but I am a bit concerned at what might happen when we go live with respect to the form hanging if the soap server is unavailable or the user is offline.

From some simple tests in production, where the web service is available yet:

     - in Windows, it times out in Adobe Reader 10.1.1 within about 15 seconds; and

     - In the Mac, with Adobe Reader 10.1.3 it takes around 4 1/2 minutes.

The latter is not good, as it hangs Reader the entire time.

Is there some way I can set a timeout in the soap request. Would it be worth considering an async call? If I changed it to async, could I let the user continue to fill the form and then setFocus with an async flag?

9 Replies

Avatar

Level 2

Hi,

   You can solve this problem using 'Get' function of formcalc.  You can use the 'Get' within the docready event of one button, then handle the exception using javascript function in an interactive field.

Thanks,

Arjun

Avatar

Former Community Member

Hi Arjun,

Thanks for the quick reply. It sounds like a simple solution but I dont quite understand it, probably because I've never used Formcalc or the docReady event of a button.

Do you mean call the http GET, using the URL of the web service. Then if it gives an exception, tell the user that it is not available, otherwise, ignore response from get and then call the web service?

Gordon

Avatar

Level 2

Hi Gordon,

   Thats correct. Just check it out. It should work, because Get function will give an XML response if the web service is up. Otherwise it will give a Null response or a 'Unknown Host' response.

Thanks,

Arjun

Avatar

Former Community Member

Hi,

I'm almost there. I dont think that you can do exception handling in FormCalc. How do I trap the error. So far I have

if (HasValue(Get("http://despaiqo001.development.local:4001/crossdomain.xml")) == 0) then

     $xfa.host.messageBox("not available")

else

    $xfa.host.messageBox("got it")

endif

but when I change the URL so it cant access it, I get a form calc exception. Any samples of how I can script it?

Avatar

Level 2

Hi,

   In order to handle the formcalc exception, you have to call click event of submit button. Its a wierd thing, but no other go. Take the  value of Get function in a textField like, 

txtFld1 = Get(http://despaiqo001.development.local:4001/crossdomain.xml);  (Use FormCalc)

Then, to check the validity of that value, check the value of txtFld1 in another textField and in exception case, call click event of submit button. Dont give any URL in the submit button.

Use JavaScript

txtFld2 = txtFld1.rawValue;

if( null != txtFld2.rawValue )

  app.alert("Got it");

else

  submit.execEvent("click");

Regards,

Arjun

Avatar

Level 2

I guess you have unknowingly clicked your answer as correct. 

Avatar

Former Community Member

there's still something i obviously dont get. The http submit button doesnt have a click event, so I have put the Get into the preSubmit event. I invoke the http Submit button with execEvent("click") . However, if I put in an invalid URL in the Get parameter i still get the Reader "Script failed (language is formcalc..." exception message.

Avatar

Level 3

Though this is an old post, I have almost the same problem:

Use JavaScript

txtFld2 = txtFld1.rawValue;

if( null != txtFld2.rawValue )

  app.alert("Got it");

else

  submit.execEvent("click");

I disable the network, and it's popping up "Script failed (language is formcalc..." exception message. And then it pops up "not available".

Any idea how to disable the failure message?