Adding more information that needs to be done in below :
My API Call looks something like this: ( Ignore the format & coding as this is a test code the actual code i have works fine)
from zeep import Client
from zeep.transports import Transport
from requests import Session
from requests.auth import HTTPBasicAuth
from pyspark.sql.types import StructType, StructField, StringType, BooleanType
from pyspark.sql.functions import lit
from datetime import datetime
wsdl_url = "Test.xml"
session = Session()
session.auth = HTTPBasicAuth('abc','password')
transport = Transport(session=session)
client = Client(wsdl=wsdl_url, transport=transport)
# List all available services and ports
print(client.wsdl.services)
# Ensure the service and port names are correct
service_name = 'Test'
port_name = 'TestPort'
# Verify the available services and ports
for service in client.wsdl.services.values():
print(f"Service: {service.name}")
for port in service.ports.values():
print(f" Port: {port.name}")
# Bind to the correct service and port
service = client.bind("Test", "BasicHttpBinding_TestService")
request_data = {
'userAuth': {
'Nickname':"Test"
},
'requestReference': 'test',
'request': {
'Subject': {
'Forename': 'Patricia',
'Surname': 'Carroll'
},
'Address': {
'AddressLine1': '123 Test Street',
'AddressLine2': '',
'AddressLine3': 'LONDON',
'Postcode': 'ABC 123'
},
'ConsentFlag': True
}
}
if service:
response = service.PerformIDCheckV2(**request_data)
# Define the schema explicitly
schema = StructType([
StructField("FirstName", StringType(), True),
StructField("SurName", StringType(), True),
StructField("response", StringType(), True),
StructField("ETLApplyDateTime", StringType(), True)
])
We can see above where i have hardcoded Patricia Name, i want those names to be passed as input from the above sql output