473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

calling WebService from javascript client

Hi,

Newbie wondering if it is possible to call an ASP.NET 2.0 WebService from
javascript that isn't served up on the same server?

For example, I would like to call the WebService using an XmlHttpRequest
object, but it appears that I can't just run the webservice using because
the calling javascript doesn't know about the client proxy js right?

So how do you do this if you want to call the webservice from a javascript
client?

In my webservice, I have used:
At the top of the file:
[System.Web.Script.Services.ScriptService]

And then right where I define my method:

[WebMethod]
[System.Web.Script.Services.ScriptMethod]

public string MyWebMethod() {

return "hello world";

}

Or should I be using IHttpRequest Module to handle this situation?

Thanks for any tips,
Frank
Mar 3 '07 #1
2 4003
er, yea, HTTP GET and HTTP POST ...
I've got my head stuck in proxy client consumption and totally forgot these
services can be called via get and post
Mar 3 '07 #2
Hi,

Frank wrote:
er, yea, HTTP GET and HTTP POST ...
I've got my head stuck in proxy client consumption and totally forgot these
services can be called via get and post
However, XmlHttpRequest doesn't allow cross-domain service calls. You
may only call the site of origin. This is an annoying limitation, which
may be lifted in the future (maybe using JSONRequest or something
similar), but one you have to live with when you use a
webbrowser-to-webserver webservice call.

The alternative is to use a server as proxy ("forwarding" the calls), or
to use other techniques, for example including script files from the
third party server (if they're available). This is the technique Google
uses for the maps and other services.

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Mar 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Rob Kellow | last post by:
Hello, I'm working on an application for use within my company on our intranet that will be used to gather some information and store some of the info in a SQL Server database and the rest of the...
1
by: Lakshmi | last post by:
Hi All, I am having performance issues with the .NET client calling the Java Webservice running on axis. Have detailed the problem below. Please help. I wrote a webservice in Java. Lets name...
0
by: Det | last post by:
Hi there I am somewhat stuck with calling a WebService from out of a VB App. My Goal: - Get a WebService invoked under MS - Access 2002, not using the MS-SOAP-Toolkit but the .net - Framework ...
3
by: Merav Orion via .NET 247 | last post by:
I have a problem calling webservice from client side javascript. The javascript call the settimeout() method. when the user press submit button it ignore the press and keep refreshing the page. it...
7
by: Christian Wilhelm | last post by:
Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type...
2
by: MSNews | last post by:
Hi, I have written a WebService using Visual Studio.Net's 'ASP.Net Web Service' project (ASMX). I want to call the exposed methods form a HTML client (using JavaScript) as a function. I do not...
6
by: Sascha Schmidt | last post by:
Hi again! Well, the first part of my "mission" (calling remoting objects from a webservice) is solved. But there's another part: Calling this C#-Webservice from a java client. Is this a...
1
by: Mr Bojangles | last post by:
Hi, I want a do the following: From a (client side) web form, post to server side script (I'm using Javascript but anything will do), which in turn--and this is the important bit that I...
2
by: oziris | last post by:
Hi, I'm under Java and I'm looking for a JavaScript framework which simplify WebService comsumption from JavaScript scriptings. I tried the great Microsoft Ajax Library but it seems strongly...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.