Generic Webservice methods

Discussion in 'ASP .Net Web Services' started by Robby Valles, Oct 21, 2007.

  1. Robby Valles

    Robby Valles Guest

    Hello,

    I have a webservice with a static signature, that we have a custom
    request and result class to handle different webmethods/services.

    [WebMethod]
    public MyResult Process( MyRequest r )

    Currently, we have one proxy class generated and all webservice calls
    point to this Process method. I am trying to figure out if we can have
    mulitple web methods and call them dynamically by changing the
    MethodName at runtime in the web proxy. Right now all we do is change
    the url ex( localhost/search.asmx | localhost/createcustomer.asmx )
    and use the same Process method. This works nicely as we dont have to
    keep refreshing the web reference everytime we add a webservice.

    When i try to change the webmethod name at runtime. I'm getting an
    ArugmentException saying "GetUserList Web Service method name is not
    valid.". This is happening in the BeforeSerialize method of
    SoapHttpClientProtocol

    at
    System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRequest
    request, String methodName, Object[] parameters)
    at
    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
    methodName, Object[] parameters)
    at MyService.Process(MyRequest r) in


    Is there anyway I can call different webmethods at runtime without
    knowing the name at compile time and without regenerating the proxy
    class, since all request contracts are the same?

    Thanks,

    Robby
    Robby Valles, Oct 21, 2007
    #1
    1. Advertising

  2. "Robby Valles" <> wrote in message
    news:...
    > Hello,
    >
    > I have a webservice with a static signature, that we have a custom
    > request and result class to handle different webmethods/services.

    ....

    > Is there anyway I can call different webmethods at runtime without
    > knowing the name at compile time and without regenerating the proxy
    > class, since all request contracts are the same?


    Sure. Don't use proxy classes. Build and send the SOAP messages yourself.
    --
    --------------------------------------------------------------------------------
    John Saunders | MVP - Windows Server System - Connected System Developer
    John Saunders [MVP], Oct 23, 2007
    #2
    1. Advertising

  3. Robby Valles

    Robby Valles Guest

    John,

    Is there any way to do it and still use the proxy class?

    Robby Valles

    On Oct 22, 5:27 pm, "John Saunders [MVP]" <john.saunders at
    trizetto.com> wrote:
    > "Robby Valles" <> wrote in message
    >
    > news:...> Hello,
    >
    > > I have a webservice with a static signature, that we have a custom
    > > request and result class to handle different webmethods/services.

    >
    > ...
    >
    > > Is there anyway I can call different webmethods at runtime without
    > > knowing the name at compile time and without regenerating the proxy
    > > class, since all request contracts are the same?

    >
    > Sure. Don't use proxy classes. Build and send the SOAP messages yourself.
    > --
    > ---------------------------------------------------------------------------­-----
    > John Saunders | MVP - Windows Server System - Connected System Developer
    Robby Valles, Nov 2, 2007
    #3
  4. "Robby Valles" <> wrote in message
    news:...
    John,

    Is there any way to do it and still use the proxy class?


    I don't even understand what you're asking, and I'm not sure that you do,
    either.

    Why do you need to be unaware of the methods you're calling until run time?
    How will the users of your proxy class indicate which methods they want to
    call, and with which parameters? How will they process the results?

    I think you should tell us what you're trying to accomplish. What you've
    described so far makes very little sense.
    --
    --------------------------------------------------------------------------------
    John Saunders | MVP - Windows Server System - Connected System Developer
    John Saunders [MVP], Nov 3, 2007
    #4
    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. Ike
    Replies:
    0
    Views:
    529
  2. Murat Tasan
    Replies:
    1
    Views:
    8,040
    Chaitanya
    Feb 3, 2009
  3. Replies:
    2
    Views:
    434
  4. minlearn
    Replies:
    2
    Views:
    454
    red floyd
    Mar 13, 2009
  5. Kenneth McDonald
    Replies:
    5
    Views:
    313
    Kenneth McDonald
    Sep 26, 2008
Loading...

Share This Page