467,888 Members | 1,361 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

calling WCF service methods from JavaScript in another domain?

Can someone please give me an example on how to call a wcf method that
resides on a different domain from JavaScript (not from C#/asp.net)?
All the examples that I have seen show how to call from the same
domain.
I don't care what the binding is. I'll use what works.
I need concrete examples or links to concrete example please. Not
just links to articles describing how to do it.
Your help is greatly appreciated.

Mar 25 '08 #1
  • viewed: 5662
Share:
4 Replies
jake wrote:
Can someone please give me an example on how to call a wcf method that
resides on a different domain from JavaScript (not from C#/asp.net)?
All the examples that I have seen show how to call from the same
domain.
I don't care what the binding is. I'll use what works.
I need concrete examples or links to concrete example please. Not
just links to articles describing how to do it.
Your help is greatly appreciated.
We can use JavaScript to call a executable file but the security setting
of IE must be set to lowest level; and then that file can call wcf
method in turn
If you want only JavaScript can do the calling, I think you must be the
first one having that idea.
--
Thanks,
Duy Lam Phuong
Mar 26 '08 #2
On Mar 26, 10:57 am, Duy Lam <duylamphu...@gmail.comwrote:
jake wrote:
Can someone please give me an example on how to call awcfmethod that
resides on a different domain from JavaScript (not from C#/asp.net)?
All the examples that I have seen show how to call from the same
domain.
I don't care what the binding is. I'll use what works.
I need concrete examples or links to concrete example please. Not
just links to articles describing how to do it.
Your help is greatly appreciated.

We can use JavaScript to call a executable file but the security setting
of IE must be set to lowest level; and then that file can callwcf
method in turn
If you want only JavaScript can do the calling, I think you must be the
first one having that idea.

--
Thanks,
Duy Lam Phuong
JavaScript can call methods in regular web services. Why can't it
call WCF methods as well?
I highly doubt that I am the first one to think of this.
Did everyone who used google (which has javascript calls to web
services through the XMLHttpRequest) have to have IE or any other
browser's security set to the lowest level?
The structure of the website that I am building is such that some
calls are to be made from the server (asp.net) side and some from the
client side, to save bandwidth and such, and to be efficient.
But please elaborate as to why this is such a strange thing to do (why
would I be the first one to inquire about this).
I am not being sarcastic; I really need to know if there is a better
way to do what I am doing now.
All help is greatly appreciated.
Thanks
jake
Mar 26 '08 #3
jake wrote:
JavaScript can call methods in regular web services. Why can't it
call WCF methods as well?
I highly doubt that I am the first one to think of this.
Did everyone who used google (which has javascript calls to web
services through the XMLHttpRequest) have to have IE or any other
browser's security set to the lowest level?
When saying set the IE security to lowest levelt, I meant to use ActiveX
object (call an executable file).
You use XMLHttpRequest to a call to server, and then what thing happen
next? Does JavaScript *communicate* with WCF or wait for response from
server? If you do that, it seems there is a misunderstand about your
question.
Anyway, trying to argue about this could go nowhere. You said you used
JavaScript to trigger a calling to web server (by ajax), and it does not
mean "JavaScript call a WCF method".
The structure of the website that I am building is such that some
calls are to be made from the server (asp.net) side and some from the
client side, to save bandwidth and such, and to be efficient.
But please elaborate as to why this is such a strange thing to do (why
would I be the first one to inquire about this).
I am not being sarcastic; I really need to know if there is a better
way to do what I am doing now.
All help is greatly appreciated.
Thanks
jake
It seems you're angry about my reply. I'm sorry.
--
Thanks,
Duy Lam Phuong
Mar 27 '08 #4
On Mar 27, 9:18 am, Duy Lam <duylamphu...@gmail.comwrote:
jakewrote:
JavaScript can call methods in regular web services. Why can't it
callWCFmethods as well?
I highly doubt that I am the first one to think of this.
Did everyone who used google (which has javascript calls to web
services through the XMLHttpRequest) have to have IE or any other
browser's security set to the lowest level?

When saying set the IE security to lowest levelt, I meant to use ActiveX
object (call an executable file).
You use XMLHttpRequest to a call to server, and then what thing happen
next? Does JavaScript *communicate* withWCFor wait for response from
server? If you do that, it seems there is a misunderstand about your
question.
Anyway, trying to argue about this could go nowhere. You said you used
JavaScript to trigger a calling to web server (by ajax), and it does not
mean "JavaScript call aWCFmethod".
The structure of the website that I am building is such that some
calls are to be made from the server (asp.net) side and some from the
client side, to save bandwidth and such, and to be efficient.
But please elaborate as to why this is such a strange thing to do (why
would I be the first one to inquire about this).
I am not being sarcastic; I really need to know if there is a better
way to do what I am doing now.
All help is greatly appreciated.
Thanks
jake

It seems you're angry about my reply. I'm sorry.

--
Thanks,
Duy Lam Phuong
No, no; I am not angry at all. Not even in the least bit. No need to
be sorry. I am just anxious for some help. In fact, I am the one who
should be sorry for asking and replying as ambiguously as I did.

Let me try again:
I need to make AJAX work with WCF from the client's JavaScript, to
update only part of the web page instead of a full reload.
I know AJAX (XmlHttpRequest) works from the client's JavaScript to
retrieve info from regular web services and update part of the web
page.
I need to do the same thing, but with a WCF service instead of a
regular web service.
In other words:
instead of,
client ---(through Get or Post request)---asp.net/C#/IIS ---(through
XmlHttpRequest)---WCF service ---asp.net/C#/IIS ---client
I would like
client ----(through XmlHttpRequest)---WCF service ---client
Is this possible?

If this is still somewhat vague, let me know and I will clarify it
some more.
Thanks
jake
Mar 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Merav Orion via .NET 247 | last post: by
3 posts views Thread by Grant Schenck | last post: by
2 posts views Thread by Johan | last post: by
dmjpro
3 posts views Thread by dmjpro | last post: by
reply views Thread by =?Utf-8?B?V2ViemVzdA==?= | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.