• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python suds.byte_str函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中suds.byte_str函数的典型用法代码示例。如果您正苦于以下问题:Python byte_str函数的具体用法?Python byte_str怎么用?Python byte_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了byte_str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_DocumentCache

def test_DocumentCache(tmpdir):
    cacheFolder = tmpdir.join("puffy").strpath
    cache = suds.cache.DocumentCache(cacheFolder)
    assert isinstance(cache, suds.cache.FileCache)
    assert cache.get("unga1") is None

    # TODO: DocumentCache class interface seems silly. Its get() operation
    # returns an XML document while its put() operation takes an XML element.
    # The put() operation also silently ignores passed data of incorrect type.
    # TODO: Update this test to no longer depend on the exact input XML data
    # formatting. We currently expect it to be formatted exactly as what gets
    # read back from the DocumentCache.
    content = suds.byte_str("""\
<xsd:element name="Elemento">
   <xsd:simpleType>
      <xsd:restriction base="xsd:string">
         <xsd:enumeration value="alfa"/>
         <xsd:enumeration value="beta"/>
         <xsd:enumeration value="gamma"/>
      </xsd:restriction>
   </xsd:simpleType>
</xsd:element>""")
    xml = suds.sax.parser.Parser().parse(suds.BytesIO(content))
    cache.put("unga1", xml.getChildren()[0])
    readXML = cache.get("unga1")
    assert isinstance(readXML, suds.sax.document.Document)
    readXMLElements = readXML.getChildren()
    assert len(readXMLElements) == 1
    readXMLElement = readXMLElements[0]
    assert isinstance(readXMLElement, suds.sax.element.Element)
    assert suds.byte_str(str(readXMLElement)) == content
开发者ID:azakuanov,项目名称:python_training_mantis,代码行数:31,代码来源:test_cache.py


示例2: test_avoid_imported_WSDL_fetching

        def test_avoid_imported_WSDL_fetching(self):
            # Prepare data.
            url_imported = "suds://wsdl_imported"
            wsdl_import_wrapper = wsdl_import_wrapper_format % (url_imported,)
            wsdl_import_wrapper = suds.byte_str(wsdl_import_wrapper)
            wsdl_imported = suds.byte_str(wsdl_imported_format % ("",))

            # Add to cache.
            cache = MockCache()
            store1 = MockDocumentStore(wsdl=wsdl_import_wrapper,
                wsdl_imported=wsdl_imported)
            c1 = suds.client.Client("suds://wsdl", cachingpolicy=1,
                cache=cache, documentStore=store1, transport=MockTransport())
            assert store1.mock_log == ["suds://wsdl", "suds://wsdl_imported"]
            assert len(cache.mock_data) == 1
            wsdl_object_id, wsdl_object = cache.mock_data.items()[0]
            assert wsdl_object.__class__ is suds.wsdl.Definitions

            # Reuse from cache.
            cache.mock_operation_log = []
            store2 = MockDocumentStore(wsdl=wsdl_import_wrapper)
            c2 = suds.client.Client("suds://wsdl", cachingpolicy=1,
                cache=cache, documentStore=store2, transport=MockTransport())
            assert cache.mock_operation_log == [("get", [wsdl_object_id])]
            assert store2.mock_log == []
开发者ID:ovnicraft,项目名称:suds,代码行数:25,代码来源:test_client.py


示例3: test_imported_WSDL_transport

 def test_imported_WSDL_transport(self, url):
     wsdl_import_wrapper = wsdl_import_wrapper_format % (url,)
     wsdl_imported = suds.byte_str(wsdl_imported_format % ("",))
     store = MockDocumentStore(wsdl=suds.byte_str(wsdl_import_wrapper))
     t = MockTransport(open_data=wsdl_imported)
     suds.client.Client("suds://wsdl", cache=None, documentStore=store, transport=t)
     assert t.mock_log == [("open", [url])]
开发者ID:EASYMARKETING,项目名称:suds-jurko,代码行数:7,代码来源:test_client.py


