473,385 Members | 1,753 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,385 software developers and data experts.

returning a picture from a webservice

Hi,

I was wondering if it is possible to code a webservice that returns a
picture?
If so, How?

Thanks in advance, Ohad
Nov 23 '05 #1
7 7465
Perhaps try converting the image to a base64Encoded string in the web
service?

Not sure if this is the best mechanism, but I've used it before to encode
binary data at it seems to work.

HTH

Glenn

"Ohad Young" <oh****@bgumail.bgu.ac.il> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Hi,

I was wondering if it is possible to code a webservice that returns a
picture?
If so, How?

Thanks in advance, Ohad

Nov 23 '05 #2
You can use WSE + DIME Attachments:

http://msdn.microsoft.com/library/de...1271d9d5a7.asp
http://msdn.microsoft.com/library/de...ml/wsedime.asp

I think that's a better way to attach data than using
base64encoded strings..

Denny

Perhaps try converting the image to a base64Encoded string in the web
service?

Not sure if this is the best mechanism, but I've used it before to encode
binary data at it seems to work.

HTH

Glenn

"Ohad Young" <oh****@bgumail.bgu.ac.il> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Hi,

I was wondering if it is possible to code a webservice that returns a
picture?
If so, How?

Thanks in advance, Ohad


Nov 23 '05 #3
If its a small bitmap
1. Convert it to a byte array.
2. Send over wire.
3. Desearialize from a byte array.

If its a big bitmap use WSE Attachments.
Current implementation of WSE uses DIME (which would be replaced in the
future by MTOM)

"Ohad Young" wrote:
Hi,

I was wondering if it is possible to code a webservice that returns a
picture?
If so, How?

Thanks in advance, Ohad

Nov 23 '05 #4
Hi all,

Thank you all for your quick response.
Since the pictures are small bitmaps, the most suitable option is the
byte array conversion.
Where can I find a code example for it?

Thanks again, Ohad

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 23 '05 #5
Thanks for the info, I'll take a look.

Glenn
"Denny Britz" <zo*******@web.de> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
You can use WSE + DIME Attachments:

http://msdn.microsoft.com/library/de...us/wse/html/6d
65ea5f-eb78-41bc-8964-df1271d9d5a7.asp http://msdn.microsoft.com/library/de...us/dnwse/html/
wsedime.asp
I think that's a better way to attach data than using
base64encoded strings..

Denny

Perhaps try converting the image to a base64Encoded string in the web
service?

Not sure if this is the best mechanism, but I've used it before to encode binary data at it seems to work.

HTH

Glenn

"Ohad Young" <oh****@bgumail.bgu.ac.il> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Hi,

I was wondering if it is possible to code a webservice that returns a
picture?
If so, How?

Thanks in advance, Ohad


Nov 23 '05 #6
On Server:
[WebMethod]
public byte[] GetBitmap()
{
Bitmap bitmap = new Bitmap(@"c:\picture.bmp");
MemoryStream stream = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, bitmap);
return stream.ToArray();
}

On Client:
Bitmap GetBitmap()
{
localhost.BitmapService service = new BitmapService();
byte[] rawBitmap = service.GetBitmap();
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream(rawBitmap);
return (Bitmap) formatter.Deserialize(stream);
}
Raj Tripathi
Nov 23 '05 #7
Hi Raj,

Thanks for the code example.
I'll try it :)

Ohad

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 23 '05 #8

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

Similar topics

1
by: Karuppasamy | last post by:
H I have a WebService calling a Method in a Remote Object. The Remote method Returns an Object. This Webservice also returns the same object. All things are working fine when this Web Service is...
0
by: ksams | last post by:
Hi Hope this mail finds you in the best of health and in good sprit. I have a problem with Web Service in a Windows 2000 Advanced Serve Machine. I have a WebService calling a Method in a...
0
by: Sharon | last post by:
Hi all I have this web service function returning XML document Everytime i change something in the function / function signature I regenerate the web service obj by deleting and adding new...
11
by: Andy | last post by:
Make the story short, I have a VB.NET client interface calling .NET webservice, written in VB.NET as well. I am trying to make the client as thin as possible so I let the webservice part to...
6
by: rlcavebmg | last post by:
I am new to Web Services and .NET development, and I have a question. I am writing a service that will create a bitmap image and return it to the client. First, I wrote a method that looked like...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
4
by: Daniel | last post by:
I've been asking around and reading but I cannot find a definitive answer. I have customers that need information from our calendar application. The data will come from SQL Server 2000. The...
2
by: Asim Qazi | last post by:
Hi All public class MyResponse { public bool m_bStatus; public string m_szErrorCode; public string m_szMessage; }
1
by: Ronchese | last post by:
Helllo. I need to return a XML from my WebService, but I'm not getting the result as a XML. I mean, instead of receiveing a tag (<xyy></xyz>), I'm receiving it encoded (with &lt; or &gt;). There is...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.