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

Wednesday, March 28, 2012

ASP.NET AJAX Extensions vs. Professional AJAX

Hi,

I'm curious as to why Web Services and SOAP were chosen as the transport mechanisms for the ASP.NET AJAX Extensions instead of Attributes and JSON.

In Professional AJAX, you add a few lines to your web.config, apply the AjaxPro.AjaxMethod attribute to the class method you want to call from javascript, and register the class in the code behind page usingAjaxPro.Utility.RegisterTypeForAjax(). Do the ASP.NET AJAX Extensions have something similar to this?

Also,if I build equivalent codein two ASP.NET apps, one using Professional AJAX and one using the ASP.NET AJAX Extensions, the ASP.NET app using Professional AJAX, which uses JSON, sends far fewer KB back and forth.

Professional AJAX:http://www.codeplex.com/AjaxPro

thanks,

Tom

tcboring@.work:

Hi,

I'm curious as to why Web Services and SOAP were chosen as the transport mechanisms for the ASP.NET AJAX Extensions instead of Attributes and JSON.

Why do you say this? By default, Web Services used by the ASP.NET Ajax frameworkdo use JSON for data transfer.

http://msdn.microsoft.com/msdnmag/issues/07/01/ExtremeASPNET/default.aspx
http://msdn.microsoft.com/msdnmag/issues/07/02/CuttingEdge/default.aspx


tcboring@.work:

In Professional AJAX, you add a few lines to your web.config, apply the AjaxPro.AjaxMethod attribute to the class method you want to call from javascript, and register the class in the code behind page usingAjaxPro.Utility.RegisterTypeForAjax(). Do the ASP.NET AJAX Extensions have something similar to this?

The way Professional AJAX works is very similar to ASP.NET AJAX page methods.


Mike,

Thanks for the links--I just finished reading the material they point at. I honestly had no idea that JSON was used, because when I look at the HTTP traffic (using Fiddler) generated while using the ASP.NET AJAX Extensions (AAE) it all looks like good old XML to me--besides the HTML rendered by my aspx pages. I've just downloaded the latest version of AAE, and I'll take a look again--the last time I played with AAE was back in March when I decided to use the Professional AJAX library instead.

thanks,

Tom


gt1329a:

tcboring@.work:

In Professional AJAX, you add a few lines to your web.config, apply the AjaxPro.AjaxMethod attribute to the class method you want to call from javascript, and register the class in the code behind page usingAjaxPro.Utility.RegisterTypeForAjax(). Do the ASP.NET AJAX Extensions have something similar to this?

The way Professional AJAX works is very similar to ASP.NET AJAX page methods.

Got any links to back that up?


Just my opinion, having watched both of their request/response behaviors in FireBug.

Here's an example of a page method in action: http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/

Certainly no SOAP there.


gt1329a:

Just my opinion, having watched both of their request/response behaviors in FireBug.

Here's an example of a page method in action: http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/

Certainly no SOAP there.

Okay, that's what I was missing--I didn't come across Page Methods. Like you noted in your article, the amount of extra information that's added to the data you really want is silly. It's exactly why I chose Professional AJAX.NET over Microsoft's framework.

Still though, the style of solution that Professional AJAX.NET gives just feels more...streamlined.


The counterpoint to something like AJAX Pro is what would you do if you needed to create an AJAX-ified GridView using it? With ASP.NET AJAX, you have the flexibility to use light weight techniques when appropriate, but still fall back to partial postbacks when they are necessary.

gt1329a:

The counterpoint to something like AJAX Pro is what would you do if you needed to create an AJAX-ified GridView using it? With ASP.NET AJAX, you have the flexibility to use light weight techniques when appropriate, but still fall back to partial postbacks when they are necessary.

Yeah, that's the main weakness of AJAX.NET Pro right now: you can only work with HTML controls. Now that i know about page methods, I'm going to give the AAE another chance.


