Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
Web Methods returning something else than XML?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.webservices.


Jonas Dygd
I have noticed that it's possible to do this:

[WebMethod]
public string SomethingElseThanXML()
{
Context.Response.ContentType = "text/plain";
Context.Response.Write("yadda yadda");
Context.Response.Flush();
Context.Response.End();
return "bla"; // this is never returned
}

Now, this could be useful for me because I would like a method that returns
a picture file,
and I see no reason to code it down to XML. I would be able to link to the
method straight from my homepage, client-side in the IMG tag.

What I really want to do is if the WSDL specification allows for this, to
specify a method that returns something else than XML.
If so, how can I do it?

Reply to this message...
Vote that this is a GOOD answer...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
Christian Weyer
Jonas,

Web Services are due to be XML based. That means that they are
conforming to a specification about how to exchange RPC values or
messages between communicating parties. In the case of ASP.NET XML Web
Services this spec is the SOAP spec (WSDL is related).

So Web Services are about SOAP, SOAP is about XML ... period.
If you want to transfer an image through a WebMethod then you have to
encode it, right. If you do not want to use XML then I assume you really
do not need Web Services, do you?

Just my thoughts ...

Christian
---------------------------------
.NET XML Web Services Repertory
http://www.xmlwebservices.cc/
---------------------------------

Jonas Dygd wrote:

[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
    
Jonas Dygd
"Christian Weyer" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Well, I do not believe that the solution to all problems is to code
everything and their mother down into XML. There are data that doesn't make
sense (or isn't very optimal) to convert into XML, but might still make
sense to have on a web service.

Now, no problem. I can make an ASP page that generates the picture, but it
would have been sweet to have it as a web method. I just thought maybe there
was a syntax for converting the resulting file into a byte array or
something, or even just simply mark it up to indicate that it cannot be
called the standard way, so standard SOAP clients ignore it.
XML is nice for simple data structures, but when it comes to arrays it's a
pain. The argument for using XML in the first place is that it's supposed to
be a simple way to represent data. Base 64 encoding doesn't exactly make a
byte array easier to understand, not to mention it increases the data size
by 15% or something.

[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Christophe Lauer
Hi Jonas,

"Jonas Dygd" <Click here to reveal e-mail address> wrote in message
news:#YsqiEJiBHA.2436@tkmsftngp07...

<CUT/>

> Now, this could be useful for me because I would like a method that
returns
[Original message clipped]

I wouldn't do it this way.

You can Base64 encode your image. You can zip your binary content on the fly
and then Base64 encode this zipped blob. You can zip + Base64 encode your
image, and then cache your WebService output ( play with
WebMethodAttribute.BufferResponse and WebMethodAttribute.CacheDuration to
enhance performances ).

Or may be you can drop your heavy binary image format and switch to XML
based 2D image formats like VML or SVG, depending on your needs and where
the image contents come from ?

HTH,
CL

Reply to this message...
Vote that this is a GOOD answer...
 
Email Archiving and Email Filing - what’s the difference?
Web-based task/todo list management
 
    
Michael Giagnocavo
You might want to look at remoting. This way, you can get binary encoding, which beats the hell out of XML for performance.

You'll loose cross-platform interop that way...

-Mike

"Jonas Dygd" <Click here to reveal e-mail address> wrote in message news:#YsqiEJiBHA.2436@tkmsftngp07...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Open source windows
The Law Society’s guidelines on e-mail management
 
 
System.Runtime.Remoting.Contexts.Context
System.Web.Services.WebMethodAttribute
System.Web.Services.WebService




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734