I have been working on this for several days now and cannot figure it out. I am trying to create the data structure necessary to send a WSDL webservice request to EchoSign using ColdFusion. I have no problem with sending simple structures (testPing and testEchoFile work), but when I try nested structures like those required for sending a document (sendDocument) it fails saying "Web service operation sendDocument with parameters ... cannot be found. Here is one of the many attempts:
<cfset strFilePath = "#ExpandPath("tempupload/file.pdf")#" />
<cffile action="readbinary" file="#strFilePath#" variable="FileData" >
<cfscript>
apiKey = "MY_API_KEY";
documentCreationInfo = structNew();
documentCreationInfo.recipients = structNew();
documentCreationInfo.recipients.recipientInfo = arrayNew(1);
documentCreationInfo.recipients.recipientInfo[1] = structNew();
documentCreationInfo.recipients.recipientInfo[1].email = "myemail@gmail.com";
documentCreationInfo.recipients.recipientInfo[1].role = "SIGNER";
documentCreationInfo.name = "test";
documentCreationInfo.fileInfos = structNew();
documentCreationInfo.fileInfos.fileInfo = arrayNew(1);
documentCreationInfo.fileInfos.fileInfo[1] = structNew();
documentCreationInfo.fileInfos.fileInfo[1].fileName = "file.pdf";
documentCreationInfo.fileInfos.fileInfo[1].file = #FileData#;
documentCreationInfo.signatureType = "ESIGN";
documentCreationInfo.signatureFlow = "SENDER_SIGNATURE_NOT_REQUIRED";
ws = createObject("webservice", "https://secure.echosign.com/services/EchoSignDocumentService16?wsdl");
response = ws.sendDocument(apiKey = '#apiKey#', documentCreationInfo = #documentCreationInfo#);
</cfscript>
I have looked at examples using other programming languages, but that was not much help as it seems that the arrays and structures created by ColdFusion are handled differently. I want to avoid having to construct the SOAP XML. Any help would be greatly appreciated.
For clarity, here is the structure of the data that needs to be sent when using ColdFusion and communicating with EchoSign and using the sendDocument command:
<cfset strFilePath = "#ExpandPath("tempupload/file.pdf")#" />
<cffile action="readbinary" file="#strFilePath#" variable="FileData" >
<cfscript>
apiKey = "MY_API_KEY";
documentCreationInfo = structNew();
documentCreationInfo.recipients = structNew();
documentCreationInfo.recipients.recipientInfo = arrayNew(1);
documentCreationInfo.recipients.recipientInfo[1] = structNew();
documentCreationInfo.recipients.recipientInfo[1].email = "recipient@gmail.com";
documentCreationInfo.recipients.recipientInfo[1].role = "SIGNER";
documentCreationInfo.name = "test";
documentCreationInfo.fileInfos = structNew();
documentCreationInfo.fileInfos.fileInfo = arrayNew(1);
documentCreationInfo.fileInfos.fileInfo[1] = structNew();
documentCreationInfo.fileInfos.fileInfo[1].fileName = "file.pdf";
documentCreationInfo.fileInfos.fileInfo[1].file = #FileData#;
documentCreationInfo.signatureType = "ESIGN";
documentCreationInfo.signatureFlow = "SENDER_SIGNATURE_NOT_REQUIRED";
senderInfo = structNew();
senderInfo.email = "sender@gmail.com";
senderInfo.password = "password";
senderInfo.userKey = "";
ws = createObject("webservice", "https://secure.echosign.com/services/EchoSignDocumentService16?wsdl");
response = ws.sendDocument(apiKey = '#apiKey#', senderInfo = #senderInfo#, documentCreationInfo = #documentCreationInfo#);
</cfscript>
For data that can contain multiple entries, like recipients and files, the data is stored in arrays of structures. In this example, there is only one recipient, so the array recipientInfo only has one array element, recipientInfo[1], but we could easily add additional recipients just by repeating this section and using recipientInfo[2], etc. Since senderInfo cannot have multiple entries it is just a struct with elements email, password and userKey. According to the documentation, userKey will override email and password entries. To use Single Sign-On, I tried sending blank data for email, password and userKey but that did not work, I also tried just sending an empty senderInfo structure and that did not work. So my question becomes, how do I send a NULL value for senderInfo so that it defaults to the API owner?