I tried both solutions and somehow I can't run AJAX Pro (namespace not defined error) and Extensions don't allow me to execute non static method.


If you can't get it done in a static method, you can always turn to a full web service call.

Monday, March 26, 2012

ASP.NET AJAX Beta 2 + ASMX Web Services = Parser Error !?!

Hi, I have my Web Services set up which works before ASP.NET AJAX installed. Now I am experiencing Parser Error when accessing my asmx web service.

My web.config is left untouched for the web services. The problem could be that the Web services is in the sub folders of my ASP.NET 2.0 + ASP.NET AJAX website. Please someone guide me on how to fix this error. It's quite urgent. Thanks!

Error Details:

System.InvalidOperationException: Failed to handle request. --> System.InvalidOperationException: Unable to handle request. --> System.Exception: Could not load file or assembly 'Microsoft.Web.Preview' or one of its dependencies. The system cannot find the file specified. --> System.Web.HttpParseException: Could not load file or assembly 'Microsoft.Web.Preview' or one of its dependencies. The system cannot find the file specified. --> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.Preview' or one of its dependencies. The system cannot find the file specified.

File name: 'Microsoft.Web.Preview'

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

at System.Reflection.AssemblyInternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.Load(String assemblyString)

at System.Web.Configuration.CompilationSection.LoadAssembly(String assemblyName, Boolean throwOnFail)

at System.Web.UI.TemplateParser.LoadAssembly(String assemblyName, Boolean throwOnFail)

at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistrationCore(TagNamespaceRegisterEntry nsRegisterEntry)

at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistration(ArrayList nsRegisterEntries)

WRN: Assembly binding logging is turned OFF.

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.

To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I feel that you need to install Ajax Futures CTP in your PC and the error message indicates that there is noMicrosoft.Web.Preview.dll to refer in your website.Try to check if you haveMicrosoft.Web.Preview.dllin the bin folder of your ajax website.If not,try to install ajax Futures Nov CTP first and add it to the bin folder.
Besides,try to read this thread?-http://forums.asp.net/1476672/ShowThread.aspx#1476672 if there is?any failure to call web service method.
Wish the above can help you.
Thanks! I added the needed dll into the bin folder and that fixed the problem. Thanks! It seems strange when I tested on my machine, things work but on the server it doesn't. Probably because of the inheritance of the web.config.
Try to check the permissions in the deployed server. Right mouse click virtual directory to addNetwork Service account and chooseProperties. Try to setexecute permissionsfor "Scripts only" or "Executable and Scripts"in the Virtual Directorypanel.Besides,try to set Trusted Level = Full.

Wednesday, March 21, 2012

asbx support in AJAX ASP.NET

I 've just download the new AJAX ASP.NET beta, and I'm trying to figure out where is the Microsoft.Web.Services.BridgeBuildProvider . Does this beta still support the asbx files and bridges? Where is the documentation?

somebody? bridge and asbx files ... what's going here?Confused


Unfortunately asbx and Bridge support are not in the current release.

will they be available in the final release? I found them very very very useful ... please

thanks


I'm waiting for them too. Especially after googling for answers and seeing and trying all related samples... which of course are working with the older previous release... but not with the beta one... If I wouldn't had found this post maybe I would still been trying to get it running...

Will this feature be available in the next versions? I need to take decisions based on your answer.

Thanks


Does something else take the place of the bridge (asbx) capability? Is there another way to use Javascript to call my remote web services?


You can always have your Web application make the Web Service calls and then hook up those calls with front end methods with local Web Service or PageMethods methods.

I would argue that this is a more reliable mechanism anyway although it does require an extra layer of abstraction.


The extra layer of abstraction requires more time. I also think that the bridging support is an excellent feature.

I need to build an application that calls in an asynchronuos way multiple web services from different domains...


Well the good news is due to customer feedback, it looks like the bridge feature will be brought back as part of the Value Add, so you'll be able to use bridges again...

Hope that helps,
-Hao


