473,396 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

exposing method sending bitmap

Hi,

I would like to have a web service method sending a bitmap image. But code
like do not work:
<WebMethod()_
Public Function GetBitmap() As Drawing.Bitmap
Dim a As New Drawing.Bitmap("1.bmp", False)
Return a
End Function

When I test my web serwice I receive:

<?xml version="1.0" encoding="utf-8" ?>
- <Bitmap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<Palette />
</Bitmap>

<Paletteis empty, but image I try to send is a 100x100 pixels.

Any help?

Thanks.
Przemo
Dec 16 '06 #1
2 2341
Have you tried Base-64 encoding the contents of the bitmap to a string and
sending that across the wire?
I suspect that a Bitmap was not intended as the result from a webservice
method call.

Andrew

"Przemo" <Pr****@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.com...
Hi,

I would like to have a web service method sending a bitmap image. But code
like do not work:
<WebMethod()_
Public Function GetBitmap() As Drawing.Bitmap
Dim a As New Drawing.Bitmap("1.bmp", False)
Return a
End Function

When I test my web serwice I receive:

<?xml version="1.0" encoding="utf-8" ?>
- <Bitmap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<Palette />
</Bitmap>

<Paletteis empty, but image I try to send is a 100x100 pixels.

Any help?

Thanks.
Przemo

Dec 18 '06 #2
In the .NET framework there is a Convert class which will convert a byte
array to a base64 string. I think the function is something like
Convert.ToBase64String.
The image data is then safe to return from the webservice as a string. The
client would then have to decode the base64 string back into a byte array, i
think using Convert.FromBase64String (if client is using .NET).

I can't remember off the top of my head how to convert a bitmap to a byte
array and then convert a byte array to a bitmap, but i think it's
straightforward.

Hope this helps,
Andrew
"Przemo" <Pr****@discussions.microsoft.comwrote in message
news:47**********************************@microsof t.com...
no, I havn't
How to encode such a content for Base-64? Can it be switched in web
service?

"Andrew Brook" wrote:
>Have you tried Base-64 encoding the contents of the bitmap to a string
and
sending that across the wire?
I suspect that a Bitmap was not intended as the result from a webservice
method call.

Andrew

"Przemo" <Pr****@discussions.microsoft.comwrote in message
news:A7**********************************@microso ft.com...
Hi,

I would like to have a web service method sending a bitmap image. But
code
like do not work:
<WebMethod()_
Public Function GetBitmap() As Drawing.Bitmap
Dim a As New Drawing.Bitmap("1.bmp", False)
Return a
End Function

When I test my web serwice I receive:

<?xml version="1.0" encoding="utf-8" ?>
- <Bitmap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://tempuri.org/">
<Palette />
</Bitmap>

<Paletteis empty, but image I try to send is a 100x100 pixels.

Any help?

Thanks.
Przemo



Dec 18 '06 #3

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

Similar topics

2
by: Polo | last post by:
Hi I have a abstract class and some other than inherite from it I woul like to return a bitmap (defined in resource) from the each subclass (a bitmap that is global (static)) Thank's in...
8
by: TJ | last post by:
I need to be able to pass a pointer to a (managed code) Stream object to a COM method so it can serialize its data into the stream. I have a C# application that makes uses of Randolf Duke's...
0
by: Learner Net via .NET 247 | last post by:
(Type your message here) What I am trying to do is create a bit map image from scatch using the managed C++ LockBits method. I want to display the bit map as a result of a button click. I have...
6
by: Juan Romero | last post by:
Hey guys, I am trying to send an image through a TCP connection. What is the best way to accomplish this? Thank you.
0
by: Symon | last post by:
Hi everyone, I'm writing a webservice where I'm trying to expose a framework that contains a number of classes which have read-only properties. I want to expose data-transfer proxies of these...
4
by: Julien Jorge | last post by:
Hi, I have a compilation-time error on the specialization of a method from a imbricated template class, and I can't figure why. The problematic part of the code is resumed below. The error occurs...
4
by: david | last post by:
hello, I have a client/server application. the server capture picture from webcam and send it to every client connected to it.the network part works good and the capture from webcam too. I...
1
by: deric | last post by:
Hi! I'm new to VB.net programming on printing a page to a thermal printer (Epson T88IV). I really had a hard time figuring out how to code the printing of a bitmap image and some text, while sending...
4
by: =?Utf-8?B?Y2hyaXNjYXA=?= | last post by:
I tried searching the forums for this already and didn't find anything. I want to expose functionality from a vb6 COM component via a WCF service. I am trying to evaluate if exposing this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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 project—planning, coding, testing,...

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.