Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / June 2004

Tip: Looking for answers? Try searching our database.

Invoke methods dinamically with out parameters in c#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cchasqueira@hotmail.com - 31 May 2004 19:17 GMT
Hi,
I'm trying to call a web service dinamically that has a method with out parameters. The way I'm calling the method is passing an object array with the parameters to invoke the method, but I can't specify which of these are out parameters. Is there any way of doing that?
This is the code I'm using to invoke the method. I'm also showing the method definition as it may help shed some light on the subject.

Thanks

Code:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute...]
public bool LaunchIncident(string strUserName, string strSummary, Variable[] varList, out int nIncidentNo, out string strError) {
           object[] results = this.Invoke("LaunchIncident", new object[] {
                       strUserName,
                       strSummary,
                       varList});
           nIncidentNo = ((int)(results[1]));
           strError = ((string)(results[2]));
           return ((bool)(results[0]));
       }

object []args = {"Someone", "", varlist, nIncidentNo, strError}; //Launch Incident
object ox = type.InvokeMember("LaunchIncident",System.Reflection.BindingFlags.InvokeMethod,null,sc,args);   
Jan Tielens - 01 Jun 2004 06:24 GMT
You can't work with weakly typed parameters or return values (e.g. object
types) on web services, unless you use the XMLInclude attribute. This is
because all the types you will be using as a parameter or return value
should be described in the WSDL.

If you want to call web services dynamically, I suggest you take a look at
Christian's tool:
http://weblogs.asp.net/cweyer/archive/2003/07/07/9769.aspx

Signature

Greetz
Jan
________________
Read my weblog: http://weblogs.asp.net/jan

> Hi,
> I'm trying to call a web service dinamically that has a method with out parameters. The way I'm calling the method is passing an object array with
the parameters to invoke the method, but I can't specify which of these are
out parameters. Is there any way of doing that?
> This is the code I'm using to invoke the method. I'm also showing the method definition as it may help shed some light on the subject.
>
[quoted text clipped - 15 lines]
> object []args = {"Someone", "", varlist, nIncidentNo, strError}; //Launch Incident
> object ox = type.InvokeMember("LaunchIncident",System.Reflection.BindingFlags.InvokeMeth
od,null,sc,args);

> **********************************************************************
> Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.