示例4: test_avoid_external_XSD_fetching

        def test_avoid_external_XSD_fetching(self):
            # Prepare document content.
            xsd_target_namespace = "balancana"
            wsdl = tests.wsdl("""\
              <xsd:import schemaLocation="suds://imported_xsd"/>
              <xsd:include schemaLocation="suds://included_xsd"/>""",
                xsd_target_namespace=xsd_target_namespace)
            external_xsd_format = """\
<?xml version='1.0' encoding='UTF-8'?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="external%d" type="string"/>
</schema>"""
            external_xsd1 = suds.byte_str(external_xsd_format % (1,))
            external_xsd2 = suds.byte_str(external_xsd_format % (2,))

            # Add to cache.
            cache = MockCache()
            store1 = MockDocumentStore(wsdl=wsdl, imported_xsd=external_xsd1,
                included_xsd=external_xsd2)
            c1 = suds.client.Client("suds://wsdl", cachingpolicy=1,
                cache=cache, documentStore=store1, transport=MockTransport())
            assert store1.mock_log == ["suds://wsdl", "suds://imported_xsd",
                "suds://included_xsd"]
            assert len(cache.mock_data) == 1
            wsdl_object_id, wsdl_object = cache.mock_data.items()[0]
            assert wsdl_object.__class__ is suds.wsdl.Definitions

            # Reuse from cache.
            cache.mock_operation_log = []
            store2 = MockDocumentStore(wsdl=wsdl)
            c2 = suds.client.Client("suds://wsdl", cachingpolicy=1,
                cache=cache, documentStore=store2, transport=MockTransport())
            assert cache.mock_operation_log == [("get", [wsdl_object_id])]
            assert store2.mock_log == []
开发者ID:ovnicraft,项目名称:suds,代码行数:34,代码来源:test_client.py


示例5: open

    def open(self, request):
        if "?wsdl" in request.url:
            return suds.BytesIO(suds.byte_str(WSDL))
        elif "?xsd" in request.url:
            return suds.BytesIO(suds.byte_str(XSD))

        pytest.fail("No supported open request url: {}".format(request.url))
开发者ID:edoburu,项目名称:django-oscar-docdata,代码行数:7,代码来源:suds_transport.py


示例6: test_accessing_DocumentStore_content

def test_accessing_DocumentStore_content():
    content1 = suds.byte_str("one")
    content2 = suds.byte_str("two")
    content1_1 = suds.byte_str("one one")

    store = suds.store.DocumentStore({"1":content1})
    assert len(store) == 2
    __test_default_DocumentStore_content(store)
    __test_open(store, "1", content1)

    store = suds.store.DocumentStore({"1":content1, "2":content2})
    assert len(store) == 3
    __test_default_DocumentStore_content(store)
    __test_open(store, "1", content1)
    __test_open(store, "2", content2)

    store = suds.store.DocumentStore(uno=content1, due=content2)
    assert len(store) == 3
    __test_default_DocumentStore_content(store)
    __test_open(store, "uno", content1)
    __test_open(store, "due", content2)

    store = suds.store.DocumentStore({"1 1":content1_1})
    assert len(store) == 2
    __test_default_DocumentStore_content(store)
    __test_open(store, "1 1", content1_1)

    store = suds.store.DocumentStore({"1":content1, "1 1":content1_1})
    assert len(store) == 3
    __test_default_DocumentStore_content(store)
    __test_open(store, "1", content1)
    __test_open(store, "1 1", content1_1)
开发者ID:dvska,项目名称:os-python-suds-jurko,代码行数:32,代码来源:test_document_store.py


示例7: test_wrapped_sequence_output

def test_wrapped_sequence_output():
    client = testutils.lxmlclient_from_wsdl(testutils.wsdl("""\
      <xsd:element name="Wrapper">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="result1" type="xsd:string"/>
            <xsd:element name="result2" type="xsd:string"/>
            <xsd:element name="result3" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>""", output="Wrapper"))

    response = client.service.f(__inject=dict(reply=suds.byte_str("""\
<?xml version="1.0"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
    <Wrapper xmlns="my-namespace">
        <result1>Uno</result1>
        <result2>Due</result2>
        <result3>Tre</result3>
    </Wrapper>
  </Body>
</Envelope>""")))

    # Check response content.
    assert len(response) == 3
    assert response.result1 == "Uno"
    assert response.result2 == "Due"
    assert response.result3 == "Tre"
    assert_lxml_string_value(response.result1)
    assert_lxml_string_value(response.result2)
    assert_lxml_string_value(response.result3)
    
    client = testutils.lxmlclient_from_wsdl(testutils.wsdl("""\
      <xsd:element name="Wrapper">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="result1" type="xsd:string"/>
            <xsd:element name="result2" type="xsd:string"/>
            <xsd:element name="result3" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>""", output="Wrapper"))

    response = client.service.f(__inject=dict(reply=suds.byte_str("""\
<?xml version="1.0"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
    <Wrapper xmlns="my-namespace">
    </Wrapper>
  </Body>
</Envelope>""")))

    # Check response content.
    assert len(response) == 3
    assert response.result1 is None
    assert response.result2 is None
    assert response.result3 is None
开发者ID:liboz,项目名称:suds-lxml,代码行数:58,代码来源:test_lxmlsuds.py


示例8: test_string_representation_with_no_message

    def test_string_representation_with_no_message(self):
        url = "look at my silly little URL"
        headers = {suds.byte_str("yuck"): suds.byte_str("ptooiii...")}
        request = Request(url)
        request.headers = headers
        expected = u("""\
URL: %s
HEADERS: %s""") % (url, request.headers)
        assert text_type(request) == expected
        if sys.version_info < (3,):
            assert str(request) == expected.encode("utf-8")
开发者ID:codingkevin,项目名称:suds,代码行数:11,代码来源:test_transport.py


示例9: test_disabling_automated_simple_interface_unwrapping

def test_disabling_automated_simple_interface_unwrapping():
    client = testutils.client_from_wsdl(testutils.wsdl("""\
      <xsd:element name="Wrapper">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="Elemento" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>""", output="Wrapper"), unwrap=False)
    assert not _isOutputWrapped(client, "f")

    response = client.service.f(__inject=dict(reply=suds.byte_str("""\
<?xml version="1.0"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
    <Wrapper xmlns="my-namespace">
        <Elemento>La-di-da-da-da</Elemento>
    </Wrapper>
  </Body>
</Envelope>""")))

    assert response.__class__.__name__ == "Wrapper"
    assert len(response.__class__.__bases__) == 1
    assert response.__class__.__bases__[0] is suds.sudsobject.Object
    assert response.Elemento.__class__ is suds.sax.text.Text
    assert response.Elemento == "La-di-da-da-da"
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:26,代码来源:test_reply_handling.py


示例10: construct_XML

    def construct_XML(element_name="Elemento"):
        """
        Construct XML content and an Element wrapping it.

        Constructed content may be parametrized with the given element name.

        """
        # TODO: Update the tests in this group to no longer depend on the exact
        # input XML data formatting. They currently expect it to be formatted
        # exactly as what gets read back from their DocumentCache.
        content = suds.byte_str("""\
<xsd:element name="%s">
   <xsd:simpleType>
      <xsd:restriction base="xsd:string">
         <xsd:enumeration value="alfa"/>
         <xsd:enumeration value="beta"/>
         <xsd:enumeration value="gamma"/>
      </xsd:restriction>
   </xsd:simpleType>
</xsd:element>""" % (element_name,))
        xml = suds.sax.parser.Parser().parse(suds.BytesIO(content))
        children = xml.getChildren()
        assert len(children) == 1
        assert children[0].__class__ is suds.sax.element.Element
        return content, children[0]
