473,786 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript Error Calling Webservice

Hi all,

I have a webpage that calls a webservice found on a remote computer.
Below is the code of my webpage:

=============== =============== =======
<html>
<head>
<script language="JavaS cript">
var iCallID;

function init()
{
service.useServ ice("http://www.webservicex .net/length.asmx?WSD L","MyMath") ;

iCallID = service.MyMath. callService(onW Sresult,
"ChangeLengthUn it", 12, "Feet", "Inches");
}

function onWSresult(resu lt)
{
alert(result.va lue);
if((event.resul t.error)&&(iCal lID==event.resu lt.id))
{
var xfaultcode = event.result.er rorDetail.code;
var xfaultstring = event.result.er rorDetail.strin g;
var xfaultsoap = event.result.er rorDetail.raw;

// Add code to output error information here
}
else
{
alert("The method returned the result : " + event.result.va lue);
}
}
</script>
</head>
<body onload="init()" >
<div id="service" style="behavior :url(webservice .htc)">
</div>
</body>
</html>

=============== =============== =======

When the "alert(result.v alue)" is reached, I used to get "undefined" as
a result but now it seems that the webpage freezes and nothing happens.
I'm sure that the webservice I'm calling is functioning properly (if I
type its URL in a brower, it works fine) and I'm sure that the
'webservice.htc ' is there in it's proper location.

Note: The above webpage is hosted on a Windows 2003 Server which has a
public IP (i don't know if this might be helpful)

Any ideas would be greatly appreciated!

Thanks

Aug 12 '06 #1
3 2345


Zeez wrote:

I have a webpage that calls a webservice found on a remote computer.
service.useServ ice("http://www.webservicex .net/length.asmx?WSD L","MyMath") ;
<div id="service" style="behavior :url(webservice .htc)">
Unless your HTML document with the script is hosted on
www.webservicex.net too I don't think you will be able to access the web
service with normal IE security settings.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 13 '06 #2
Thanks for the reply Martin! But to let you know, I used this before
plenty of times and it worked. Moreover, I think that's the main
intention of webservices which is to be called remotely.

The weird part is that if my webpage is hosted on the IIS of a windows
XP client, it works awesome! But unfortunately not on Windows 2003
server! Since it used to work before, I'm afraid it's a security update
(for 2003 server) made by windows lately.

If anyone knows about it, let me know and I'll appreciate it!

Thanks!

Aug 14 '06 #3


Zeez wrote:
Thanks for the reply Martin! But to let you know, I used this before
plenty of times and it worked. Moreover, I think that's the main
intention of webservices which is to be called remotely.
Well the intention of most resources on a public HTTP server (e.g. all
the web content) is to be used remotedly too. Nevertheless a browser for
client-side script accessing resources from different origins with
normal security settings disallows that because of the same origin policy.
And in my understanding IE and its webservice behavior are not
different. So your client side script in a document served from
http://example.com/ can access the remote web service on example.com but
not one on example.org.

But IE has a zone model where you can configure different security
settings for each zone so you can allow access for the zone of trusted
sites for instance.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 14 '06 #4

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

Similar topics

4
2406
by: Chris Bardon | last post by:
I'm working on an application where I need to be able to call a .net web service from javascript. I found the webservice.htc file, and was able to create a page that worked just fine, except that the memory usage of iexplore.exe began to increase without limit as the service was called. To demonstrate this, I tried the following script, which showed the increase very quickly by continuously calling the service. Since useService is the...
5
1216
by: Ganesh Ramamurthy | last post by:
Hi Experts, I have written a .net Web Service. I want to invoke a web method from the webservice, pass parameters to the webservice and get the resultant value from the web service using javascript. Can anyone tell me how to achieve this task? Please Help....
3
3567
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...
1
1507
by: PrettySneaky | last post by:
Hi, I'm currently developing my first .NET 2.0 webservice and I have stumbled into some problems. When i call webmethods from a console app which has a webreference to the webservice everything works fine. It also works just fine when I call a webmethod with javascript code from a computer that is on the same subnet as the webservice if the "webpage" is published on the "calling" computer. However computers outside of that subnet gets an...
2
4033
by: Frank | last post by:
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
0
1692
by: JeremyPollack | last post by:
Here's the situation : I have the same ASP.NET 2.0 web application running on both Machine A and Machine B. On both machines, I have Integrated Windows Authentication turned on, and Anonymous Access turned off for the folder that contains the webservice .ASMX file. When I hit a certain page on Machine A, it will call the web service on Machine A, and then it will call the same web service on Machine B. Likewise, when I hit the same...
1
2003
by: neerom | last post by:
Hi I need to call webservice from xslt in HTTP POST Method. The MSXML should be used. I am using javascript. I have an XML File which is having Integer Node.....Shown Below <?xml version="1.0" encoding="utf-8" ?> <NumberSet> <integer> <a>10</a> <b>12</b>
0
9492
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10360
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
10163
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
7510
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...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
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
3668
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.