There is an external SOAP server that I'm trying to connect and make requests using the python-django framework with the zeep library.
The WSDL dump is as follows:
Prefixes:
xsd: http://www.w3.org/2001/XMLSchema
ns0: http://tempuri.org/
Global elements:
ns0:GetJobCards(key: xsd:string, technicianID: xsd:string, jobCardNumber: xsd:string, jobcards: ns0:ArrayOfJobCardsEnt, message: xsd:string)
ns0:GetJobCardsResponse(GetJobCardsResult: xsd:boolean, jobcards:ns0:ArrayOfJobCardsEnt, message: xsd:string)
Global types:
xsd:anyType
ns0:ArrayOfJobCardsEnt(JobCardsEnt: {schema: , _value_1: ANY}[])
xsd:ID
xsd:IDREF
xsd:IDREFS
xsd:NCName
xsd:NMTOKEN
xsd:NMTOKENS
xsd:NOTATION
xsd:Name
xsd:QName
xsd:anySimpleType
xsd:anyURI
xsd:base64Binary
xsd:boolean
xsd:byte
xsd:date
xsd:dateTime
xsd:decimal
xsd:double
xsd:duration
xsd:float
xsd:gDay
xsd:gMonth
xsd:gMonthDay
xsd:gYear
xsd:gYearMonth
xsd:hexBinary
xsd:int
xsd:integer
xsd:language
....
Bindings:
Soap11Binding: {http://tempuri.org/}CallSoap
Soap12Binding: {http://tempuri.org/}CallSoap12
Service: Call
Port: CallSoap (Soap11Binding: {http://tempuri.org/}CallSoap)
Operations:
GetJobCards(key: xsd:string, technicianID: xsd:string,
jobCardNumber: xsd:string, jobcards: ns0:ArrayOfJobCardsEnt,
message: xsd:string) -> GetJobCardsResult: xsd:boolean,
jobcards: ns0:ArrayOfJobCardsEnt, message: xsd:string
....(some other operations)
One of the calls is to get a list of jobCards with the following schema
<s:element name="GetJobCards">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="key" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="technicianID" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="jobCardNumber" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="jobcards" type="tns:ArrayOfJobCardsEnt"/>
<s:element minOccurs="0" maxOccurs="1" name="message" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfJobCardsEnt">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="JobCardsEnt" nillable="true">
<s:complexType>
<s:sequence>
<s:element ref="s:schema"/>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
When I make the call using Postman I send the following request and it works:
<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>
<GetJobCards xmlns="http://tempuri.org/">
<key>some_valid_key</key>
<technicianID>some_technician_id</technicianID>
<jobCardNumber></jobCardNumber>
<jobcards></jobcards>
<message>""</message>
</GetJobCards>
</soap:Body>
Please note that the values for "jobCardNumber" and "jobcards" need to be empty to get all the jobCards. But I cannot seem to replicate this same call using the zeep library.
Here is what I have tried.
1 - tried adding xsd.SkipValue for the empty values
request_data = {
'key': some_valid_key,
'technicianID': some_technician_ID,
'jobCardNumber': xsd.SkipValue,
'jobcards': xsd.SkipValue,
'message': ''
}
response_body = client.service.GetJobCards(**request_data)
2 - setting the values to Nil
from zeep.xsd import Nil
jobCardEnt = client.get_type('ns0:ArrayOfJobCardsEnt')
jobCardEnt = jobCardEnt()
request_data = {
'key': some_valid_key,
'technicianID': some_technician_ID,
'jobCardNumber': Nil,
'jobcards': Nil,
'message': ''
}
response_body = client.service.GetJobCards(**request_data)
None of these seems to works and I'm not sure how to get it to work.
Can someone please guide me on this?
Thanks in advance!