
yoqtan
New User
Nov 15, 2010, 8:20 AM
Post #1 of 1
(468 views)
|
|
writing an image file from a soap answer
|
Can't Post
|
|
Hello, I'm trying to create a web client exchanging information with a soap server. Everything was going well until the server sent me an image. I'd like to save the image into a file, but am unable to do so. I can retrieve my image from the soap response and put it into a string, but I don't know how to decode it so it makes a readable image file. When doing the following :
for my $attachment (@{$report->{attachmentlist}}){ open ATTFILE, ">$recnum/".$attachment->{'m-strFileName'}; binmode ATTFILE; my $imgSoap = $soap->getDefectAttachment($cookie,$attachment->{'m-strArchiveName'}); my $att = $imgSoap->{'m-pFileData'}; print ATTFILE $att; } I get something in my file (when opened with a text reader), that looks like :
/9j/4AAQSkZJRgABAQEAYABgAAD /4QBmRXhpZgAASUkqAAgAAAAEABoBBQABAAAAPgAAABsBB QABAAAARgAAACgBAwABAAAAAgAAADEBAgAQAAAATgAAAAA AAABgAAAAAQAAAGAAAAABAAAAUGFpbnQuTkVUIHYzLjEwAP / ...and so on. I also tried something like :
my $att = $imgSoap->{'m-pFileData'}; for my $char (split(//, $att)){ print ATTFILE pack('C', $char); } without results. Would you have any idea how to decode this image ? Thank you for your help !
|