2

I'm pretty new to python and brand new to web services. I recently started on a project that I'm very passionate about and which has been a wonderful learning opportunity. However I'm very stuck after weeks of research and could use some help.

What I'm trying to do is make my own WSDL interface that works similar to SOAPUI. My program will parse any Workday WSDL file for necessary information, return a sample request template, allow the user to edit that template, and finally submit the xml to the Workday server.

Right now my program allows a user to submit Get and Put requests with preexisting xml templates. What I don't understand is how the Request/Response templates are generated from the WSDL. I'm not interested in tools, I want to understand how they do it so I can make my own.

EXAMPLE

The "Workday WSDL File" linked above is called Resource Management. I would download that WSDL from the Workday server in order to access the associated operations. One such operation is called "Get_Purchase_Item_Request". I would then generate the sample xml request from this WSDL, and get something like the following as a result:

<bsvc:Get_Purchase_Items_Request xmlns:bsvc="urn:com.workday/bsvc" bsvc:version="string">
   <!--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="string">
       <!-- Zero or more repetitions: -->
       <bsvc:ID bsvc:type="string">string</bsvc:ID>
     </bsvc:Purchase_Item_Reference>
   </bsvc:Request_References>
</bsvc:Get_Purchase_Items_Request>

What I've tried:

  1. I use python's ElementTree module to handle the XML in my current program. I've poured over the docs but cannot see a way to generate the samples without a deeper understanding of how it's done in existing systems
  2. I have located what I think generates templates inside the open source SOAPUI code, trying to understand how they do it. The problem here is I don't know Java enough to use their code. Besides, I want to continue on how I currently am using python.
  3. The Zeep module is often recommended for handling SOAP clients. I'm currently learning how to use it. However, again, because I don't understand how the templates are generated, I'm struggling to use Zeep to make it happen. Also again, I'd like to continue as I have been, using ElementTree and Python. Even if I could manage to make it happen with Zeep, I still wouldn't understand how the templates are generated.
  4. I have created classes in my python code that handle the various parts of the WSDL file. I don't understand how to combine the various parts into an XML template.

TLDR: How are XML Templates generated from WSDL files? How can I parse a WSDL containing multiple operations and generate an XML template for one, specifically?

ChaserAide
  • 111
  • 1
  • 7
  • Are you looking for a way to create the "sample request" XML **by using the WSDL as input** or do you just want to know how to generate an XML file that looks like this sample? – mzjn Sep 26 '19 at 08:11
  • If I understand your question correctly, I want to use the WSDL as input. I want to be able to select any service listed in the WSDL and generate the sample request for it. Like SOAPUI does. Just, with pure python and not a tool or zeep. – ChaserAide Sep 27 '19 at 02:53
  • I don't really understand, but it seems like quite a big undertaking. Can you narrow this down to something smaller and more concrete? Have you tried anything at all? – mzjn Sep 27 '19 at 05:08
  • Thanks for responding @mzjn. I'm trying to understand how an XML Template is created from the information inside a WSDL. My understanding is that a WSDL contains all information about a web service. So that must include the template needed to interact with an operation in the web service. How is this done? Every answer I've seen points to soapui or zeep, but now how those tools actually do it. – ChaserAide Sep 27 '19 at 20:32
  • IMHO, the question is still too broad. Asking "how is this done?" for something that appears to be quite complex does not seem like a good idea. You have not presented a **concrete, reproducible problem**. The question is tagged "python" and "elementtree", but there is not a single line of Python code for us to look at. – mzjn Sep 29 '19 at 06:36

0 Answers0