Showing posts with label services. Show all posts
Showing posts with label services. Show all posts

Wednesday, March 28, 2012

profileservice newbie question

Do the callbacks return before the Sys.Services.ProfileService.save() returns ?

Sys.Services.ProfileService.save(['myProperty'], onSaveCompleted, onProfileServiceFailed,null);

In otherwords, when Sys.Services.ProfileService.save() returns, can I assume the property is saved (barring no error occured)? or do I specifically need to wait for onSaveCompleted()

Since this is an asynchronous call, Sys.Services.ProfileService.save() will return immediatelybefore the save code on the server gets executed.

So you cannot assume that the property is saved before onSaveCompleted() is fired
because there could be errors on the server during processing in which case onProfileServiceFailed() will be fired.


Thanks! That is what I suspected but wanted confirmation.

Monday, March 26, 2012

proxy and authentication services

Hi All,

I'am testing some features of AJAX Library and also the services that they offer. I have a question about this service. where does this service run and how do i point it to my SQL database where my users are stored. i think in the web.config but show some code please.

Kind regards,

Well i read some info from another thread.and saw that you can use your own webservice. So i want to use my own webservice, but in this example its pointing to a webservice only and not his method. How does this work? how do you configure it to go to the right login method. Thanks in advance

Yes, you can use your own authentication Web service.
You configure the path to your own Web service like it's shown in this link:http://ajax.asp.net/docs/mref/595cde79-7340-40f0-ba08-2efaff3d4d0c.aspx

Your web service needs two methods Login and Logout:

using System.Web.Services;
using Microsoft.Web.Script.Services;

[ScriptService]
public class MyAuthenticationService : System.Web.Services.WebService
{
[WebMethod]
public bool Login(string userName,
string password,bool createPersistentCookie)
{
//Place code here.
return true;
}

[WebMethod]
public void Logout()
{
//Place code here.
}
}

This same code will be shown in the next release of the documentation.

Hope this helps,

MaĆ­ra


Hi Maira,

Thanks for your reply. So the only thing thats left to do is changing the path of your authentication service?

Kind regards,


Besides that, you need to enable the authentication service in the configuration file. (I don't know if you already did)


Hi Maira,

Yes i already enabled the authentication service in my configuration file. thanks for your info

Regards

Saturday, March 24, 2012

Question about AJAX and WCF duplex services

OK, I have some existing WCF services that are working with a thick client download, but now we are trying to add a web front end option. I was able to get the one way services working easily by adding a web service page as a simple wrapper around the WCF calls. Now I need to look at our services that are duplex though. Is there a way to do this with the AJAX libraries that are out now? If not, is there a timeframe for when Microsoft might release the next preview that has WCF functionality added back in? And how stable was the older release that still had WCF functionality? Would it work with the release version of WCF?No unfortunately, ASP.NET AJAX has no support for WCF yet. It will be available in future versions. You can use POX to call WCF services but that will be one way and in that case you also should not have a service contract in your WCF service.
Well, if anyone else is caught in a situation like this in the interim, I found a pretty good workaround, at least for my situation. I actually wrote a second WCF service that acts as an aggregator of the first one. The new service only exposes plain http web services, so I can call it no problem from the AJAX code. The aggregator gets the duplex messages from the main server, so it updates in its memory in real time, and then the web page just polls it every few seconds for updates. It's not perfect, but it does what I need for now.

question about CascadingDropDown

Hi!

I've started to learn AJAX technology recently and I have such questions about using CDDL:

1. Is it only possible to use it with web services? How could I adopt my present bunch "DDL-ObjectDatasource" ?

2.I've discovered that by simply putting set of my dropdownlists into UpdatePanel makes them to work without pagepostback. Than another question appears - if it works with default AJAX mechanism, why was CascadingDropDown extender invented? What is its particular destination or distinct functionality that it provides?

No ideas or no one faced the same?

1) You need to use WebServices. The interface is simple to use with an existing datasource though. Just query the data and create the value list. It's super-flextible for whatever data-access mechanism you're using. See the walkthrough in the SampleWebSite for an example. CCD isn't a straight databinding, it's a dynamic databinding based on a the values of the parent drop down.

2) The postback isn't the issue. You're still getting a post-back inside the UpdatePanel, it's just not affecting the whole page. The issue with the CCD is the linking of several dropdowns to navigate through a virtual tree of possible values.

Question about generated proxies

I'm looking at the following example where all of the functions calling web services use a common call back function.

http://www.asp.net/AJAX/Documentation/Live/ViewSample.aspx?sref=Sys.Net.WebServiceGenerics/cs/generics.js

I can see how organization might be a little better using the call back function and a switch statement, but are there performance benefits? Which would have better performance, individual call back functions or the all in one version? Are there any other benefits or detriments between the two?

thanks

Nick

There is no performance benifits in using a common callback. You can use the Common Callback when you have to process similar kind of logic for more than one web service call result.