You know how SOAPUI can generate a complete XML template for a SOAP web service? I want to do that, but using the Python module Zeep.
I'm following the first example from here. I'm also referencing the Zeep Documentation.
Note: the web service I'm using is a public facing Workday web service and has NO customer data. More information is here.
Here is my code:
wsdl = "https://community.workday.com/sites/default/files/file-hosting/productionapi/Resource_Management/v33.1/Resource_Management.wsdl"
client = Client(wsdl)
message = client.create_message(client.service, "Get_Purchase_Items")
tree = ET.ElementTree(message)
xml = tree.write('test.xml',pretty_print=True)
The problem: This doesn't create a full XML template like SOAPUI does.
Here is what my code creates:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<ns0:Get_Purchase_Items_Request xmlns:ns0="urn:com.workday/bsvc"/>
</soap-env:Body>
</soap-env:Envelope>
This is what SOAPUI creates (and what I'm looking for from zeep):
<soapenv:Header>
<bsvc:Workday_Common_Header>
<!--Optional:-->
<bsvc:Include_Reference_Descriptors_In_Response>?</bsvc:Include_Reference_Descriptors_In_Response>
</bsvc:Workday_Common_Header>
</soapenv:Header>
<soapenv:Body>
<bsvc:Get_Purchase_Items_Request bsvc:version="?">
<!--You have a CHOICE of the next 2 items at this level-->
<!--Optional:-->
<bsvc:Request_References>
<!--1 or more repetitions:-->
<bsvc:Purchase_Item_Reference bsvc:Descriptor="?">
<!--Zero or more repetitions:-->
<bsvc:ID bsvc:type="?">?</bsvc:ID>
</bsvc:Purchase_Item_Reference>
</bsvc:Request_References>
<!--Optional:-->
<bsvc:Request_Criteria>
<!--Zero or more repetitions:-->
<bsvc:Supplier_Reference bsvc:Descriptor="?">
<!--Zero or more repetitions:-->
<bsvc:ID bsvc:type="?">?</bsvc:ID>
</bsvc:Supplier_Reference>
<!--Zero or more repetitions:-->
<bsvc:Supplier_Contract_Reference bsvc:Descriptor="?">
<!--Zero or more repetitions:-->
<bsvc:ID bsvc:type="?">?</bsvc:ID>
</bsvc:Supplier_Contract_Reference>
<!--Optional:-->
<bsvc:Return_All_Advanced_Pricing>?</bsvc:Return_All_Advanced_Pricing>
<!--Optional:-->
<bsvc:Return_Active_Advanced_Pricing>?</bsvc:Return_Active_Advanced_Pricing>
<!--Optional:-->
<bsvc:Exclude_Pricing_Calculated_by_Conversion_Factor>?</bsvc:Exclude_Pricing_Calculated_by_Conversion_Factor>
</bsvc:Request_Criteria>
<!--Optional:-->
<bsvc:Response_Filter>
<!--Optional:-->
<bsvc:As_Of_Effective_Date>?</bsvc:As_Of_Effective_Date>
<!--Optional:-->
<bsvc:As_Of_Entry_DateTime>?</bsvc:As_Of_Entry_DateTime>
<!--Optional:-->
<bsvc:Page>?</bsvc:Page>
<!--Optional:-->
<bsvc:Count>?</bsvc:Count>
</bsvc:Response_Filter>
<!--Optional:-->
<bsvc:Response_Group>
<!--Optional:-->
<bsvc:Include_Reference>?</bsvc:Include_Reference>
</bsvc:Response_Group>
</bsvc:Get_Purchase_Items_Request>
</soapenv:Body>
</soapenv:Envelope>
Questions
- How can I generate the full template with Zeep?
- Is there a different function from create_message() that will do this?
- Is there another Python module that will do this?
I posted a similar question two months ago, but moved on after I found a workaround. However, I keep coming back to this because it's really bugging me. So if someone could help me out I'd really appreciate it!