I've written a CF10 RESTful web service that accepts a POST from a third party. The POST comes in with successfully with proper headers showing that it's content-type is application/json and content-encoding is gzip.
The body however comes in like this
??VJ.-.??M-?LQ?R22?0W?Q??Os-????b??????_?ZT??175 ????T?E???r??KKJ??3??S]A?@u??%??`?f??FJ???`?
The issue is that in the receiving function the cfargument
for body
is set to type="string"
when really what it should be is type="binary"
. Unfortunately setting the type to binary causes the call to fail. The calling server receives the following:
Notification response HTTP/1.1 500 Internal Server Error Content-Length: 41 Content-Type: text/plain Server: Microsoft-IIS/7.5 CF_TOMCAT_REUSE_THIS_CONNECTION: FALSE X-Powered-By: ASP.NET Date: Thu, 30 May 2013 19:53:17 GMT Connection: close
{"Message":"Variable BODY is undefined."}
I have no control of the third party call to my REST endpoint.
Does anyone have any ideas that would allow my REST endpoint to receive this gzipped (binary) body? Alternatively, does anyone know how to convert the string representation back into a gzip'd binary that can then be inflated and I can then recover the json packet?
My code looks like this:
<cffunction name="trigger" access="remote" returntype="string" httpmethod="POST">
<cfargument name="body" type="any" >
<cfargument name="Length" type="String" restArgsource="Header" restargname="Content-Length" >
<cfargument name="Type" type="String" restArgsource="Header" restargname="Content-Type">
<cfargument name="Encoding" type="String" restArgsource="Header" restargname="Content-Encoding" >
<cfset var result = "HTTP/1.1 200 OK" >
<!--- Do some processing here --->
<cfreturn result>
</cffunction>
Thank you all in advance.