views:

41

answers:

2
 [WebMethod]
public void Test(KeyValuePair<string,string> details)
{        
}

I have defined the above web-method.

The KeyValuePair is defined in http://schemas.datacontract.org/2004/07/System.Collections.Generic

how can i add it to my wsdl auto-generated file? i have to define this type because otherwise i get an empty definition in the wsdl file:

<s:complexType name="KeyValuePairOfStringString" />
A: 

For that particular problem, I'd recommend changing the signature to

public void Test(string key, string value) 

as I've never got web services to play nicely with generics. If you have any other methods with similar problems, you can use the auto-generated proxy classes, or pass things in as objects and cast them back within the web method.

Alex Humphrey
That doesn't really work since my goal is to pass a List<KeyValuePair>actualy i started with dicitonary, and then downgraded to a list..the list actualy work, but the problem stays with the KeyValuePair<String,String> which isn't being parsed correctly by the wsdl - my guess is because i am missing the definiton of it from http://schemas.datacontract.org/2004/07/System.Collections.Genericthe problem is - that this link seems to be broken , and also i dont know how to add it to my webservice - in order the wsdl to use it to figure out what KeyValuePairOfStringString really means.
Itay Levin
my temporary solution was to manually create a class called KeyValuePairOfStringString , but then i also need KeyValuePairOfStringLong and KeyValuePairOfSomeEnumSomeOtherClass which is quite ugly!!! :(
Itay Levin
Sorry I couldn't help - be sure to revisit this post and let us know if you find a better solution!
Alex Humphrey
A: 

I am having this issue too. Looks like i will have to create a specific class(es) for now.

tkerwood
Yep, no way to workaround that issue as far as i can tell.
Itay Levin