0

I want to convert Soap response in an array , My response is as follows :

<?xml version="1.0" ?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:ServerVersionInfo ......../>
    </s:Header>
    <s:Body>
        <m:FindItemResponse .......>
            <m:ResponseMessages>
                <m:FindItemResponseMessage ResponseClass="Success">
                    <m:ResponseCode>NoError</m:ResponseCode>
                    <m:RootFolder IncludesLastItemInRange="false" IndexedPagingOffset="2" TotalItemsInView="3">
                        <t:Items>
                            <t:Contact>
                                <t:ItemId ChangeKey=".." Id="....."/>
                                <t:ParentFolderId ChangeKey="AQAAAA==" Id="AQMkADc5Y2ViMmY5LTU0OTkALTQ1NmItODU0OS02ZDc4ZjZmNzM3MzIALgAAA71jNmenEatOn4H7Ntp3sEUBAMkdzXyQLFpDkRbRsnVGlRoAAAIBDwAAAA=="/>
                                <t:ItemClass>IPM.Contact</t:ItemClass>
                                <t:Subject>teting kk dev</t:Subject>
                                <t:Sensitivity>Normal</t:Sensitivity>
                                <t:DateTimeReceived>2013-10-04T11:05:39Z</t:DateTimeReceived>
                                .
                                .
                                .
                                .
                                <t:EmailAddresses>
                                    <t:Entry Key="EmailAddress1">test@test.com</t:Entry>
                                </t:EmailAddresses>
                                <t:Surname>dev</t:Surname>
                            </t:Contact>
                            <t:Contact>
                                .
                                .
                                .
                                .
                                .
                            </t:Contact>
                        </t:Items>
                    </m:RootFolder>
                </m:FindItemResponseMessage>
            </m:ResponseMessages>
        </m:FindItemResponse>
    </s:Body>
</s:Envelope>

I mainly want things inside this is an array so that if I want to use subject , I can access it as arr['Subject'] and returns testing kk dev.

So Please suggest me some way to do this . Thanks

Inforian
  • 1,716
  • 5
  • 21
  • 42
  • http://stackoverflow.com/questions/11653309/parsing-a-soap-response-in-python & http://stackoverflow.com/questions/206154/whats-the-best-soap-client-library-for-python-and-where-is-the-documentation-f – tehsockz Oct 07 '13 at 06:00
  • Thanks for your response , but I found this http://stackoverflow.com/questions/11390556/processing-xml-in-python-with-elementtree and I guess I am really close but I got struck into displaying the tag value , If i print "i.tag" then is display subject but I don't know how to get subject value means "testing kk dev" – Inforian Oct 07 '13 at 06:18
  • `print i.tag, i.attrib` – Steve Barnes Oct 07 '13 at 07:34
  • @Steve : Thanks , but what I want that will be fulfil by i.text – Inforian Oct 07 '13 at 09:12

0 Answers0