I am getting an object(not defined in my code) from a SOAP request. It prints out like this:
Print(Person)
{
'ID': '00000000-0000-0000-0000-000000000000',
'FIRST_NAME': 'Qwe',
'LAST_NAME': 'Qwe',
'MIDDLE_NAME': 'Qwe',
'TAB_NUM': '123456',
'ORG_ID': '321'
}
I am trying to define it like this, but it doesn't do the job.
class PersonClass:
def __init__(self):
self.ID = ''
self.FIRST_NAME = ''
self.LAST_NAME = ''
self.MIDDLE_NAME = ''
self.TAB_NUM = ''
self.ORG_ID = ''
def returnPerson(self):
return (self)
This is a SOAP request and response:
POST /IntegrationService/IntegrationService.asmx HTTP/1.1
Host: 192.168.56.3
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://parsec.ru/Parsec3IntergationService/FindPeople"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<FindPeople xmlns="http://parsec.ru/Parsec3IntergationService">
<sessionID>guid</sessionID>
<lastname>string</lastname>
<firstname>string</firstname>
<middlename>string</middlename>
</FindPeople>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<FindPeopleResponse xmlns="http://parsec.ru/Parsec3IntergationService">
<FindPeopleResult>
<Person>
<ORG_ID>guid</ORG_ID>
</Person>
<Person>
<ORG_ID>guid</ORG_ID>
</Person>
</FindPeopleResult>
</FindPeopleResponse>
</soap:Body>
</soap:Envelope>
- How to define a class in my code same as this object?
- Is there a py module for this cases?
Personis a dictionary a built in type of object in Python.