Skip to content

Rethinking the use of Chameleon schemas in #879 #887

@apollo13

Description

@apollo13

This is a follow up to #879. After the fixes there I was finally able to generate demo SOAP requests.

For tests I am using the WSDL from the tests itself:

python-zeep/tests/test_wsdl.py

Lines 1040 to 1106 in 713c779

<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://Example.org"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
targetNamespace="http://Example.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema elementFormDefault="qualified" >
<xsd:element name="AddResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" ref="demo" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Add">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" name="a" type="xsd:int" />
<xsd:element minOccurs="1" name="b" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AddResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="result" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema elementFormDefault="qualified" >
<xsd:element name="demo">
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ICalculator_Add_InputMessage">
<wsdl:part name="parameters" element="Add" />
</wsdl:message>
<wsdl:message name="ICalculator_Add_OutputMessage">
<wsdl:part name="parameters" element="AddResponse" />
</wsdl:message>
<wsdl:portType name="ICalculator">
<wsdl:operation name="Add">
<wsdl:input wsaw:Action="http://Example.org/ICalculator/Add" message="tns:ICalculator_Add_InputMessage" />
<wsdl:output wsaw:Action="http://Example.org/ICalculator/AddResponse" message="tns:ICalculator_Add_OutputMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DefaultBinding_ICalculator" type="tns:ICalculator">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Add">
<soap:operation soapAction="http://Example.org/ICalculator/Add" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CalculatorService">
<wsdl:port name="ICalculator" binding="tns:DefaultBinding_ICalculator">
<soap:address location="http://Example.org/ICalculator" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

I am attaching several requests using multiple clients.

First off, SOAP UI:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <Add>
         <a>?</a>
         <b>?</b>
      </Add>
   </soapenv:Body>
</soapenv:Envelope>

Then against Liquid studio (which got mentioned in the previous issue):

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <Add xmlns:tns="http://Example.org" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <a>-3439</a>
      <b>1611</b>
    </Add>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

And then zeep itself (on master)

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsa:Action>http://Example.org/ICalculator/Add</wsa:Action>
      <wsa:MessageID>urn:uuid:e1036f6a-04e1-459b-8795-a27f14a4da81</wsa:MessageID>
      <wsa:To>http://127.0.0.1:8000</wsa:To>
   </soap-env:Header>
   <soap-env:Body>
      <ns0:Add xmlns:ns0="http://Example.org">
         <ns0:a>3</ns0:a>
         <ns0:b>3</ns0:b>
      </ns0:Add>
   </soap-env:Body>
</soap-env:Envelope>

Zeep is the only client inheriting the target namespace of the wsdl definition; this might be wrong. Do you have any ideas what the "correct" approach is? The results are clearly different (no namespace vs a namespace)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions