471,309 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,309 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 2219


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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Chris Bardon | last post: by
5 posts views Thread by Ganesh Ramamurthy | last post: by
3 posts views Thread by Merav Orion via .NET 247 | last post: by
2 posts views Thread by Frank | last post: by
1 post views Thread by neerom | last post: by
reply views Thread by rosydwin | last post: by

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.