Skip to content

Rethinking the use of Chameleon schemas in #879 #887

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)

Activity

  1. apollo13 commented on Dec 13, 2018

    @apollo13
    ContributorAuthor

    I've pushed a few cleanups and fixes to master...apollo13:issue887 -- I have one new failing testcase :(

  2. apollo13 commented on Dec 13, 2018

    @apollo13
    ContributorAuthor

    I have "fixed" the remaining test failure (apollo13@4de539e). Not sure if the test is wrong or the code needs more work. It basically boils down to how references should get resolved if they are not fully qualified…

  3. apollo13 commented on Dec 14, 2018

    @apollo13
    ContributorAuthor

    I've found a few more things in the XML schema docs; I'll write them up in another comment later and try to fix it.

  4. apollo13 commented on Dec 14, 2018

    @apollo13
    ContributorAuthor

    I think I was able to fix it in #888, would be glad to know what you think of it @mvantellingen

  5. mvantellingen commented on Dec 17, 2018

    @mvantellingen
    Owner

    I've merged it. Too be honest I'm not 100% sure that this is the correct approach, but it seems to work for you and doesn't break anything else so it seems valid. Better then that it doesn't get in soap land :-)

    Thanks again

  6. apollo13 commented on Dec 17, 2018

    @apollo13
    ContributorAuthor

    Thank you! Yes, there is a high chance that another edge case will need more code to handle it -- but as you pointed out, this is mostly SOAP's fault :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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