473,378 Members | 1,438 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,378 software developers and data experts.

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="JavaScript">
var iCallID;

function init()
{
service.useService("http://www.webservicex.net/length.asmx?WSDL","MyMath");

iCallID = service.MyMath.callService(onWSresult,
"ChangeLengthUnit", 12, "Feet", "Inches");
}

function onWSresult(result)
{
alert(result.value);
if((event.result.error)&&(iCallID==event.result.id ))
{
var xfaultcode = event.result.errorDetail.code;
var xfaultstring = event.result.errorDetail.string;
var xfaultsoap = event.result.errorDetail.raw;

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

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

When the "alert(result.value)" 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 2320


Zeez wrote:

I have a webpage that calls a webservice found on a remote computer.
service.useService("http://www.webservicex.net/length.asmx?WSDL","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
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...
5
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...
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...
1
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...
2
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...
0
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...
1
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"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.