473,473 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to generate GIF iamge in ASP from web service ?

I am struggling for long time to display a GIF file on an ASP page. I
have tried to return a GIF file in few formats
from a webservice.
Webservice returns the images as MemoryStream.GetBuffer(). Its an
array of unsigned bytes.I also tried to return it
in base64 encoded format.

I can call this webservice in either of 2 ways

1) Directly from ASP -- It returns me this ..

JFIF``C    $.'
",#(7),01444'9=82<.342C 
2!!222222222222222222222222222222222222222222222 22222(("
ĵ}!1A
Qa"q2#BR$3br
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz '"" 
ĵw!1
AQaq"2B #3Rbr
$4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvw xyz'""
?p2zW'R XV}BNzSӛW
4kGd)}/.t-nhC=b=Az"v=l
Foh)Ҁlf-܎ܜs/*
p99Qfχsj[͌{Gq[<Őh
'>Ɯr1g/b*W@w#ۧ>"Vv[#"
, Os Ek sF"'Ul'$JI@?ǣ+sT8'e `#G]D
mOs> ;44vR4Ɏ@
*J":0:U*CuoKKuouE2̧R#I3 "f

2) From VB(again I am returning byte array) which inturn is called by
ASP -- I get the
same junk as above.

I need to convert it as a GIF file in my ASP page.
Can you guys suggest how it could by achived. I am open to change code
at any layer.

Note - I am not getting any file back from VB or Web service. I am
only getting it in some encoded format(byte array
or base64)

My ASP code is like this -

<%@ LANGUAGE="VBSCRIPT"%>
<% Response.Expires = 0
Response.Buffer = True
Response.clear
Response.contenttype = "image/gif"
Response.AddHeader "content-disposition", "inline; filename=MyMap.gif"

Set myEXE = CreateObject("ExFireSafeMapInfoTool.MapInfo")
varGetImage = myEXE.GenerateMapForHousehold()
RESPONSE.BinaryWrite (varGetImage)

'Value of varGetImage -- Same as Above Junk I get in ASP (Dont know
what format is this?)
%>

My VB Component function is something like this -

Public Function GenerateMapForHousehold() As Variant

Dim szFileName As String
Dim oSOAP As New SoapClient30 'Soap Type Library 3
Dim bytImage() As Byte
Dim szPicture As String
Dim iCount As Integer
Dim File As Integer
File = FreeFile

'Make the Call to Web Service to retrive the Image.
oSOAP.ClientProperty("ServerHTTPRequest") = True
oSOAP.MSSoapInit "http://localhost/WebService1/GetImage.asmx?WSDL"
bytImage = oSOAP.GetImage("bayshore.gif")
GenerateMapForHousehold3A = bytImage

'I can retreive this image in VB using this code -
'szPicture = App.Path & "\Test.gif"
'Open szPicture For Binary As File
'For iCount = LBound(bytImage) To UBound(bytImage) - 1
' Put #1, , bytImage(iCount)
'Next
'Close #1
'GenerateMapForHousehold = szPicture
'Set Form1.imgTest.Picture = LoadPicture(GenerateMapForHousehold)

End function

And web service(c#) method is something like this-

using System.IO;
using System.Drawing.Imaging;
public byte[] GetImage(string strFileName)
{
StreamWriter sr;
Byte sIn = new Byte();
Image MyImage;
MemoryStream MemStr = new MemoryStream();
MyImage = new Bitmap(Server.MapPath( strFileName));
MyImage.Save(MemStr, ImageFormat.Jpeg);
return MemStr.GetBuffer();
//I have 1 more function to return base64 encoded string but dont
know how to use it further.

}

Please help.
Thanks
Mohit
e mail - mo*****@hotmail.com
Jul 17 '05 #1
1 3783
On 12 May 2004 08:33:00 -0700, mohit wrote:
I am struggling for long time to display a GIF file on an ASP page. I
have tried to return a GIF file in few formats
from a webservice.
Webservice returns the images as MemoryStream.GetBuffer(). Its an
array of unsigned bytes.I also tried to return it
in base64 encoded format.


Learn how to crosspost. See also my response in comp.lang.basic.misc.
--
auric underscore underscore at hotmail dot com
*****
WMD? WTF!
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mitch | last post by:
generate-id() appears to break in XSL transformations after installing Microsoft .NET Framework 1.1 Service Pack 1 or Visual Studio 2005 Beta. I have found several references to this searching the...
1
by: Alexander Kaplunov | last post by:
I have a web service, which has a reference to a class. I want to be able to accept this class as a parameter to my web service method. When the consumer consumes the web service, proxy class is...
2
by: Delmar | last post by:
I need to build Web Application that will generate a client to execute some operations. Each client has running silent application. Maybe somebody can advice me what can I do ? Thank you.
2
by: John | last post by:
I already have an existing WSDL file and want to generate C# proxy code and C# test client using Visual Studio .NET 2003 with Framework Version 1.1. I firsted created ASP.NET web service, and...
3
by: Haxan | last post by:
Hi, I need to consume a web service, but have only been given the http address e.g. "http://placea/xyz.COM:8080/myprog1". I would like to generate a wsdl and use it to reference this web...
5
by: =?Utf-8?B?a3Jpcw==?= | last post by:
I created a simple webservice .asmx on Visual Studio 2005. As I plan to deploy it to Sharepoint Portal 2003, I copied asmx to \web server extensions\60\ISAPI directory of the server, where all...
1
by: Martin Plechsmid | last post by:
Hello, (After investigating my real problem) I've got a C# web service containing a single method: public MyBDO Test() { return null; }
0
by: shruthid | last post by:
can we generate a class for the following xsd file?? it does'nt contain a complex type.. <?xml version="1.0" encoding="UTF-8" ?> <xs:schema...
1
by: shruthid | last post by:
can we generate a class for the following xsd file using xsd.exe?? it does'nt contain a complex type.. <?xml version="1.0" encoding="UTF-8" ?> <xs:schema...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.