How to pass the shared key KeyValuePair <Tkey, TValue> to WebMethod?

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

I have defined the above web method.

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

How can I add it to my automatically generated wsdl file? I have to define this type, because otherwise I get an empty definition in the wsdl file:

 <s:complexType name="KeyValuePairOfStringString" /> 
+4
source share
2 answers

For this particular problem, I would recommend changing the signature to

 public void Test(string key, string value) 

since I have never had web services to play well with generics. If you have other methods with similar problems, you can use the automatically generated proxy classes or pass objects as objects and drop them back into the web method.

+2
source

I have such a problem too. It looks like I will need to create a specific class at the moment.

+1
source

Source: https://habr.com/ru/post/1315411/


All Articles