Does anybody know of a good resource online that demonstrates how to call webservices from the client in IE and FF...I have only found IE-only examples that wouldn't work in firefox, and it's almost frustrating enough to make me want to spit nails!
Jonathan
-
-
The examples should be easily modifiable to comply with the standard DOM and other features. Can you post the problematic code?
-
W3bbo wrote:The examples should be easily modifiable to comply with the standard DOM and other features. Can you post the problematic code?
I don't yet have any problematic code. I'm looking for resources so I can get to writing some problematic code
-
This is probably an obvious reply (well, I think it would be)... but have you thought about using ASP.NET AJAX?

http://www.singingeels.com/Articles/Consuming_Web_Services_With_ASPNET_AJAX.aspx
(article of the day for today - 7/14/2007 on www.asp.net) -
jsampsonPC wrote:Does anybody know of a good resource online that demonstrates how to call webservices from the client in IE and FF...I have only found IE-only examples that wouldn't work in firefox, and it's almost frustrating enough to make me want to spit nails!
Jonathan
Here is an AWESOME book on ASP.NET AJAX which I'd recommend to use in this situation. Professional ASP.NET 2.0 Ajax covers the various topics in ASP.NET Ajax or as I've been calling it lately ajax.net just because it is shorter to type
The authors provide a great overview from basic Javascript skills to how the Ajax networking features work. They have some sections dedicated to web services that taught me how to implement them from me not knowing really that much about JSON and nothing at all about implementing Web Services via Javascript.
Hope that helps. I've been really in to this technology lately so if you have any questions let me know, I might be able to help.
Tim -
Nullable & Cloak,
My only reservation with using asp ajax is that I'm under the impression that you apply rules and actions to objects early instead of late. What I mean by that is, you drag a button out onto the screen, and then apply some asp ajax code to it.
In my situation, I'm building a large form/menu once the page is processed. So NONE of my controls exist until the page is requested. So I have tons of stuff like:
myStringBuilder.Append("<button value=""" & myDataReader("ButtonValue").ToString() & """ />")
That is a very very simplified example of the type of stuff I'm doing, but I really only expect to build this page once...and then never post-back again afterwards.
What I need to do is be able to call a webservice from that generated button, so that the user can perform backend-data-manipulation like updating records, etc. -
ASP.NET ATLAS can be used in different ways. It offers also a javascript library that abstracts the browser differences away and allows you to call web services and stuff.
You should have a look at the ATLAS docs.
Sample: http://www.devx.com/dotnet/Article/32508 -
jsampsonPC wrote:myStringBuilder.Append("<button value=""" & myDataReader("ButtonValue").ToString() & """ />")
Just say no to building HTML with StringBuilders! Don't do it!
<button id="ThisButton" runat="server" value='<%# Eval("ButtonValue") %>' /> -
and why is that? ya in some ways pages/controls are better structured in that way but i prefer anything instead of the evil EvalJChung2006 wrote:
jsampsonPC wrote:
myStringBuilder.Append("<button value=""" & myDataReader("ButtonValue").ToString() & """ />")
Just say no to building HTML with StringBuilders! Don't do it!
<button id="ThisButton" runat="server" value='<%# Eval("ButtonValue") %>' /> -
This might be what you are looking for. This is what I use when creating Ajax call to a webservices.
var objXmlHttpRequest;
function AjaxCall(url)
{
var webServiceUrl = url; //<YOUR WEBSERVICE URL>;
try
{
objXmlHttpRequest = CreateXmlHttpRequest();
objXmlHttpRequest.open("get", url, true);
objXmlHttpRequest.onreadystatechange = function ()
{
if(objXmlHttpRequest.readyState == 4)
{
if(objXmlHttpRequest.status == 200)
{
alert(objXmlHttpRequest.responseText);
}
}
};
objXmlHttpRequest.send(null);
}
catch(Error)
{
alert(Error);
}
}
function createXmlHttpRequest()
{
// See if browser is not IE
if(typeof XMLHttpRequest != "undefined")
{
return new XMLHttpRequest();
}
// Browser is IE
else if(window.ActiveXObject)
{
//Add versions of Microsofts XMLHttp
var arrMSVersions = ["MSXML2.XMLHttp.5.0",
"MSXML2.XMLHttp.4.0",
"MSXML2.XMLHttp.3.0",
"MSXML2.XMLHttp",
"Microsoft.XMLHttp"];
// Loop through each version to see which one the user has
for(var v = 0; v < arrMSVersions.length; v++)
{
try
{
var objXmlHttp = new ActiveXObject(arrMSVersions[v]);
return objXmlHttp
}
catch (Error)
{
// Go to next ms version
}
}
}
throw new Error("XMLHttp object could not be created");
} -
cmanciero wrote:This might be what you are looking for. This is what I use when creating Ajax call to a webservices.
var objXmlHttpRequest;
function AjaxCall(url)
{
...
This looks promising - do you have any documentation with this? -
Something additional that I was thinking about is the security-aspect of calling these services from a client. In my application, the user logs in, and is able to select a previous state of a form. It then loads the form for them with their values, and allows them to change their selections. I want the selections to be updated asynchronously via javascript calls to the web services - but only for logged in users, and only on records they have access to.
Is this as big of a security issue as I'm thinking?
-
cmanciero wrote://Add versions of Microsofts XMLHttp
var arrMSVersions = ["MSXML2.XMLHttp.5.0",
"MSXML2.XMLHttp.4.0",
"MSXML2.XMLHttp.3.0",
"MSXML2.XMLHttp",
"Microsoft.XMLHttp"];
No!
MSXML5 will already cause a warning in IE7 ("do you want to run this activex control?"), and MSXML4 is due to be disabled. Only use MSXML6 and MSXML3. No others.
See here. -
jsampsonPC wrote:Is this as big of a security issue as I'm thinking?
The browser'll send cookies and WWW-Authenticate headers to the web service same as to a regular page, so security should be no different. -
Sven Groot wrote:

jsampsonPC wrote:
Is this as big of a security issue as I'm thinking?
The browser'll send cookies and WWW-Authenticate headers to the web service same as to a regular page, so security should be no different.
Everything is plain text... You need to use SSL to encrypt stuff. Otherwise everybody can read it. -
MooTools dude ... MooTools

I use this ALL the time, with great efficiency ... saves dev-time and has some great built in features. -
littleguru wrote:

Sven Groot wrote:

jsampsonPC wrote:
Is this as big of a security issue as I'm thinking?
The browser'll send cookies and WWW-Authenticate headers to the web service same as to a regular page, so security should be no different.
Everything is plain text... You need to use SSL to encrypt stuff. Otherwise everybody can read it.
What I'm concerned with is somebody being able to manually invoke a service, and change values in records for other people. -
Ion Todirel wrote:
and why is that? ya in some ways pages/controls are better structured in that way but i prefer anything instead of the evil Eval
JChung2006 wrote:
Just say no to building HTML with StringBuilders! Don't do it!
<button id="ThisButton" runat="server" value='<%# Eval("ButtonValue") %>' />
Because you don't put UI in your C#.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.