Webservice help with parameters

  • Thread starter Thread starter Cralis
  • Start date Start date
C

Cralis

Hi guys,

I am trying to create my web service (Std ASP.Net), and what I do is
passes a custom object I have, which has string fields. One is
'CommandName'. On the web service, I get the object, check the
CommandName, and then do something, returing a string value.

Now, I need to pass a CommandName, and a variable number of parameters
(Depending on the command). So, I was hoping to pass a Dictionary of
String,String key value pairs. No go... It all fell apart. Now, I
assume it's due to web services not liking certain types. I had the
same iss with a List<>.

Could someone advise on the best way to do this?
 
Actually, a List<String> would work, but .. I'd then have to set a
string to something like 'ParameterValue1,1'
 
I am trying to create my web service (Std ASP.Net), and what I do is
passes a custom object I have, which has string fields. One is
'CommandName'. On the web service, I get the object, check the
CommandName, and then do something, returing a string value.

Now, I need to pass a CommandName, and a variable number of parameters
(Depending on the command). So, I was hoping to pass a Dictionary of
String,String key value pairs. No go... It all fell apart. Now, I
assume it's due to web services not liking certain types. I had the
same iss with a List<>.

Could someone advise on the best way to do this?

Maybe I'm missing something, but why not just an array of strings? You have
one property which is "string CommandName" and another which is "string[]
Parameters". Why would you need the extra string in a dictionary? For the
parameter name? You could always just require that the parameters be passed
in a specific order so you don't need to worry about a name. If you must
have that second string, make another class with two string properties and
pass an array of that class.
 
Actually, a List<String> would work,

Be sure to check that it become an array at the SOAP level.
but .. I'd then have to set a
string to something like 'ParameterValue1,1'

List<X> where X has two properties Name and Value seems
more nice.

Arne
 
List<X> where X has two properties Name and Value seems
more nice.

Arne

This is what I tried...

I created an object called KeyValue, which had two properties, string
Key, and string Value.

However, as soon as I added that object to the list, and sent it, I
got an error. I can't recall the error... I'll try it again.
 
This is what I tried...

I created an object called KeyValue, which had two properties, string
Key, and string Value.

However, as soon as I added that object to the list, and sent it, I
got an error. I can't recall the error... I'll try it again.

Do that. And come back with the specific error if it still
does not work.

Arne
 
Sorry for delay.

Arne - I added a List<String> and it seems to work perfectly now, so
all sorted!

Thanks.
 
Back
Top