Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Web Service and flowable subform

Avatar

Former Community Member
Hi,



I call a web service in my form to retrieve some fields.

I retrieve a list of users (login ,name, email etc ...).



I want when I click on the button that all the fields appear in a table.



I try to drag and drop the connection body to the form design. It create me a table in a flowable subform with an overflowleader and fields that look well. In the binding tab I check that Repeat is check but when I click on the form there is only one row fill in.



Thanks for the help :)



Edit : the form is an interactive pdf form.



For example the web service return me 4 users.

If I click on the button only the first user data creating a row.

If I fill 4 in the repeat min box, the 4 rows with data appear but I can specify this value, it depends on what the users choice.



I try to add script in the button :



MyNodeToRepeat.instanceManager.addInstance(0);



but I need to click 4 times on the button.
23 Replies

Avatar

Former Community Member
I add this script in the request button : <br /><br />var i = xfa.connectionSet.Connexionauxdonnées.nodes.length;<br />for(var j=0;j<i-1;j++){<br /> this.resolveNode("requeteFilsResponse.result.liste").instanceManager.addInstance(0);<br /> }<br /><br />but I think it isn't the way to do this. <br /><br />It works but I have a empty row before I click on the button (the repeat min box is fill to 1, if don't check the box it doesn't work )

Avatar

Former Community Member
Hi,



var i = xfa.connectionSet.Connexionauxdonnées.nodes.length; just give me the nodes number under Connexionauxdonnées but what I want is the number of nodes returned by the call to the web service.



How can I have that ?



Thanks

Avatar

