Passing ParamArray to a webservice

R

rituchandra0972

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
 
J

John Saunders

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top