[Catalyst] determine MIME type of binary Webservice result?
Carl Johnstone
catalyst at fadetoblack.me.uk
Tue Jan 19 14:32:22 GMT 2010
Jens Schwarz wrote:
> in my Catalyst application I use Webservices to connect to SAP. One
> of these returns "binary" data (right now base64-encoded XML, later
> also PDF).
>
> Is it possible to determine the MIME type of those returned
> (sub)strings? If so, how?
It doesn't matter that you're using Catalyst for this problem.
Your first question should be whether SAP actually returns the data/MIME
type as part of it's response to your request. If so crib it from there.
If not, you could save the binary data to a file and run some form of
file-type/magic number detection. If you're running in a unix environment
you might find the "file" command useful for this.
Carl
More information about the Catalyst
mailing list