Invoke methods dinamically with out parameters in c#

Discussion in 'ASP .Net Web Services' started by cchasqueira@hotmail.com, May 31, 2004.

  1. Guest

    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);




    **********************************************************************
    Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
    Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
    , May 31, 2004
    #1
    1. Advertising

  2. Jan Tielens Guest

    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

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


    "Catia CC" <> schreef in bericht
    news:...
    > 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.InvokeMeth
    od,null,sc,args);
    >
    >
    >
    >
    > **********************************************************************
    > Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
    > Comprehensive, categorised, searchable collection of links to ASP &

    ASP.NET resources...
    Jan Tielens, Jun 1, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jerry051
    Replies:
    2
    Views:
    727
    Oliver Sturm
    Aug 2, 2005
  2. =?Utf-8?B?Vmk=?=
    Replies:
    2
    Views:
    348
    Karl Seguin
    Nov 2, 2004
  3. =?Utf-8?B?ZGF2aWQ=?=

    out parameters for Web Service methods

    =?Utf-8?B?ZGF2aWQ=?=, Jun 22, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    443
    John Saunders [MVP]
    Jun 22, 2007
  4. Shadi Rafeh
    Replies:
    0
    Views:
    159
    Shadi Rafeh
    Jun 9, 2006
  5. Kenneth McDonald
    Replies:
    5
    Views:
    301
    Kenneth McDonald
    Sep 26, 2008
Loading...

Share This Page