Processing Web Service Data

bsaustin98

30-07-2018

All,

I'm new to Adobe Forms development and I've run into a roadblock. I'm connecting to a web service I've created to populate data into a form. The form is for internal use only and only using Acrobat Reader with Extensions. I've followed several articles I've found to make progress but I've got one problem I haven't been able to overcome yet.

I connect a drop down list to the web service to populate the list. When an item is selected from that list, I call the web service again to retrieve to more data values and populate two more fields in my form. This all works great and as described. The problem is that these fields are part of a repeating table. When a new line is added to the table and new value is selected from the drop down list on that line, all secondary values in the table change as well. So the drop down list choice on line two not only populates the data lookup values for line two, but it also overwrites the values on line one.

I've found articles that talk about using a postExecute event handler to process the web service data. I've tried using this to manually load the data instead of using the automatic mapping. But I never seem to be able to access the web service response the way the articles indicate I should be able to. I'm hoping someone can point me in the right direction for how to resolve this. Is postExecute the way to fix my issue? if not, what's the best approach?

This is the article I followed to setup the automatic mapping:

http://forms.stefcameron.com/2007/05/21/connecting-to-a-web-service/

This is the best article I've found on the postExecute event:

Populate a listbox from a web service

Thanks!

Barry

Accepted Solutions (1)

Accepted Solutions (1)

kjaeggin

Employee

31-07-2018

it should follow this strucuture near the bottom of the object:

   <event activity="postExecute" ref="$xfa.connectionSet.CityQuery" name="event__postExecute">

    <script contentType="application/x-javascript">

            console.println(xfa.datasets.saveXML("pretty"));  //better to use console.println() as it might be too large a string for a message box.

   </script>

   </event>

</subform>

</subform>

Answers (10)

Answers (10)

Jared_Langdon

01-08-2018

Barry,

I was able to reproduce what you described.  I resolved the problem without any preExecute or postExecute scripts.  Don't include the bound fields in your repeating subform. Instead, leave the bound fields elsewhere in the form and hide them in a hidden subform (exclude from layout).  When you need to invoke the service, programatically copy the input value(s) from your repeating subform fields to the hidden input field(s) that are bound to the web service.  Then programatically invoke the service.  Then copy the values from the bound/hidden output fields to the fields in the repeating subform.  I have an example that illustrates this, but I don't know how to upload it here.

Jared

kjaeggin

Employee

31-07-2018

I don't believe the syntax has changed, but you still need to add the postExecute() event in the XML Source, as it is still not exposed in the UI (as the article describes).

if there is a syntax issue, I would recommend opening a support ticket in our daycare portal (https://daycare.day.com/home.html), but we would need a mockup sample that mimics your form contacting that webservice, so we could assist with the troubleshooting. 

bsaustin98

31-07-2018

That's the article I'm trying to follow. The problem is that I don't see any data when the postExecute event fires. When I try to access it, it doesn't seem like I've received a response. But I know the web service works and I know I can receive a response in the form. It's specifically in accessing the response data in the postExecute event that I need help. Has the syntax for accessing that data changed since that article was published?

kjaeggin

Employee

31-07-2018

what is the binding described in your table, or repeating subform? you may want to review this article posted here as it describes in detail how you might be able to reformat the data using the postExecute() event:

Populate a listbox from a web service

The trick will be to capture the data first the moment in time after it is executed, and see what is being returned using a technique similar to the following:

<event activity="postExecute" 
       ref="xfa.connectionSet.CityQuery"

       name="event__postExecute">

  <script contentType="application/x-javascript">

    console.println(xfa.datasets.saveXML("pretty"));

  </script>

</event>

without being able to see your form and the wsdl definition, it will be difficult to give you specific feedback, but it may be that the data being returned and bound to the table is not being correctly mapped. you can use the postExecute() event as shown in this article to perhaps get the data in the correct structure for the table.

bsaustin98

31-07-2018

Yes. I've verified the web service is working. I can map directly to the fields but the repeating table cause previous entries to get overwritten.

bsaustin98

30-07-2018

I'm afraid I can't post the whole form. Security policy here won't allow it. Is there a piece you specifically want to look at? I might be able to post a code fragment or screenshot.