I remember that MSNBridge sample was released moths ago(on March this year, I guess) before Beta being released. See
thead
... maybe that's why. Unfortunatelly I couldn't find it again to play with it.
At least we can get an idea about what bridging can do... and what cannot...
Does anyone know about any form of documentation regarding bridging/asbx? I'm still lost...
I was told that bridge support was a late addition to Beta 2, and was added only due to popular demand. Therefore, no new documentation exists, but I'd assume it will be added for the next, or at least the final, release.
I found it interesting that they were intending not to include bridge support, as I thought mashups would be really popular. I was told they didn't see a lot of interest in it in the CTP, and only realized its popularity after they removed it...
I really need some help getting the bridges to work again (after the move to the Beta 2 code). I keep getting the "Object reference not set to an instance of an object" error. My code is below. The web service uses SOAP. We are using WSE 3. I started this
based on the "Mashup" tutorial from before the new beta. Ideas?? Thanks in advance!
I added this to web.config (within <compilation
debug="true">)
public ReportContent GetSDMSContent(string guid) {
//Calls ReportContentRequest on SDMS Service from selection in datagridview.
//Brings back selected report and opens.
SDMSWebServices service =
new SDMSWebServices();
ReportContentRequest req =
new ReportContentRequest();
string idcall =
Convert.ToString(guid);
req.AuthorizationUserId = userId;
req.AuthorizationPassword = pwd;
req.BusinessArea = ba;
req.GUID = idcall;
req.ConsumerSystemId = consumerUserId;
req.Format =
ReportFormat.ngx;
ReportContent content = service.GetReportContent(req);
string outputFilename = System.IO.Path.GetTempPath() + System.IO.Path.GetRandomFileName()
+ ".ngx";
File.WriteAllBytes(outputFilename, content.Content);
Process app =
new Process();
app.StartInfo.FileName = outputFilename;
app.StartInfo.CreateNoWindow =
false;
app.Start();
if (content !=
null)
{
return content;}
else { return
new ReportContent(); }
}
}
Marked as answer by frankjperez on Dec 15, 2006 01:11 AM
The page builds, but when I test and enter a search term, I get a Javascript error "Samples is undefined". The "Samples" namespace isn't found, so it fails when OnSearch() trys to access it:
function OnSearch()
{
var parameters = { 'Keywords' : txtSearchText.value };
if (nextAmazonPage > 1)
parameters.Page = nextAmazonPage;
Samples.AmazonPox.Search(parameters, { onMethodComplete:OnCompleteAmazonSearch,
onMethodTimeout:OnTimeout, onMethodError:OnError, userContext: "Amazon Search via Get"} );
if (nextFlickrPage > 1)
parameters.Page = nextFlickrPage;
Samples.Flickr.Search(parameters, { onMethodComplete:OnCompleteFlickrSearch,
onMethodTimeout:OnTimeout, onMethodError:OnError, userContext: "Flickr Search via Get" } );
I'm using the Type.GetType call in a code behind for both the AmazonPox.asbx file and the Flickr.asbx file:
protected new object ConvertToType(object argValue, Type paramType)
{
string text1 = "Microsoft.Web.Script.Serialization.ObjectConverter, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
return Type.GetType(text1).GetMethod("ConvertObjectToType", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new object[] { argValue, paramType, new JavaScriptSerializer() });
}
So, one thing for you to try to debug what's going on, usually when you get a Samples undefinied error, something went wrong with your proxy request. So try fiddler and see if the request to your asbx/js is returning a javascript proxy for your bridge.
I'm guessing something is wrong with that step...
I'm sorry, I should probably know this, but I'm not sure how to do that, and I don't know what Fiddler is or where to get it. I did use the "debugger" statement in the javascript to set a breakpoint and inspect, but I couldn't find anything suspicious.
Could you tell me about using Fiddler?
dglsmason
Member
80 Points
31 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 02:19 PM|LINK
Why do you have "OnTimeout" and "OnError" (see code below)? I thought this was changed to just an 'OnError'?
Samples.MSNSearch.Search({ 'Request' : searchRequest }, OnCompleteMSN, OnTimeout, OnError)
avmoldovan
Member
199 Points
41 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 02:35 PM|LINK
I remember that MSNBridge sample was released moths ago(on March this year, I guess) before Beta being released. See thead ... maybe that's why. Unfortunatelly I couldn't find it again to play with it.
At least we can get an idea about what bridging can do... and what cannot...
Does anyone know about any form of documentation regarding bridging/asbx? I'm still lost...
madscene
Member
97 Points
20 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 02:44 PM|LINK
I was told that bridge support was a late addition to Beta 2, and was added only due to popular demand. Therefore, no new documentation exists, but I'd assume it will be added for the next, or at least the final, release.
I found it interesting that they were intending not to include bridge support, as I thought mashups would be really popular. I was told they didn't see a lot of interest in it in the CTP, and only realized its popularity after they removed it...
avmoldovan
Member
199 Points
41 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 02:51 PM|LINK
Indeed. And I have so many apps to update to use this feature... especially because of less complexity, user experience and speed.
Any idea on what I'm doing wrong when adding multiple methods in .asbx? Please see my post above.
madscene
Member
97 Points
20 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 03:59 PM|LINK
dglsmason
Member
80 Points
31 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 05:50 PM|LINK
I really need some help getting the bridges to work again (after the move to the Beta 2 code). I keep getting the "Object reference not set to an instance of an object" error. My code is below. The web service uses SOAP. We are using WSE 3. I started this based on the "Mashup" tutorial from before the new beta. Ideas?? Thanks in advance!
I added this to web.config (within <compilation debug="true">)
<buildProviders>
<add extension=".asbx" type="Microsoft.Web.Preview.Services.BridgeBuildProvider"/>
</buildProviders>
I added this to web.config (within <httpHandlers>):
<
add verb="*" path="*.asbx" type="Microsoft.Web.Script.Services.ScriptHandlerFactory" validate="false"/>Code in default.aspx:
MyNameSpace.SDMSSoapBridge.GetSDMSContent({ 'guid' : guid }, null, SDMSContentFailure);
My bridge file:
<?
xml version="1.0" encoding="utf-8" ?><
bridge namespace="MyNameSpace" className="SDMSSoapBridge" ><
proxy type="SDMSWrapper, App_Code" /><
method name="SearchSDMS"><
input> <parameter name="query" /> </input></
method> <method name="GetSDMSContent"><
input> <parameter name="guid" /> </input></
method> </bridge>My "wrapper" file:
using
System; using System.IO; using System.Diagnostics;//since upgrade to new beta, I added from here...
using
Microsoft.Web.Preview.Services; using Microsoft.Web.Script.Services;using Microsoft.Web.Script.Serialization; using System.Reflection;using System.Net;
using
System.Collections;//...to here
using
System.Collections.Generic; using System.ComponentModel; using System.Data;using
System.Drawing; using System.Text; using System.Configuration;using
System.Web; using System.Web.Security; using System.Web.UI;using
System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts;using
System.Web.UI.HtmlControls;using
SDMS; using System.Web.Services.Protocols;using
Microsoft.Web.Services3; using Microsoft.Web.Services3.Design;using
Microsoft.Web.Services3.Security; using Microsoft.Web.Services3.Security.Tokens;//Simple wrapper around the SDMS SOAP Proxy to make the results easier to consume.
public
class SDMSWrapper { //Variables setup for Ontology Service private static string consumerUserId = ConfigurationManager.AppSettings["UserID"]; private static string userId = ConfigurationManager.AppSettings["SDMS.UserID"]; private static string pwd = ConfigurationManager.AppSettings["SDMS.UserPassword"]; private static string ba = ConfigurationManager.AppSettings["SDMS.BusinessArea"]; public ReportAttributes[] SearchSDMS(string query) { //Call SDMS Search Service SDMSWebServices service = new SDMSWebServices(); ReportAttributeRequest request = new ReportAttributeRequest(); SearchCriteria criteria = new SearchCriteria();criteria.AttributeName =
AttributeName.SampleName;criteria.Value = query;
request.AuthorizationUserId = userId;
request.AuthorizationPassword = pwd;
request.BusinessArea = ba;
request.Criteria =
new SearchCriteria[] { criteria }; ReportAttributes[] attributes = service.GetReportAttributes(request); if (attributes != null && attributes.Length > 0){
return attributes; } else { return new ReportAttributes[] { }; }}
public ReportContent GetSDMSContent(string guid) { //Calls ReportContentRequest on SDMS Service from selection in datagridview. //Brings back selected report and opens. SDMSWebServices service = new SDMSWebServices(); ReportContentRequest req = new ReportContentRequest(); string idcall = Convert.ToString(guid);req.AuthorizationUserId = userId;
req.AuthorizationPassword = pwd;
req.BusinessArea = ba;
req.GUID = idcall;
req.ConsumerSystemId = consumerUserId;
req.Format =
ReportFormat.ngx; ReportContent content = service.GetReportContent(req); string outputFilename = System.IO.Path.GetTempPath() + System.IO.Path.GetRandomFileName() + ".ngx"; File.WriteAllBytes(outputFilename, content.Content); Process app = new Process();app.StartInfo.FileName = outputFilename;
app.StartInfo.CreateNoWindow =
false;app.Start();
if (content != null){
return content;} else { return new ReportContent(); }}
}
madscene
Member
97 Points
20 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 06:13 PM|LINK
rcrowe
Member
47 Points
11 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 08:53 PM|LINK
I'm trying to get the Amazon/Flickr example to work under beta 2, no luck so far. Here's the original:
http://download.microsoft.com/download/f/9/c/f9c970a0-0401-4863-9f03-981e513a2f1c/HDI-AtlasMashUp-Demo.zip
The page builds, but when I test and enter a search term, I get a Javascript error "Samples is undefined". The "Samples" namespace isn't found, so it fails when OnSearch() trys to access it:
I'm using the Type.GetType call in a code behind for both the AmazonPox.asbx file and the Flickr.asbx file:
Any ideas? A copy of my code is at: http://ourwebhome.com/AtlasMashup.zipasbx bridge atlas ajax
HaoK
Participant
959 Points
185 Posts
Microsoft
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 09:02 PM|LINK
So, one thing for you to try to debug what's going on, usually when you get a Samples undefinied error, something went wrong with your proxy request. So try fiddler and see if the request to your asbx/js is returning a javascript proxy for your bridge. I'm guessing something is wrong with that step...
Hope that helps,
-Hao
rcrowe
Member
47 Points
11 Posts
Re: asbx support in AJAX ASP.NET
Nov 10, 2006 09:27 PM|LINK
I'm sorry, I should probably know this, but I'm not sure how to do that, and I don't know what Fiddler is or where to get it. I did use the "debugger" statement in the javascript to set a breakpoint and inspect, but I couldn't find anything suspicious. Could you tell me about using Fiddler?