Pretty basic question, but I can't seem to find the answer anywhere.
How do you specify a new instance of a Dictionary<string, string>
in SOAP? Basically I have this envelope (ommitted envelope top level tag 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 it's always null
. I assumed that just the presence of the property in the envelope would be deserialized into an empty Dictionary<string, string>
, however this is not the case.
Now, you will create a global Data Dictionary (“DDIC”) structure: In the toolbar, select New, then choose Other ABAP Repository Object. In the wizard that appears, filter the list of ABAP repository object types by entering **struct**.
A dictionary in Python is made up of key-value pairs. In the two sections that follow you will see two ways of creating a dictionary. The first way is by using a set of curly braces, {}, and the second way is by using the built-in dict () function. To create an empty dictionary, first create a variable name which will be the name of the dictionary.
Log on to a crawl server. Open a new file in a text editor. Type the words that you want in the custom dictionary according to the rules stated in Rules for creating a custom dictionary earlier in this article. On the File menu, click Save As.
To know the format, simply visit the SOAP URL and click on CountryISOCode link and format the XML accordingly. Then you simply prepare the headers and make the POST call. Now that we have seen how to make SOAP calls with requests, we are going to see how easy it is to make it through Zeep.
As @flem says, the DataContractSerializer might provide the clues needed to answer this. Serializing an empty dictionary gives the following XML. Give that a try in your RequestInfo element and see if it works (I've not tested it myself).
<ArrayOfKeyValueOfstringstring
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With