JavaScript Error Calling Webservice

Z

Zeez

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
 
M

Martin Honnen

Zeez wrote:

I have a webpage that calls a webservice found on a remote computer.

<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.
 
Z

Zeez

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!
 
M

Martin Honnen

Zeez said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top