-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
80 lines (67 loc) · 2.83 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from datetime import datetime
import zeep
from lxml import etree
from zeep import Client
from zeep.transports import Transport
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep.wsse.username import UsernameToken
# wsdl_url = "https://b2g-disc.ppsr.gov.au/PpsrB2GService/2011/02/CollateralRegistrationSearch.svc/soap11?WSDL"
wsdl_file = 'schemas.ppsr.gov.au.2015.02.services.wsdl'
service_url = "https://b2g-disc.ppsr.gov.au/PpsrB2GService/2011/02/CollateralRegistrationSearch.svc/soap12"
method_url = "https://b2g-disc.ppsr.gov.au/PpsrB2GService/2011/02/SearchByGrantor/soap11"
username = "bra195"
password = "OurPPSRp/w1"
session = Session()
session.auth = HTTPBasicAuth(username, password)
# create the header element
#your_pretty_xml = etree.tostring (header, encoding="unicode", pretty_print=True)
#print (your_pretty_xml)
# set the header value from header element
# header_value = header(Action=method_url, To=service_url)
client = zeep.Client(wsdl=wsdl_file, wsse=UsernameToken(username, password))
header = {'TargetEnvironment': 'Discovery'}
# make the service call
request_data = {
'SearchByGrantorRequest': {
'CustomersRequestMessageId': 'ABC123',
'CustomersUserDefinedFields': [],
'AcceptGrantorIndividualSearchDeclaration': True,
'SearchCriteria': {
'CollateralClassSearchCriteria': [],
'GrantorIndividualSearchCriteria': {
'DateOfBirth': '1970-07-07',
'FamilyName': 'Smith',
'GivenNames': 'John'
},
'GrantorOrganisationSearchCriteria': {
'OrganisationName': 'Club Transport Finance Pty Ltd',
'OrganisationNumber': '119232825',
'OrganisationNumberType': 'ACN'
},
'GrantorType': 'Organisation',
'IncludeArchived': False,
'IncludeCurrent': True,
'IncludeExpired': False,
'IncludeMigratedTransitional': False,
'IncludeNonMigratedTransitional': False,
'IncludeNonTransitional': False,
'IncludeRemoved': False,
'IsPMSISearchCriteria': 'Unsupported',
'PointInTimeDateTime': '2022-12-10',
'RegistrationNumberSortOrder': 'Ascending',
'SecurityInterestsOnly': False
}
}
}
clientSearch = client.bind('Ppsr_2015_02','CollateralRegistrationSearchSoap12')
result = clientSearch.SearchByGrantor(
_soapheaders={'TargetEnvironment': 'Discovery'},
**request_data
)
# set the WSDL URL
#wsdl_url = "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL"
# set method URL
#method_url = "http://webservices.oorsprong.org/websamples.countryinfo/CountryIntPhoneCode"
# set service URL
#service_url = "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso"