What the best way of passing images over a soap server?
I'm using WCF 4.0 and flex for my front end.
I cannot say if this is the best, but I have used Base64 encoding to send binary data as XML within SOAP as well as AMQP. Worked well for what I needed, but YMMV.
Related
I've got a SSL connection working with my website alongside PHP sessions. I have created my own connection class to provide a single sign on, allowing my user to then interface with php script outputs from my website. I have a question though, currently I use my PHP scripts which query the database and formats the data into a HTML page, which my program then reads over the SSL connection. My program has to parse the data which may be slow for large data volumes. My question is:
without having to radically change my system architecture, is there a way to make passing the data between the server and the C# application more efficient. Currently I'm using string delimiter parsing to extract data in a way similar to command seperated values (CSR).
I've heard the word JSON passed around alot, but I think I might as well use XML instead.
SERVER: MySQL, PHP, APACHE
Thanks
Thomas
What you want to research is c# web applications and a SOA architecture. JSON or SOAP will be the transfer protocol on which your PHP will talk to your C#. What you will need to do if you decide to use soap is make a c# web service as an endpoint between your PHP and your database and the c# will talk to the DB and pass the data to the PHP. you may want to look into caching as well but that's only if you need scalablity. One thing that is nice about PHP 5 is that it has a built in method to talk to the soap protocal which just turns it into an array of values passed from your C# it makes it very easy to do. What your going to need to happen with your PHP is you will need to replace the SQL querys with SOAP connections. One more thing to consider is a WCF service because webservices have been "deprecated" in anything above .net 3.5. Hopefully it shouldn't be too painful
http://php.net/manual/en/class.soapclient.php
Scroll down a little on this page it has some good examples for your calls.
JSON is suppose to be a quicker protocol then SOAP I just do not have alot of experience with it myself.
Handling data in a PHP JSON Object
SOA the main concept apply to c# as well
http://www.javaworld.com/javaworld/jw-06-2005/jw-0613-soa.html
I am not 100% sure about c# and mysql connections I am sure there is stuff out there for it. I think the biggest problem you may have is hosting a C# service on an apache server.
Maybe check into using JAVA web services, I know it works well with apache and mysql and is used by alot of major websites.
Can REST web service (which usually produces e.g. simple JSONs) both handle and return big binary input/output data?
I mean, to call a REST service by a HTTP POST providing big file and afterwards reading the big result back? Is REST ok for that? ("Big" = few megabytes)
With text serializers such as JSON and XML you would get about 33% increase of the size of the files over the wire as the binary data needs to be Base64 encoded. There are more optimized protocols such as MTOM to handle this scenario. WCF supports MTOM out of the box.
REST architectures are quite capable of using HTTP to serve up application/octet-stream, which is just a stream of bytes. HTTP can quite reliably serve very large files.
Since REST is primarily a service over HTTP, standard advantages and limitations of HTTP apply to REST services too. You can send large files of few MBs as POST to REST API in a way similar that one uploads a large file to a web app.
I am working on a web service interface, where my WCF application works both as a Client and a Service. There are multiple Java clients that need to connect to my web service. I will need to accept stream of images and documents and send back stream of converted images.
I would also need to connect to other Java services to send the image streams as a payload to be stored in a database. I am new to web services, is there good documentation on how to enable streaming contracts between WCF and Java clients and vice verse.
If I want to return other information along with the stream of (group) images to the client, how would I do that? Like the size of each image, the offset in the stream, so they can separate images.
Thanks
In order to return additional information with your images you will need to define a DataContract which contains the metadata elements as well as a collection to contain your images. Perhaps representing your image collection as a byte array rather than just returning a raw stream of images? There are several ways to address the issue, however the best solution depends on your design requirements.
My application consists of a WCF web service and a silverlight client. I need to transfer data on the order of GBs. Is it possible to send compressed data so that it can be uncompressed by the client when it is received? What classes can I make use for this?
I never had to use it but maybe you should take a look at SharpZipLib (An open source dll for compression)
Here's also 3 links about WCF compression:
http://bloggingabout.net/blogs/ramon/archive/2008/11/06/wcf-and-http-gzip-deflate-compression-and-silverlight.aspx
http://weblogs.asp.net/cibrax/archive/2006/03/29/441398.aspx
http://frenk.wordpress.com/2009/11/08/gzip-compression-between-wcf-web-service-and-silverlight/
I was wondering if it's possible to create an application in C# to streaming video to a php client. Someone out there have already try such thing or can indicate where to find resources to do that?
What do you mean by a PHP client?
Last time I checked, PHP was a PURE server side technology, and the "client" is a web browser that does not care about what the server uses but interprets the PHP output which are essentially strings in HTML and JavaScript.
So, what you want to achieve having a video decoded on the server? Send them as JPG images to the client?
You just take the reference of this link. You will get the idea to resolve your problem.
UDP Streaming transfer from C# application to PHP webpage