Docusign API with ColdFusion retrieve PDF - documents/combined - coldfusion

I am trying to retrieve the signed documents from Docusign - and save the PDF file locally.
I have tried multiple ways to attempt to extract the PDF out of the returned cfhttp data.
Seems I can get the correct number of pages in the PDF document I download - but they view as all blank with messages of invalid signature.
My guess is that I am not parsing multiple PDF files from the filecontent in the returned cfhttp variable but not finding how to do this anywhere.
My current code is similar to:
<cfhttp url="https://demo.docusign.net/restapi/v2/accounts/#variables.ACCOUNT#/envelopes/#url.ENVELOPE_ID#/documents/combined" method="GET" resolveurl="Yes" throwonerror="No" result="MY_INFO">
<cfhttpparam name="X-DocuSign-Authentication" type="HEADER" value="<DocuSignCredentials><Username>#variables.userName#</Username><Password>#variables.password#</Password><IntegratorKey>#variables.integratorKey#</IntegratorKey></DocuSignCredentials>">
<cfhttpparam name="Content-Type" type="HEADER" value="application/json">
<cfhttpparam name="Accept" type="HEADER" value="application/json">
</cfhttp>
<cffile action="write" file="D:\Inetpub\Wwwroot\docusign\completed\mypdf.pdf" output="#TRIM(MY_INFO.FileContent)#">

Following up here, based on your comments you've solved this:
"Instead of trying to write the file via the cffile - i added
path="D:\Inetpub\Wwwroot\docusign\completed\" file="#variables.FILE_NAME#"
to the cfhttp call"

Related

How to get yahoo weather information using coldfusion

I am a newbie coldfusion developer.
And I want to get yahoo weather information using coldfusion.
So I made a cfm file like this.
<cfset theURL = "https://weather-ydn-yql.media.yahoo.com/forecastrss?location=sunnyvale,ca">
<cfhttp url="#theURL#" charset="utf-8" method="post">
<cfhttpparam type="formfield" name="appid" value="2a0Lkq6k">
<cfhttpparam type="formfield" name="context" value="dj0yJmk9MkxEcTlzVDNucE5hJnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PWMx">
<cfhttpparam type="formfield" name="query" value="madonna">
</cfhttp>
And I got a error like this.
Your call to Yahoo Web Services returned an unexpected HTTP status of: 401
I have rich experience in laravel, django or so.
But I don't know coldfusion as well as yahoo weather api.
How can I fix this and get the result?

ColdFusion CFHTTPPARAM Content-Type?

I am attempting to upload a file to the dropbox api using cfhttp. I am getting an error from Dropbox stating the Content-Type is incorrect:
Bad HTTP "Content-Type" header:
"application/octet-stream,multipart/form-data;
boundary=-----------------------------7d0d117230764". Expecting one of
"application/octet-stream", "text/plain; charset=dropbox-cors-hack".
It appears to me that ColdFusion is appending multipart.form-data to the content type I defined in the cfhttpparam header. I am not sure how to prevent this. I am using the code below:
<cfhttp method="post" url="https://content.dropboxapi.com/2/files/upload" result="uploadFile" multipart="no">
<cfhttpparam type="header" name="Authorization" value="Bearer #DropboxAccessToken#">
<cfhttpparam type="header" name="Dropbox-API-Arg" value="#serializeJSON(stFields)#">
<cfhttpparam type="header" name="Dropbox-API-Select-User" value="#DropboxMemberID#">
<cfhttpparam type="header" name="Content-Type" value="application/octet-stream">
<cfhttpparam type="file" name="1_1036.gif" file="C:\1_1036.gif">
</cfhttp>
Any ideas on what could be going on?
The "multipart/form-data" is probably added automatically because type="file" is used. If the API is expecting content type "application/octet-stream", that suggests it expects file data to be uploaded through the http request body, rather than as a named "file" field. Instead of type="file" try using:
<cfhttpparam type="body" value="#FileReadBinary('C:\1_1036.gif')#">

