Reputation:
I have an .aspx page that can perform a number of functions. The type of function is determined at run-time depending on which button the user clicks. This makes makes a web-service call to an .asmx method. The web-service call returns html and javascript which then become part of the original page.
This new content has javascript events attached to button clicks, data validation etc. In turn these events then call their own web-service methods in another .asmx file. The main page does not know about these other .asmx files when the page loads.
So, is there any way of dynamically loading these .asmx files on demand?
Upvotes: 0
Views: 1432
Reputation: 1
Check out this link for the project code! That helps you call the web service at run-time. You can save and reuse the web service structure. There is a simple example:
//how to use service proxy
var factory = new ProxyFactory();
var service = factory.ImportService("www.site.net/webservice.asmx");
//how to call service method
var proxy = new Proxy(service.ServiceFile, service.ServiceName);
var result = proxy.InvokeMethod("CallMe", new ProxyMember("Id", 123));
//how to use method result
foreach (var item in result)
{
var Id = item.Members["Id"].Value;
}
Upvotes: -1
Reputation: 161821
"ASMX files" are not loaded. They are files which define ASMX web services - which area called. You don't need to load these files.
Upvotes: 0
Reputation: 19911
You can create an assembly dynamically from the webservice, we do this where I work. Check out this codeproject link for an example that you can work from.
(disclaimer, I only gave the codeproject page a quick once over to see that it should be a good start for what you want, it's along the same lines of what we do)
Upvotes: 0