Hi,
I've used JavaScript and SOAP with "regular Acrobat" (e.g. Acroforms) to connect to a SOAP server, followed by Acrobat automatically setting up functions that I can call from JavaScript that, courtesy of SOAP, are relayed to the SOAP server for execution. For example, a SOAP server that implements a Temperature function. After doing the Net.SOAP.connect, my JavaScript magically has access to the Temperature() function, which is then executed remotely on the SOAP server courtesy of SOAP protocol.
My question is: With Livecycle Designer and it's XFA-based forms, do I have the same ability to programmatically connect to a SOAP server and automatically have JavaScript functions set up that I can call on the server? From what I've read, there are LC Submit and Execute operations which interact (e.g. exchange data) with a specified SOAP server, but it isn't clear that LC provides the ability to end up with a set of functions that I can call from my JavaScript that are then executed on the SOAP server.
Stated more simply: Does LiveCycle Designer have the ability to connect to a SOAP server and automatically set up JavaScript functions that I can call (that then get relayed to the SOAP server for execution, followed by the return of data to my XFA-based program)?
Thanks.
Dave
Solved! Go to Solution.
Views
Replies
Total Likes
I used same scenario in most of my forms....passing XML as input to WSDLs and getting response using SOAP....here is one example that might come handy.....
function saveToDocumentum(wfname) {
SOAP.wireDump=false;
var cWSURL = "http://servername.<domainname>.com:<portnumber>"+"/services/"+wfname+"?wsdl";//use this wisely based on WSDLURL
try {
var service = SOAP.connect(cWSURL);
}catch(e)
{
app.alert("" + e);
return null;
}
if(typeof service != "object")
{
app.alert("Couldn't connect to WS at "+cWSURL);
return null;
}
if(service.synchronousInvoke == undefined)
{
app.alert("Couldn't get synchronousInvoke operation signature");
return null;
}
var sendXML = null;
sendXML = xfa.data.saveXML();
var startAt = sendXML.indexOf("<Lwsn_SAAF");
var endAt = sendXML.indexOf("</Lwsn_SAAF");
sendXML = ""+sendXML.substring(startAt, endAt+13)
//sendXML = replaceAllSpecialChars(sendXML,"&","&");
//xfa.host.messageBox(""+sendXML);
var result = service.synchronousInvoke({inxml: sendXML}); //inxml is input variable at the WSDL end
//return resultthistime;
//app.alert(""+result);
var varma1 = result["outxml"] //outxml is the variable name on the WSDL end and this is in XML format
//app.alert(""+varma1);
xfa.host.messageBox("This request is saved to Documentum successfully.", "Status", 3, 0);
return "Success"; //submitResult;
}
Good Luck,
Views
Replies
Total Likes
I have not done what you are asking but if you were able to do it with an AcroForm script you can certainly do the same thing with an XFA form (as it runs on top of the same AcroForm architecture). You may have to modify your script slighltly but we shoudl be able to get it to work. Can you post your script here and I will see if anything jumps out at me.
Paul
I used same scenario in most of my forms....passing XML as input to WSDLs and getting response using SOAP....here is one example that might come handy.....
function saveToDocumentum(wfname) {
SOAP.wireDump=false;
var cWSURL = "http://servername.<domainname>.com:<portnumber>"+"/services/"+wfname+"?wsdl";//use this wisely based on WSDLURL
try {
var service = SOAP.connect(cWSURL);
}catch(e)
{
app.alert("" + e);
return null;
}
if(typeof service != "object")
{
app.alert("Couldn't connect to WS at "+cWSURL);
return null;
}
if(service.synchronousInvoke == undefined)
{
app.alert("Couldn't get synchronousInvoke operation signature");
return null;
}
var sendXML = null;
sendXML = xfa.data.saveXML();
var startAt = sendXML.indexOf("<Lwsn_SAAF");
var endAt = sendXML.indexOf("</Lwsn_SAAF");
sendXML = ""+sendXML.substring(startAt, endAt+13)
//sendXML = replaceAllSpecialChars(sendXML,"&","&");
//xfa.host.messageBox(""+sendXML);
var result = service.synchronousInvoke({inxml: sendXML}); //inxml is input variable at the WSDL end
//return resultthistime;
//app.alert(""+result);
var varma1 = result["outxml"] //outxml is the variable name on the WSDL end and this is in XML format
//app.alert(""+varma1);
xfa.host.messageBox("This request is saved to Documentum successfully.", "Status", 3, 0);
return "Success"; //submitResult;
}
Good Luck,
Views
Replies
Total Likes
Hi Varma_LC and pguerett,
First, thank you both for your quick responses! It sounds like I shouldn't have any trouble using XFA forms and SOAP together.
Let me ask a related question (not about LiveCycle & SOAP, but just about SOAP). I'm trying to return two values from one SOAP call. http://www.avoka.com/blog/?p=998&cpage=1#comment-1692 describes how to do this. Unfortunately, it's not working for me.
I'm able to retrieve single values from my SOAP server just fine. When I try to return two values, the Acrobat JavaScript debugger says both values are "UNDEFINED". The key part of my code is:
var IntValue = // define an int
{
soapType: "xsd:int",
soapValue: "1"
}
var NValue =
{
n1: IntValue // n1 is the parameter my SOAP server expects
}
var GetTheData = service.GetAllData(NValue); // Go get the data and populate the GetTheData object
console.println("GetTheData = " + GetTheData.CmdError + GetTheData.CmdResults);
Param_1V.value = GetTheData.CmdError; // This is a text box to display the returned value
Param_2V.value = GetTheData.CmdResults; // This is also a text box to display the returned value
Both the console.println & the two text boxes (beginning with Param) print out the same results, namely "UNDEFINED".
I ran my SOAP client and SOAP server on two different computers, and then used WireShark to look at the SOAP protocol. The SOAP protocol looks fine, and contains CmdError and CmdResults XML opening/closing tags around the actual data I'm trying to read from the SOAP server. Plus there are GetAllDataResponse and GetAllDataResult XML opening/closing tags around the data XML tags.
I'm using Acrobat 9 and I developed my SOAP server using Windows Communication Foundation (WCF) 3.5. The same JavaScript program that is unable to retrieve two values returns one value just fine (a different service... call, of course). In other words, it's being done in one program, not two separate programs. So, my singular Net.SOAP.connect call seems to be working fine.
When I do the Net.SOAP.connect, I display the returned services, and GetAllData is listed, so Acrobat JavaScript knows about this particular service.
BTW, the WCF built-in client works fine in retrieving/displaying the two returned values, correctly detecting and displaying both returned values. Of course, the WCF client may have different "rules" than Acrobat has in terms of processing SOAP messages. I've seen differences before between the WCF client and Acrobat.
Any insights either of you have or anyone else has would be *greatly* appreciated. I've never used try/catch to trap JavaScript errors, if there is some type of error I should logically be looking for, I would be interested in information on that as well.
Thanks!
Dave
Views
Replies
Total Likes
I tried running the example in the Avoka Blog I mentioned above, and it worked fine! This included talking to the SOAP server used in the example. I should have tried this first before doing the above posting. As I suspected it might possibly be, it was a problem in how my WCF-based SOAP server was configured. I can now make a call to a SOAP server from Acrobat, and it accepts multiple return values.
My apologies for the "noise" I generated. Lesson learned: If I use an example in a different context (a WCF-based SOAP server, in my case) and if it doesn't work, go back and try running the example in the exact context used by the example before concluding that something in the example might be broken/missing.
Dave
Views
Replies
Total Likes
Hey Dave,
I know it has been quite awhile but I am very new to Acrobat and am trying to do the same thing. If you are able to remember, can you tell me what the configuration issue was with your wcf service?
Thanks!
Josh
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies