How to use the zeep.wsdl.wsdl.Document function in zeep

To help you get started, we’ve selected a few zeep examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
<input>
            
          
        
      
    
    """.strip()
    )

    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")

    header = xsd.Element(
        "{http://test.python-zeep.org/custom}auth",
        xsd.ComplexType(
            [xsd.Element("{http://test.python-zeep.org/custom}username", xsd.String())]
        ),
    )

    serialized = operation.input.serialize(
        arg1="ah1", arg2="ah2", _soapheaders=[header(username="mvantellingen")]
    )

    expected = """
github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
<input>
            
          
          <output>
            
          </output>
        
      
    
    """.strip()
    )

    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")

    response_body = load_xml(
        """
        
        
          
            
          
        
    """
    )
github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
<input>
            
          
          <output>
            
          </output>
        
      
    
    """.strip()
    )

    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")

    response_body = load_xml(
        """
        
        
          
            
              ah1
              ah2
github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
<input>
            
          
        
      
    
    """.strip()
    )

    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")

    serialized = operation.input.serialize(arg1=xsd.AnyObject(xsd.String(), "ah1"))
    expected = """
        
        
          
            
              ah1
github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
<input>
            
          
          <output>
            
          </output>
        
      
    
    """.strip()
    )

    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")

    response_body = load_xml(
        """
        
        
          
            
              mvantellingen
github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
<input>
            
          
        
      
    
    """.strip()
    )

    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")

    serialized = operation.input.serialize(
        request1={"arg1": "ah1", "arg2": "ah2"}, request2={"arg1": "ah1", "arg2": "ah2"}
    )
    expected = """
        
        
          
            
            ah1
            ah2
github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
""".strip()
    )

    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/}Binding"]
    operation = binding.get("getResult")
    assert operation.input.signature() == ""

    serialized = operation.input.serialize()
    expected = """
        
        
          
        
    """
    assert_nodes_equal(expected, serialized.content)
github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
<input>
            
            
          
        
      
    
    """.strip()
    )

    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")

    header = xsd.ComplexType(
        xsd.Sequence(
            [
                xsd.Element(
                    "{http://www.w3.org/2005/08/addressing}Action", xsd.String()
                ),
                xsd.Element("{http://www.w3.org/2005/08/addressing}To", xsd.String()),
            ]
        )
    )
    header_value = header(Action="doehet", To="server")
    serialized = operation.input.serialize(
github mvantellingen / python-zeep / tests / test_wsdl_messages_document.py View on Github external
<input>
            
          
        
      
    
    """.strip()
    )

    root = wsdl.Document(wsdl_content, None)
    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")

    header_value = etree.Element("{http://test.python-zeep.org/custom}auth")
    etree.SubElement(
        header_value, "{http://test.python-zeep.org/custom}username"
    ).text = "mvantellingen"

    serialized = operation.input.serialize(
        arg1="ah1", arg2="ah2", _soapheaders=[header_value]
    )

    expected = """
github mvantellingen / python-zeep / tests / test_wsdl_no_output_message_part.py View on Github external
<input>
            
          
          <output>
            
          </output>
        
      
    
    """
    )
    # parse the content
    root = wsdl.Document(wsdl_content, None)

    binding = root.bindings["{http://tests.python-zeep.org/tns}TestBinding"]
    operation = binding.get("TestOperation")
    # General assertions on the input
    assert (
        operation.input.body.signature(schema=root.types) == "ns0:Request(xsd:string)"
    )
    assert operation.input.header.signature(schema=root.types) == "soap-env:Header()"
    assert (
        operation.input.envelope.signature(schema=root.types)
        == "soap-env:envelope(body: xsd:string)"
    )
    assert operation.input.signature(as_output=False) == "xsd:string"