Custom validation using web service in silverlight - c#

I am trying to validate a textbox input (in Silverlight) using validation annotations with custom validator which is supposed to validate input on a server side. My problem is that web service call is asynchronous, so I can't return a validation result since validation method is sync on the client side.
Can anyone help me with that?

You should look into INotifyDataErrorInfo. This allows asynchronous validation.
Here are some links that may be helpful:
http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/11/18/silverlight-4-rough-notes-binding-with-inotifydataerrorinfo.aspx
http://weblogs.asp.net/fredriknormen/archive/2009/11/22/silverlight-4-and-asynchronous-validation-with-inotifydataerrorinfo.aspx

Whether the web service is implemented asynchronously should not have any effect on the client as far as I know. For the client it will call the web service and wait for a response. If the response does not come on time, there will be a time out. It should not matter whether the web service executes asynchronously.

Related

Convert REST API to websocket client

I have existing C# web api, I want to convert it into websocket base API.
Where user can subscribe to the end point and then I can post data to user from some other service.
How can I implement this? Any guidlines will be great help.
I have tried doing it with websocket handler but it just send data by making call inside the controller method. I want to be able to push data from other service once the user subscribed to the websocket API end point.
ok, I created websoket hub and then added authorization on it where needed. Works fine as per what I wanted.
still if anyone has better solution, please suggest.

How to implement a Webhook listener using c#?

I want to implement a web listener to grab the posted array data from the webhook url.
I have came across two ways to do this.
1. using IHttpHandler to handle the http request.
2. using wcf rest webservice to grab the request.
I also found that this can be done using a HttpListener but was unable to find a proper sample implementation.
Can anyone suggest the best way to do the above task and provide some references where I use to start the implementation.
Thank you.
A webhook URL is not different than any other incoming HTTP request that you receive. You can use whatever mechanism you want for that.
If you are already using ASP.NET MVC then this is the best choice. If not you have the choice between adding MVC to the project or adding an HTTP handler.
HTTP handlers are a bit rough and inconvenient to use. I'd opt for MVC if there is no specific reason for not doing that.
HttpListener does not apply at all here. You don't need to open a port (and in the context of ASP.NET you can't do that reliably anyway because multiple instances of your app might run at the same time during recycles).

Kendo DataSource using Web API and signalR for realtime communication

I've built a REST API using web api 2 for handling the CRUD of my grid, this works fine. I'm trying to now implement SignalR for real time updates (doing something similar as described here Can I incorporate both SignalR and a RESTful API?) and it would appear that you MUST use the hubs for all server side operations when using a Kendo DataSource. I've been searching for some kind of example or documentation that allows for you to possibly use a REST API for CRUD but still allow the client to subscribe to a hub that will push data in real time when something happens with the data.
My question - Is this possible with the Kendo DataSource and if so how?
I am following the documentation here http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-transport.signalr for configuring SignalR on the client. Basically though what I would like to do is override the transport.signalr.server configs so that it keep talking to my REST API and just let the client subscribe to the hub so it can receive data in real time. Kendo's documentation is so sparse I can't tell if this is just not possible or if I'm missing something however.

Calling web service without using a post back

I need to call a cross domain web service (.asmx) via a page within an asp.net application. The user will type in a search query in which the app will send off to the web service, then the page will be updated with the data.
My question is how might I do this without postbacks? As I am just trying to retrieve data rather than entering or manipulating it.
My attempted solutions:
1. Ajax via jquery -> issue: CORS is not supported.
2. serviceReference (for client side services calls) but this is only for a local (on domain) service
3. Lastly I am trying to use updatepanel where the value from a textbox is used in querying the web service however this is obviously forcing a partial postback, is there a way to have the update panel use a get req instead? If not, how might I go about doing this because I am stuck! Lastly would this solution be easier if an ASP MVC structure? I am learning. Thanks.
Create an ashx handler which queries the remote service based on parameters handed by ajax.
Use an ajax-request to the ashx handler to call your proxy via jQuery AJAX.
Or just use the Yahoo YQL proxy:
Is there a free JSON proxy server which supports CORS or JSONP?
Or if the web-service supports JSONP, you can use JSONP directly.
If you need to create a proxy yourself, here is how:
http://www.codeproject.com/Articles/25218/Fast-Scalable-Streaming-AJAX-Proxy-continuously-de

Self-hosted WCF within Windows Service

I would like to know, if I need to generate client proxy for self-hosted WCF within Windows Form?
Basically what I'm trying to do is, post Html form to WCF operation. I have checked WCFClientTest to validate that my WCF get picked up including its operations, which it does.
But when I try to post data to Operation, I get Error 400 Bad Request.
Thanks,

Categories

Resources