For sure it helpsBig Smile. Thanks HaoK, these are really excellent news ( I was thrilled by the bridging part, it matched like a glove my needs ) .

Any ideea about the next date release which will support this feature? Or I should simply try to continue/start working on Atlas July CTP(I remember this is the before the last one release) and update what I have when the new version will be available?

By Value Add you mean AJAX CTP? Or?...

Thanks again


I do not think that there is something else in place of bridging ...

As far as I know: you can still call web services using JS. Have a look at the following threads:

http://forums.asp.net/thread/1449674.aspx

http://forums.asp.net/thread/1172624.aspx

Hope this helps.

One thing I remember is that if you call a web service method using javascript, and the web service method is located under the same share as the web application, the method has to be defined in the .aspx file using <script language="C#">...</scipt>, and this is because of an issue present in the Beta version only(someone please correct me if I'm wrong).


Hao,


Great news that it is being brought back. I have a couple questions: 1) I was told it would be in beta 2, but have seen no documentation or mention of it with today's release? 2) Why was it removed? It seems like a very useful feature. Or, as Rick mentions above, is it considered a better practice to have a local webservice call to an external service? Seems like a lot of hassle...

Thanks,


Brian


It was added very late, so the docs didn't have time to be updated, but all the old Microsoft.Web.Services.Bridge* classes now live under Microsoft.Web.Preview.Services.*

Hope that helps,
-Hao


Thanks Hao,

We are trying to get our old bridge code working, and running into some confusing errors. It seems that the calls are working, the generated BridgeHandler is being hit, and the parameters are coming in correctly (we can see them in the debugger) but when it tries to convert the first item in the parameter Dictionary, it fails with a null reference error, even though that item (obj) can be seen in the debugger as having a value of "1"

if (args.TryGetValue("businessPurposeTypeID", out obj)) {
// Not sure why there are so many empty if statements
}
else {
throw new System.ArgumentException("Argument not found: businessPurposeTypeID");
}
arg0 = ((int)(this.ConvertToType(obj, typeof(int))));

The line with "ConvertToType" is the line that's failing. See the following stack trace returned in the javascript result:

"@._Error(false,"Object reference not set to an instance of an object."," at Microsoft.Web.Preview.Services.BridgeHandler.ConvertToType(Object argValue, Type paramType)\r\n at MLDB.Website.WebServices.MLDBSearchBridge.CallServiceClassMethod(String method, Dictionary`2 args, ICredentials creds, String url) in c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files\\mldb.website\\3254fa88\\e4e20f8b\\App_Web_-q50ig-3.0.cs:line 104\r\n at Microsoft.Web.Preview.Services.BridgeHandler.ProcessRequest()\r\n at Microsoft.Web.Preview.Services.BridgeHandler.ExecuteBridgePipeline()\r\n at Microsoft.Web.Preview.Services.BridgeHandler.Invoke(BridgeRequest request)\r\n at MLDB.Website.WebServices.MLDBSearchBridge.LoadListingResults(IDictionary args) in c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files\\mldb.website\\3254fa88\\e4e20f8b\\App_Web_-q50ig-3.0.cs:line 70","System.NullReferenceException")Error_@."

Any suggestions?


I have a simpler question. I've downloaded and installed theASP.NET AJAX 1.0 beta 2 release, and now I'm trying to simply get themashup examples from the videos to work. Specifically the Amazonand Flickr example:http://download.microsoft.com/download/f/9/c/f9c970a0-0401-4863-9f03-981e513a2f1c/HDI-AtlasMashUp.wmv

Usingbridging for mashups is a central focus for me, so if someone has thisworking on the current release if they could post the code it would begreat. I've tried to hack my way through with the migration guideand so forth, but when I load the page and click the button it can'tfind "Samples", which is the namespace used by the two .asbxfiles. I have a feeling that it's a web.config problem or maybean IIS config problem, but I'm working in the dark ...

thanks,

Robert