开发者ID:ovnicraft,项目名称:suds,代码行数:25,代码来源:test_cache.py


示例11: test_fault_reply_with_unicode_faultstring

def test_fault_reply_with_unicode_faultstring(monkeypatch):
    monkeypatch.delitem(locals(), "e", False)

    unicode_string = "€ Jurko Gospodnetić ČĆŽŠĐčćžšđ"
    fault_xml = suds.byte_str("""\
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <env:Fault>
      <faultcode>env:Client</faultcode>
      <faultstring>%s</faultstring>
    </env:Fault>
  </env:Body>
</env:Envelope>
""" % unicode_string)

    client = tests.client_from_wsdl(_wsdl__simple, faults=True)
    inject = dict(reply=fault_xml, status=http.client.INTERNAL_SERVER_ERROR)
    e = pytest.raises(suds.WebFault, client.service.f, __inject=inject).value
    assert e.fault.faultstring == unicode_string
    assert e.document.__class__ is suds.sax.document.Document

    client = tests.client_from_wsdl(_wsdl__simple, faults=False)
    status, fault = client.service.f(__inject=dict(reply=fault_xml,
        status=http.client.INTERNAL_SERVER_ERROR))
    assert status == http.client.INTERNAL_SERVER_ERROR
    assert fault.faultstring == unicode_string
开发者ID:azakuanov,项目名称:python_training_mantis,代码行数:27,代码来源:test_reply_handling.py


示例12: test_SOAP_headers

def test_SOAP_headers():
    """Rudimentary 'soapheaders' option usage test."""
    wsdl = suds.byte_str("""\
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions targetNamespace="my-target-namespace"
    xmlns:tns="my-target-namespace"
    xmlns:s="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <wsdl:types>
    <s:schema elementFormDefault="qualified"
        targetNamespace="my-target-namespace">
      <s:element name="MyHeader">
        <s:complexType>
          <s:sequence>
            <s:element name="Freaky" type="s:hexBinary"/>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>

  <wsdl:message name="myOperationHeader">
    <wsdl:part name="MyHeader" element="tns:MyHeader"/>
  </wsdl:message>

  <wsdl:portType name="MyWSSOAP">
    <wsdl:operation name="my_operation"/>
  </wsdl:portType>

  <wsdl:binding name="MyWSSOAP" type="tns:MyWSSOAP">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="my_operation">
      <soap:operation soapAction="my-SOAP-action" style="document"/>
      <wsdl:input>
        <soap:header message="tns:myOperationHeader" part="MyHeader"
            use="literal"/>
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="MyWS">
    <wsdl:port name="MyWSSOAP" binding="tns:MyWSSOAP">
      <soap:address location="protocol://my-WS-URL"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
""")
    header_data = "fools rush in where angels fear to tread"
    client = testutils.client_from_wsdl(wsdl, nosend=True, prettyxml=True)
    client.options.soapheaders = header_data
    _assert_request_content(client.service.my_operation(), """\
<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Header>
    <MyHeader xmlns="my-target-namespace">%s</MyHeader>
  </Header>
  <Body/>
</Envelope>""" % (header_data,))
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:60,代码来源:test_request_construction.py


示例13: _wsdl_with_no_input_data

def _wsdl_with_no_input_data(url):
    """
    Return a WSDL schema with a single operation f taking no parameters.

    Included operation returns no values. Externally specified URL is used as
    the web service location.

    """
    return suds.byte_str(u"""\
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions targetNamespace="myNamespace"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:tns="myNamespace"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:portType name="Port">
    <wsdl:operation name="f"/>
  </wsdl:portType>
  <wsdl:binding name="Binding" type="tns:Port">
    <soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="f"/>
  </wsdl:binding>
  <wsdl:service name="Service">
    <wsdl:port name="Port" binding="tns:Binding">
      <soap:address location="%s"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>""" % (url,))
开发者ID:Djiit,项目名称:suds-recursive,代码行数:29,代码来源:test_transport_http.py


示例14: test_fault_reply_with_unicode_faultstring

def test_fault_reply_with_unicode_faultstring(monkeypatch):
    monkeypatch.delitem(locals(), "e", False)

    unicode_string = u("\\u20AC Jurko Gospodneti\\u0107 "
        "\\u010C\\u0106\\u017D\\u0160\\u0110"
        "\\u010D\\u0107\\u017E\\u0161\\u0111")
    fault_xml = suds.byte_str(u("""\
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <env:Fault>
      <faultcode>env:Client</faultcode>
      <faultstring>%s</faultstring>
    </env:Fault>
  </env:Body>
</env:Envelope>
""") % (unicode_string,))

    client = testutils.client_from_wsdl(_wsdl__simple_f, faults=True)
    inject = dict(reply=fault_xml, status=http_client.INTERNAL_SERVER_ERROR)
    e = pytest.raises(suds.WebFault, client.service.f, __inject=inject).value
    try:
        assert e.fault.faultstring == unicode_string
        assert e.document.__class__ is suds.sax.document.Document
    finally:
        del e  # explicitly break circular reference chain in Python 3

    client = testutils.client_from_wsdl(_wsdl__simple_f, faults=False)
    status, fault = client.service.f(__inject=dict(reply=fault_xml,
        status=http_client.INTERNAL_SERVER_ERROR))
    assert status == http_client.INTERNAL_SERVER_ERROR
    assert fault.faultstring == unicode_string
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:32,代码来源:test_reply_handling.py


示例15: test_enum

def test_enum():
    client = testutils.lxmlclient_from_wsdl(testutils.wsdl("""\
      <xsd:element name="Wrapper">
        <xsd:element name="Size">
          <xsd:simpleType name="DataSize">
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="1" />
              <xsd:enumeration value="2"/>
              <xsd:enumeration value="3"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:element>""", output="Wrapper"))

    response = client.service.f(__inject=dict(reply=suds.byte_str("""\
<?xml version="1.0"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
    <Wrapper xmlns="my-namespace">
        <DataSize>1</DataSize>
    </Wrapper>
  </Body>
</Envelope>""")))

    # Check response content.
    assert len(response) == 1
    assert response.size == 1
开发者ID:liboz,项目名称:suds-lxml,代码行数:27,代码来源:test_lxmlsuds.py


示例16: test_invalid_fault_namespace

def test_invalid_fault_namespace(monkeypatch):
    monkeypatch.delitem(locals(), "e", False)

    fault_xml = suds.byte_str("""\
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:p="x">
  <env:Body>
    <p:Fault>
      <faultcode>env:Client</faultcode>
      <faultstring>Dummy error.</faultstring>
      <detail>
        <errorcode>ultimate</errorcode>
      </detail>
    </p:Fault>
  </env:Body>
</env:Envelope>
""")
    client = testutils.client_from_wsdl(_wsdl__simple_f, faults=False)
    inject = dict(reply=fault_xml, status=http_client.OK)
    e = pytest.raises(Exception, client.service.f, __inject=inject).value
    try:
        assert e.__class__ is Exception
        assert str(e) == "<faultcode/> not mapped to message part"
    finally:
        del e  # explicitly break circular reference chain in Python 3

    for http_status in (http_client.INTERNAL_SERVER_ERROR,
        http_client.PAYMENT_REQUIRED):
        status, reason = client.service.f(__inject=dict(reply=fault_xml,
            status=http_status, description="trla baba lan"))
        assert status == http_status
        assert reason == "trla baba lan"
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:32,代码来源:test_reply_handling.py


示例17: compare_document_to_content

 def compare_document_to_content(self, document, content):
     """Assert that the given XML document and content match."""
     assert document.__class__ is suds.sax.document.Document
     elements = document.getChildren()
     assert len(elements) == 1
     element = elements[0]
     assert element.__class__ is suds.sax.element.Element
     assert suds.byte_str(str(element)) == content
开发者ID:EASYMARKETING,项目名称:suds-jurko,代码行数:8,代码来源:test_cache.py


示例18: _encode_basic_credentials

def _encode_basic_credentials(username, password):
    """
    Encode user credentials as used in basic HTTP authentication.

    This is the value expected to be added to the 'Authorization' HTTP header.

    """
    data = suds.byte_str("%s:%s" % (username, password))
    return "Basic %s" % base64.b64encode(data).decode("utf-8")
开发者ID:ovnicraft,项目名称:suds,代码行数:9,代码来源:test_transport_http.py


示例19: _unwrappable_wsdl

def _unwrappable_wsdl(part_name, param_schema):
    """
    Return a WSDL schema byte string.

    The returned WSDL schema defines a single service definition with a single
    port containing a single function named 'f' taking automatically
    unwrappable input parameter using document/literal binding.

    The input parameter is defined as a single named input message part (name
    given via the 'part_name' argument) referencing an XSD schema element named
    'Wrapper' located in the 'my-namespace' namespace.

    The wrapper element's type definition (XSD schema string) is given via the
    'param_schema' argument.

    """
    return suds.byte_str(
        """\
<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions targetNamespace="my-namespace"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns="my-namespace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
    <xsd:schema targetNamespace="my-namespace"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="Wrapper">
%(param_schema)s
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="fRequestMessage">
    <wsdl:part name="%(part_name)s" element="ns:Wrapper" />
  </wsdl:message>
  <wsdl:portType name="dummyPortType">
    <wsdl:operation name="f">
      <wsdl:input message="ns:fRequestMessage" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="dummy" type="ns:dummyPortType">
    <soap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="f">
      <soap:operation soapAction="my-soap-action" style="document" />
      <wsdl:input><soap:body use="literal" /></wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="dummy">
    <wsdl:port name="dummy" binding="ns:dummy">
      <soap:address location="unga-bunga-location" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>"""
        % {"param_schema": param_schema, "part_name": part_name}
    )
开发者ID:dengchangtao,项目名称:bagis-basin-analysis-gis,代码行数:57,代码来源:test_input_parameters.py


示例20: test_builtin_typed_element_parameter

def test_builtin_typed_element_parameter(part_name):
    """
    Test correctly recognizing web service operation input structure defined by
    a built-in typed element.

    """
    wsdl = suds.byte_str(
        """\
<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions targetNamespace="my-namespace"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns="my-namespace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
    <xsd:schema targetNamespace="my-namespace"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="MyElement" type="xsd:integer" />
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="fRequestMessage">
    <wsdl:part name="%s" element="ns:MyElement" />
  </wsdl:message>
  <wsdl:portType name="dummyPortType">
    <wsdl:operation name="f">
      <wsdl:input message="ns:fRequestMessage" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="dummy" type="ns:dummyPortType">
    <soap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="f">
      <soap:operation soapAction="my-soap-action" style="document" />
      <wsdl:input><soap:body use="literal" /></wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="dummy">
    <wsdl:port name="dummy" binding="ns:dummy">
      <soap:address location="unga-bunga-location" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>"""
        % (part_name,)
    )
    client = tests.client_from_wsdl(wsdl, nosend=True)

    # Collect references to required WSDL model content.
    method = client.wsdl.services[0].ports[0].methods["f"]
    assert not method.soap.input.body.wrapped
    binding = method.binding.input
    assert binding.__class__ is suds.bindings.document.Document
    my_element = client.wsdl.schema.elements["MyElement", "my-namespace"]

    param_defs = binding.param_defs(method)
    _expect_params(param_defs, [("MyElement", my_element)])
开发者ID:dengchangtao,项目名称:bagis-basin-analysis-gis,代码行数:56,代码来源:test_input_parameters.py



注:本文中的suds.byte_str函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python multiref.MultiRef类代码示例发布时间:2022-05-27
下一篇:
Python sudoku.Sudoku类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap