473,799 Members | 3,339 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Scri pt.Services.Scr iptService]

And then right where I define my method:

[WebMethod]
[System.Web.Scri pt.Services.Scr iptMethod]

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 4034
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
1731
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 information will be used to initiate either a MS Word or MS Excel document. The applications (Word & Excel) reside on the users local system but the database is on the server. Since it is for internal company use I'm not too concerned about...
1
6741
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 this WebService1. (using Apache Axis 1.1) Scenario 1: -----------
0
2800
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 My Restrictions: - The WebService is pure Java, running under WebSphere5.1 - The Request requires Basic Authentication and needs to be SSL
3
3569
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 looks like the data is not transferred to the asp page from the web service. just after going to internet option -> security -> Custom level -> Access data sources across domains -> and check the enable radio -> the problem is fixed. I need a...
7
4988
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 Parameter. I can call the first Method without Problems, the Parameter can be deserialized by the WebService. But if I want to call the second Method and give it an Array of Parameters, then the following exception is thrown by the WebService:...
2
5126
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 want to prepare the Xml and make a SOAP call. One way is to use the webservice.htc but it will not work on Netscape. Can somebody suggest me some other solution through which I can make method calls ? regards, Tushar
6
8969
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 difficult task? Or is this quite easy, like just a few lines of source and using some of the packages from apache.org? Has anybody done this before and will like to tell me about his/her experiences?
1
1616
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 can't find out how to do--calls a webservice on a separate server... Client ASP server (no .net)
2
1827
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 linked to ASP.NET. I tried too the framework DWR but it doesn't implements WebService technologies (SOAP, etc.). It just enables remote calls.
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10484
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10228
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.