ColdFusion Dropbox - Error in call to API function

I am trying to used Dropbox API from ColdFusion and I am running some simple tests to understand how it works. I am trying to list all the folders from my Dropbox account and I am using this piece of code:
<cfset jsonCall = StructNew()>
<cfset jsonCall.path = "Shared">
<cfhttp url="https://api.dropboxapi.com/2/files/list_folder" method="post">
<cfhttpparam type="header" name="Authorization" value="Bearer LXldZbIAwawAAAAAAAAYUHqCbBQjBPfoWybyRrhivVViX7qq2x8oPK45QZ5WZkGr"/>
<cfhttpparam type="header" name="Content-Type" value="application/json">
<cfhttpparam type="body" value="#serializeJSON(jsonCall)#">
</cfhttp>
Of course, the TOKEN is not real.
And I am getting the following error from Dropbox:
Error in call to API function "files/list_folder": request body:
unknown field 'PATH'
Can anyone help me with this error?

How to fix "faultString: [Virtuoso SOAP server] There is no such procedure" Webservice cfinvoke CF11?

I am getting the following error when invoking the web service with the <cfinvoke> tag using ColdFusion 11.
faultString: [Virtuoso SOAP server] There is no such procedure
I have passed all of the correct arguments to the method (respecting argument names case).
Calling code
<cfinvoke Webservice="absolute link" method="method name" wsversion="1" refreshwsdl="true">
<cfinvokeargument name="paramone" value="valone">
<cfinvokeargument name="paramtwo" value="valtwo">
</cfinvoke>
Thanks in advance for your help.
I've found the solution. For some reasons, the use of the cfinvoke tag does not work for consuming their web service.
I've used the cfhttp tag as an alternative and added an header parameter called "SOAPAction" and sets it to a specific value which I cannot share here. Also the action attribute needed to be set to "POST".
The final workaround code is the following (where wsRequest variable is the xml to be sent):
<cfhttp method="post" url="#application.WSDLEndpoint#">
<cfhttpparam type="header" name="content-type" value="text/xml">
<cfhttpparam type="header" name="SOAPAction" value="[specific absolute link]">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="xml" value="#wsRequest#" >
</cfhttp>

CFHTTP Content-Length Header for post to Google Voice "API"

Greetings.
I'm trying to send a quick sms through google voice using their existing API. I think the api is what's left from the Grand Central days. They don't have much documentation. Here's where I got my documentation: http://posttopic.com/topic/google-voice-add-on-development
I can authenticate using cfhttp and get the correct response. Then I can get the "_rnr_se" value that is required for request from a google voice command.
When I send over the number, message, and required values (Authorization and _rnr_se), I get a "content-length" is required message from google. But since this is a dynamic post with different form fields, not a file, I'm not sure what to post as the content-length.
If I just put some arbitrary value like "1000" for the content-length, the request just sits there and I never get a response. If I put something like "0" or "500" it comes back with a 500 - "Internal Server Error".
Any ideas on how to get the correct value for content-length before I post?
<cffunction name="submitSMS">
<cfhttp url="https://www.google.com/voice/sms/send/" method="post">
<cfhttpparam type="header" name="Content-Length" value="???">
<cfhttpparam type="header" name="Authorization" value="GoogleLogin auth=#SESSION.GoogleAuth#">
<cfhttpparam name="id" value="" type="formfield">
<cfhttpparam name="phoneNumber" value="+1#params.number#" type="formfield">
<cfhttpparam name="text" value="#params.smsMessage#" type="formfield">
<cfhttpparam name="_rnr_se" value="#SESSION.rnr#" type="formfield">
</cfhttp>
<cfdump var="#cfhttp.FileContent#"><cfabort>
</cffunction>
The better way to do this is to just use the google voice java class here:
http://google-voice-java.googlecode.com