I'm currently looking at the best way to upload an image to my existing WCF Json service, the service then saves the image to a folder on the server. Is it as simple as streaming the image? Or is there a different practice if you are using json?
Ultimately ill be sending an image from a mobile device to the service.
Found a good code over this place.
Have a look. It should cater your need. The code has both client and server implementation
MSDN
You could use ajaxForm or ajaxSubmit from http://www.malsup.com/jquery/form/
We used it to call an MVC action with our data, but had to use the iframe fallback option due to IE having issues with ajax and file inputs.
For a mobile site I would expect this to be useful.
For a mobile app I would expect it to be more a case of streaming the image as you would any other type of file.
Related
I created some chrome extension that detects a file download event and cancel the download, and gets the download link. Sends the link to myserver.
I want to create a server that recive link to download, download the file, do some manipulation on the file and sends the file back to client.
All the time I developed client side apps (Mainly with c#), and I don't know what to choose for the server side, WCF App or Web API (or something else). the server can be inside the organisation or remote.
What do you think should I pick? any suggestions?
It seems that creating Restful-style services may be more appropriate for this scenario.
You know, both WCF and Asp.net WebAPI can create Restful-style services. WCF could take advantage of the Webhttpbinding to create it.
As for handling file uploads and downloads, I don't think there is any difference between the two techniques. Perhaps the services created by Asp.net WebAPI are a little more mature, such as the ability to deal with form-data stream (multipart/form-data) directly. While WCF service could not directly process the form-data stream.
Here is an example of an upload and download in Asp.net WebAPI.
https://learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/sending-html-form-data-part-2
How to return a file (FileContentResult) in ASP.NET WebAPI
Feel free to let me know if there is anything I can help with.
I am helping to build Elpis, which is an open source pandora music player, built with C# and WPF.
Now what i want is to add an HTTP API so that the user may control the program through a browser, like play/pause, like/dislike the current song.
The point afterwards is to control the program through a mobile device accessing the HTTP API.
How exactly should i build the HTTP API so that it can control it?
Github for the project: https://github.com/adammhaile/Elpis
Without knowing why exactly you want the user to control a GUI application via the browser, it's hard to give you good advise.
Assuming you are running your GUI on Windows, take a look at OWIN and the project Katana. They allow you to easily host HTTP interfaces in your own application.
It may be overkill for your project but I would suggest using ASP.NET Web API so that you can build backend web services.
The easiest way to do what you want, assuming you really want to "control the GUI remotely" is to just install TeamViewer on your PC and on your mobile device. Then you could remote in and completely control your GUI.
But I what I think you're after is something more like Google Music. Where you can stream your music through the Internet and onto your mobile devices. If this is the case, I recommend you look at the ASP.NET Web API.
It's not hard to build a web server in C#. You can embed it into your application, and expose parts of your application to HTTP endpoints as an API. You can use the HttpListener class which is part of .NET, and do everything from the ground up yourself. Or you could use something like Nancy, which is a lightweight framework that provides a lot of useful scaffolding like URL routing.
Ended up using Kayak(https://github.com/kayak/kayak) for my self-hosted API.
The example of integration can be seen here:
https://github.com/adammhaile/Elpis/blob/master/Elpis/WebInterface.cs
I want to create an wp7 application that converts the URL to PDF document. I want to use the joliprint.com service for my app. I created a textbox(named as textBox1)for URL's and button(named as button1)for submitting the URL's. Can anybody help me with this or can anybody provide me some samples or examples for this. Thanks in advance for your help!
Run Fiddler and manually make a request using your browser. From the information that Fiddler gathers, you should be able to identify the query format. You are looking for the HTTP verb (GET, etc.) and the URL format (http://website.com/process.aspx?url=URLSUBMITTED). Once you have this, you can make an HTTPWebRequest from your app.
You should probably make sure that what you are doing isn't against the terms of use of the website. There may be a reason they don't have a published API... Asking permission is best, especially if the you expect to be making lots of calls to this site.
I recently got a requirement to develop a new web service, and I'm not entirely sure how to approach it.
I'm familiar with normal WCF web services, where the url is something like
http://server/site/Service.svc/SomeMethod
that you can post XML/JSON to.
The new service is supposed to accept an HTML file post, where the content type is
multipart/form-data
From what I understand, the form contains fields, one of which contains a bunch of XML data which I want to parse. I will then respond by posting my own similar html file to a remote location.
I'm not completely sure how to begin with this.
A WCF Service of some kind?
ASMX?
Or even an actual ASPX page that the client will post to?
You can use an .asmx file to create a web service and can use it through aspx pages
Could someone please tell me/link me to how I could create a method similar to those posted below:
http://www.vimeo.com/api/docs/upload
http://www.flickr.com/services/api/upload.api.html
(I am providing the links as I'm not sure how to articulate this question without them!)
I'm using C# ASP.NET. IIS 6.
I have an existing web server with other public API methods. I do not want the iPhone user to have to open a web browser, and post to an aspx page. I want the iPhone developer to be able to call my method, and have one of the parameters be a handle to the file which gets POSTed.
Thanks in advance for any help.
You'll need to create a WCF Service Application. You can use this as a webservice that can be exposed to your clients. You can create a RESTful service using WCF where clients can POST video's to.
When searching for 'REST, API, WCF' you'll probably find all the resources you are looking for.