Former Community Member
I try a different way but I still have problems :(



SOAP.wireDump = true;

var oListURL = "http://par-f-pwxp-2115:8080/InfoBis/ServiceWebSfrBis?wsdl";

var service = SOAP.connect(oListURL);

var e;

try

{

xfa.host.messageBox("Starting list retrieval.");

var service = SOAP.connect(oListURL);

if(typeof service != "object") {

xfa.host.messageBox("Couldn't get List object.");

}

if(service.requeteFils == "undefined") {

xfa.host.messageBox("Couldn't get requeteFils Call.");

}

// Start the query

var name = 'myname';

var oItems = service.requeteFils(name);

xfa.host.messageBox('oItems'+oItems);

if(oItems == null) {

xfa.host.messageBox("List empty.");

}



...



My oItems variable has always the undefined value. However if the web service return me value if I use it by drag and drop it directly on the form.



Any ideas ?



I just want to know the number of Items returned. :(

Avatar

Former Community Member
I change the code to work with document/literal web service. I can see the result in the console and my data are there in a xml format.<br /><br />In that statement : <br /><br />var oItems = service.requeteFils(name);<br /><br />The result is load in the variable oItems ? Therefore, the variable oItems is an Xml variable ?<br /><br />Edit: I can retrieve the number of node by this statement : <br /><br />var nfils = oItems[0].soapValue[0].soapValue.length;<br /><br />then I call my instancemanager on my repeatable subform :<br /><br />for(var j=0;j<nfils-1;j++){<br />this.resolveNode("Liste.Repete.Tableau").instanceManager.addInstance(0);<br /> }<br />xfa.connectionSet.connectionFils.execute(0);<br /><br />and execute the webservice again. It works but I call the web service twice which is not very well.<br /><br />How can I do better ?<br /><br />Thanks a lot.

Avatar

Former Community Member
Scripting should not be necessary. Check to make sure you're saving as a dynamic pdf and make sure the "Re-merge Form Data" option is selected on the button properties (Object inspector, Execute tab). Also note that doc/lit is the only supported operation type.

If you want to add some script for debugging purposes, you might find it helpful to use the saveXML() method in the postExecute event and throw the output into a text field.

e.g.



Avatar

Former Community Member
Hi again,



What I want to do is when I click on a button a web service is call with in input a name present in a textfield and in output a list of persons depending on this name.



In my table, I put the informations of this person in a column and opposite of that the informations of the persons present in the list.



It works the first time I click on the button.



But if I click again with a different name, no new rows are created but the old data are replaced by the new ones. It make sense for me but I don't know how to solve this problem.



Do I need to save the data with script and to fill my table after ?

Avatar

Former Community Member
So, if I understand you correctly, the field that you're binding to the web service request is not part of the table. You want to be able to change the value of that field and call the web service multiple times. Each time a call is made the response is added to a new row in the table. Is that correct?



Ernest

Adobe Systems

Avatar

Former Community Member
Hi,



Actually, I have a table with three columns and four rows.

My webservice's response is a list of users containing four informations for each user (login, name, email and division). Each information is binding to one case of the second column.



For example if the list is :



first response



User1 = apink, alex pink, apink@..., 5

User2 = tblue, tony blue, tblue@..., 5



My table will look like this :



column one | column two | column three



apink

alex pink

apink@...

5

----------------------------------------------

tblue

tony blue

tblue@...

5

-----------------------------------------------



which is what i want. But I want that if I call the web service again with a different parameter a new table will be created and the old will be still here like this :



second response



User1 = kvarsen, Kyle varsen, kvarsen@..., 5

User2 = someone, some one, sone@..., 5



column one | column two | column three



apink

alex pink

apink@...

5

----------------------------------------------

tblue

tony blue

tblue@...

5

-----------------------------------------------

column one | column two | column three



kvarsen

kyle varsen

kvarsen@...

5

----------------------------------------------

someone

some one

sone@...

5

-----------------------------------------------



I hope to have been clear.



Thanks for your help

Avatar

Former Community Member
No Ideas ?



For the data merging, the execute button works fine and if we want to script the click event, use a normal button and add xfa.connectionSet.dataconnection.execute(1) in place of execute(0) make the same result and allows to script other things.



But I still don't know how to don't lose the result of a previous call of my web service when a call is made again.



All suggestion will be appreciated :)



Thanks again

Avatar

Former Community Member
I found a solution.

But I need script a lot.



On the click event of my button, I call the web service with the soaprequest, then I take the data from the result, add an instance of my table and fill my field for each user( nameresponse with name etc ..).



I will do like that for the moment. Is there a simple way to do this ?

Avatar

Former Community Member
I make my solution and it works fine.

I have an little problem when I use my form in a process : a prompt security message appears on the screen and the user must click yes or no. But I don't want this prompt appears, I look for a solution in the acrobat Javascript but I found nothing.



Any ideas ?

Avatar

Former Community Member
If it's the "Acrobat is attempting to connect to ... If you trust the site, choose Allow..." security warning, then it's not easily bypassed because end users need to be aware of potential "phone home" security threats. The dialog does include a "remember my action" option so that it will not appear on subsequent web service calls.



Another option would be to certify the doc and then on each client you would need trust the certificate for high privilege javascript.



Ernest

Adobe Systems

Avatar

Former Community Member
Yes, it is. When I check the "remember my action" box, the submit button doesn't work anymore.



What do you mean by " to certify the doc" ? I have 2500 users, if I need to do it manually for each one it'll be complicated.



Why when I use the web service without scripting the security warning doesn't appears ?



Thanks for helping me and thanks Paul to.

Avatar

Former Community Member
Certifying the document means applying a digital ID. This only needs to be done once for the document. But in order to avoid the message on the user's machine, you would need adjust the certificate trust settings on all 2500 clients -- not a very good option.



Whether the web service is called through script or not should have no effect on the warning. It should always appear. Also, checking the box should not cause the submit to stop working. Can you send a copy of your form and the wsdl file to dev_info@adobe.com? I wouldn't mind taking a look at it.



Ernest

Adobe Systems

Avatar

Former Community Member
Hi,



I sent you my form and the wsdl file to dev_info@adobe.com. Thanks.

Avatar

Former Community Member
Hello Jerome,



I've had a very quick look at your form. I see a number of changes to the script in the Submit button, but nothing that would cause it to stop working. Is this form intended for use as part of a LiveCycle process?



When I click the requeteUneBtn, which doesn't use script, I'm presented with a security warning. What version of Acrobat are you using?



And this is completely unrelated to your problems, but I did notice that both drop-down fields have a huge number of StyleID processing instructions in the XML Source. This is likely due to a copy/paste bug in an older version of Designer. If you want to clean them up, you can change the Appearance property (in the Object inspector) to something other than "Sunken Box" and then change it back again.



Ernest

Adobe Systems

Avatar

Former Community Member
Hello,



Thanks to have look at my form.



I use Acrobat 9 Pro, Designer ES v8.2 but I don't remember if I created the form with the 9.1 version.



Yes, this form is intended to use as part of a LiveCycle process.

When I click on a Web Service button who doesn't have script, I have no security warning.



When I preview my form in Designer ES, I have no security warning at all even with the script.



I didn't notice the StyleID problems, Thanks a lot.



Now my web services are developped in java with netbeans and deployed under Jboss. I was told about making webservices using workbench and the short-lived process.

It will allow me to have a cleaner script using xpath expressions and it was easier to develop. Is this kind of Webservices secure ? And could it resolve my problem ?



Thanks again to have taking time to help me :)

Avatar

Former Community Member
If you selected the "remember my action" box and clicked "Yes" then you won't see the security warning again.



I believe your remaining issue is that the submit doesn't work. Is that correct? As a test, try adding another submit button to your form but don't change any of the scripting. Does the second button work when you click it in Acrobat?



Ernest

Adobe Systems