Create a new dictionary in a SOAP envelope

Pretty simple question, but I can not find the answer anywhere.

How do you specify a new instance of Dictionary<string, string> in SOAP? Basically, I have this envelope (missing the top tag of the top level of the envelope for readability):

 <soapenv:Body> <tem:LogInWithCredentials> <tem:Request> <ttf1:Password>password</ttf1:Password> <ttf1:UserName>username</ttf1:UserName> <ttf1:RequestInfo></ttf1:RequestInfo> </tem:Request> </tem:LogInWithCredentials> </soapenv:Body> 

RequestInfo is the property in question, but always null . I assumed that only the presence of a property in the shell will be deserialized into an empty Dictionary<string, string> , however this is not the case.

+7
c # soap wcf
source share
1 answer

As @flem says, a DataContractSerializer can provide the keys needed to answer this question. Serializing an empty dictionary gives the following XML. Try it in the RequestInfo element and see if it works (I have not tested it myself).

 <ArrayOfKeyValueOfstringstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /> 
+1
source share

All Articles