CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
writing an image file from a soap answer

 



yoqtan
New User

Nov 15, 2010, 8:20 AM

Post #1 of 1 (626 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 :

Code
		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 :

Code
/9j/4AAQSkZJRgABAQEAYABgAAD 
/4QBmRXhpZgAASUkqAAgAAAAEABoBBQABAAAAPgAAABsBB
QABAAAARgAAACgBAwABAAAAAgAAADEBAgAQAAAATgAAAAA
AAABgAAAAAQAAAGAAAAABAAAAUGFpbnQuTkVUIHYzLjEwAP
/

...and so on.

I also tried something like :

Code
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 !

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives