Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a new Dictionary in a SOAP Envelope

Tags:

c#

soap

wcf

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.

like image 240
mattytommo Avatar asked Apr 02 '14 12:04

mattytommo


People also ask

How do I create a global data dictionary in SAP?

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**.

How do I create a dictionary in Python?

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.

How do I create a custom dictionary on a crawl server?

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.

How to make soap calls with requests in ZEEP?

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.


1 Answers

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" />
like image 177
Matthew Steeples Avatar answered Oct 24 '22 19:10

Matthew Steeples