What would be the web service equivalent of this HTTP request?
<cfhttp url="https://secure-devsite/pur-loader/ws/ppur_v0.cfc" method="post" multipart="yes"> <cfhttpparam name="authentication" value="xxxxxxxxxxxxxxxx" type="formfield"> <cfhttpparam name="ppurfile" file="#expandPath('ppur-test.xml')#" type="file"> <cfhttpparam name="method" value="dataSubmit" type="url"> </cfhttp> <cfoutput>#htmlEditFormat(cfhttp.FileContent)#</cfoutput>
<cffunction name="dataSubmit" access="remote" output="no" returntype="xml"> <cfargument name="authentication" type="string" required="yes" hint="authentication value"> <cfargument name="ppurFile" type="string" required="yes" hint="file upload field"> <cfset var dataResult = ""> <cfset var rootpath = getDirectoryFromPath(getCurrentTemplatePath())> <cfset path = replace(rootpath,"htdocs/pur-loader/ws/","uploadedFiles/ppur/","ONE")> <cffile action="upload" filefield="ppurFile" destination="#path#" nameconflict="overwrite"> <cfset var validate = xmlValidate(cffile.serverDirectory & '/' & cffile.serverFile,replace(rootpath,'/ws/','/schema/ppur-data-transmission.xsd','ONE'))> ... </cffunction>
I.E. How would one pass a 'file' to a web service? Or can you only pass the content of the file as a string? Which is differernt and apparently does not work for what we are trying to do. When I did that, we would start getting 'java heap out of memory' errors dealing with the quanty of content we need to pass to this web service.
To clarify, is there a way to pass a file reference through a web service object that can be used in a <cffile action="upload"...> tag in the <cffunction...> block?
You can only ever pass file *content* to a webservice. A remote CF box cannot see a file on your local PC or any machine other than one connected over a network.
Http isn't great for sending large files, things like ftp are used for that purpose.
How big is the file you're trying to send?
76.8 MB is the file I am using for testing purposes. This file represents a top 5% of the largest amount of data we expect to receive by this web service. This test file works well with the HTTP. But we first tried as a direct web service receiving the data as a stream. That caused the Jave Heap Out Of Memory errors.
I was just wondering if there was a web service version of the http code, where the file will be uploaded the same way. Looks like that is not the case.
I.E. something like this:
<cfset ws = createObject("webservice","url.webservice.wsdl")> <cfset ws.dataSubmit(AuthCode,file)>
Where the file is uploaded, not just sent as content.
How would you use FTP with a tie in to futher processing by CFML code once the file is received?
This is for B2B [really G2G -- Government (county) to Government (state)]. We are recieving data that will be processed and a reply will be returned to their system.