Passing ParamArray to a webservice

Discussion in 'ASP .Net Web Services' started by rituchandra0972@gmail.com, Oct 13, 2006.

  1. Guest

    Hi,

    I have a webservice with a webmethod that accepts two parameters
    defined as
    <WebMethod()> _
    Public Function GetData(ByVal strID As String, _
    ByVal ParamArray Params As String()) As
    Xml.XmlNode


    When this web service is consumed in front end, the proxy class
    generates a signature that looks something like this

    Public Function GetData(ByVal strID As String, ByVal Params()
    As String) As System.Xml.XmlNode


    If you notice the keyword 'ParamArray' is missing. Now when I send
    multiple parameters all is fine. That is if the call looks something
    like this

    Arr(0) = "Test"
    xmlData = GetData("SOME_STRING", Arr)

    The code goes through fine. But if I try something like this

    Arr(0) = "Test"
    xmlData = GetData("SOME_STRING") ' with the second paramArray
    parameter missing

    then I get compilation error. This is because the signature of the
    calling function does not match with that of the proxy generated for
    the consumer app. But if I change the signature of the proxy function
    explictly to something like this

    Public Function GetData(ByVal strID As String, ByVal ParamArray Params
    As String()) As System.Xml.XmlNode

    Then it works.

    What can I do to ensure that the proxy is correctly generated from the
    webmethod signature for ParamArray cases?

    Would appreciate some insights into the matter.

    Thanks
    Ritu
    , Oct 13, 2006
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > Hi,
    >
    > I have a webservice with a webmethod that accepts two parameters
    > defined as
    > <WebMethod()> _
    > Public Function GetData(ByVal strID As String, _
    > ByVal ParamArray Params As String()) As
    > Xml.XmlNode
    >
    >
    > When this web service is consumed in front end, the proxy class
    > generates a signature that looks something like this
    >
    > Public Function GetData(ByVal strID As String, ByVal Params()
    > As String) As System.Xml.XmlNode
    >
    >
    > If you notice the keyword 'ParamArray' is missing. Now when I send
    > multiple parameters all is fine. That is if the call looks something
    > like this
    >
    > Arr(0) = "Test"
    > xmlData = GetData("SOME_STRING", Arr)
    >
    > The code goes through fine. But if I try something like this
    >
    > Arr(0) = "Test"
    > xmlData = GetData("SOME_STRING") ' with the second paramArray
    > parameter missing
    >
    > then I get compilation error. This is because the signature of the
    > calling function does not match with that of the proxy generated for
    > the consumer app. But if I change the signature of the proxy function
    > explictly to something like this
    >
    > Public Function GetData(ByVal strID As String, ByVal ParamArray Params
    > As String()) As System.Xml.XmlNode
    >
    > Then it works.
    >
    > What can I do to ensure that the proxy is correctly generated from the
    > webmethod signature for ParamArray cases?
    >
    > Would appreciate some insights into the matter.


    There is no such thing as ParamArray in web services!

    Consider that web services are meant to be cross-platform. Many (if not
    most) platforms don't have the concept of "paramarray".

    John
    John Saunders, Oct 13, 2006
    #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. batista
    Replies:
    1
    Views:
    896
    Laurent Bugnion
    Jan 26, 2006
  2. batista
    Replies:
    0
    Views:
    551
    batista
    Jan 26, 2006
  3. Mr. x
    Replies:
    2
    Views:
    703
    Andrew
    Oct 10, 2003
  4. Cyril
    Replies:
    2
    Views:
    4,485
    Cyril
    Jun 1, 2006
  5. Mr. x

    use another webservice in a webservice

    Mr. x, Sep 26, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    137
    Mr. x
    Sep 26, 2003
Loading...

Share This Page