Reputation: 5618
I want access to the Methods of my WebService (SOAP).. I tried it on a other way, but didnt worked.. Now I will create this scenario in Javascript:
MyWebService client = new MyWebService();
So that I can access the Methods like:
client.GetYear()
in javascript!
Hope u guys can help me..
EDITED:
If you create a WebService, u can access it like:
MyWebService client = new MyWebService();
with:
string theName = client.GetName();
so but I want to acces this method with javascript, not with C#, How do I create the "client" in Javascript?
Upvotes: 0
Views: 818
Reputation: 137290
If I understand you correctly and you are asking on how to create a class and instantiate it within JavaScript, then you should know that by default such things are not a part of JavaScript.
You can have objects, but classes are different issue. There are some walkthroughs however. One of them is here: http://www.phpied.com/3-ways-to-define-a-javascript-class/
So, basically you can do something like that (see this jsfiddle for proof):
var MyWebService = function(){
this.message = 'some message';
this.showMsg = function(){
alert(this.message);
}
return this;
}
var service = new MyWebService();
service.showMsg();
That way you can mimic the way classes work - you create functions that have methods.
Is this what you wanted?
Upvotes: 1