SOAP: Stubs are not generated for most operations in EJBCA WSDL
intgr opened this issue · 2 comments
I'm quite clueless about both SOAP and xsdata. Sorry if I have misunderstood something about this tool. I thought that if I feed a WSDL file into the xsdata
CLI command, it will generate Python code stubs that will allow me to access the SOAP API.
However, when I tried it with the EJBCA API, it only generates some irrelevant data structures and nothing that I can use.
A copy of the EJBCA WSDL is publicly available at https://raw.githubusercontent.com/linagora/poc-ejbca-ws-client.php/master/wsdl.xml
Here's how I tried to run it:
% xsdata ejbca1.xml --kw-only --slots -mll 120
========= xsdata v24.4 / Python 3.12.3 / Platform darwin =========
Parsing document file://[...]/ejbca1.xml
Analyzer input: 23 main and 0 inner classes
Analyzer output: 23 main and 0 inner classes
Generating package: init
Generating package: generated
The output generated/definitions.py
file only has following dataclasses: Address, Binding1, Binding2, Body, ComplexContent, ComplexType, Definitions, Element, Extension, Fault1, Fault2, Input, Message, Operation1, Operation2, Output, Part, Port, PortType, Schema, Sequence, Service, Types.
But nothing for the operations/data structures I actually care about. For example I'm interested in the editUser
operation, from WSDL:
<wsdl:operation name="editUser">
<wsdl:input message="tns:editUser" name="editUser">
</wsdl:input>
<wsdl:output message="tns:editUserResponse" name="editUserResponse">
</wsdl:output>
<wsdl:fault message="tns:EjbcaException" name="EjbcaException">
</wsdl:fault>
<wsdl:fault message="tns:AuthorizationDeniedException" name="AuthorizationDeniedException">
</wsdl:fault>
<wsdl:fault message="tns:ApprovalException" name="ApprovalException">
</wsdl:fault>
<wsdl:fault message="tns:UserDoesntFullfillEndEntityProfile" name="UserDoesntFullfillEndEntityProfile">
</wsdl:fault>
<wsdl:fault message="tns:CADoesntExistsException" name="CADoesntExistsException">
</wsdl:fault>
<wsdl:fault message="tns:WaitingForApprovalException" name="WaitingForApprovalException">
</wsdl:fault>
</wsdl:operation>
Hi @intgr the cli is can generate code from from xsd, dtd, wsdl, xml and json files and relies on the file extension to switch parsers.
Update the file extension to .wsdl
❯ wget https://raw.githubusercontent.com/linagora/poc-ejbca-ws-client.php/master/wsdl.xml
--2024-05-06 17:57:49-- https://raw.githubusercontent.com/linagora/poc-ejbca-ws-client.php/master/wsdl.xml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 115721 (113K) [text/plain]
Saving to: ‘wsdl.xml’
wsdl.xml 100%[========================================================================================>] 113.01K --.-KB/s in 0.03s
2024-05-06 17:57:49 (3.33 MB/s) - ‘wsdl.xml’ saved [115721/115721]
❯ mv wsdl.xml wsdl.wsdl
❯ xsdata generate wsdl.wsdl
========= xsdata v24.4 / Python 3.11.8 / Platform linux =========
Compiling schema file:///home/chris/projects/xsdata/wsdl.wsdl
Builder: 222 main and 0 inner classes
Analyzer input: 342 main and 159 inner classes
Analyzer output: 238 main and 159 inner classes
Generating package: init
Generating package: generated.mod
Thanks a lot for the quick reply. Yes, after renaming the file, it generates the code that I expected.