【问题标题】:spyne - generating xsd for requests that does not require explicit statement of namespace for each input parameterspyne - 为不需要为每个输入参数显式声明命名空间的请求生成 xsd
【发布时间】:2020-04-23 09:20:46
【问题描述】:

目前,我基于 Spyne 的 WSGI 应用程序为如下请求生成 XSD:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aso="asoapns">
   <soapenv:Header/>
   <soapenv:Body>
      <aso:findSpace>
         <aso:Volume>?</aso:Volume>
         <aso:Area>?</aso:Area>
         <aso:Atmosphere>?</aso:Atmosphere>
         <aso:Location>?</aso:Location>
      </aso:findSpace>
   </soapenv:Body>
</soapenv:Envelope>

是否可以在没有命名空间的情况下指定输入参数?即例如:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aso="asoapns">
   <soapenv:Header/>
   <soapenv:Body>
      <aso:findSpace>
         <Volume>?</Volume>
         <Area>?</Area>
         <Atmosphere>?</Atmosphere>
         <Location>?</Location>
      </aso:findSpace>
   </soapenv:Body>
</soapenv:Envelope>

或者这是 SOAP API 的自然要求?

【问题讨论】:

    标签: python web-services soap xsd spyne


    【解决方案1】:

    在应用程序规范中指定“软”验证而不是“lxml”允许请求不需要列出特定的命名空间。

    application = Application(  [API],
                                tns = soap_namespace,
                                in_protocol=Soap11(validator='soft'),
                                out_protocol=Soap11())
    

    【讨论】:

      猜你喜欢
      • 2017-07-24
      • 1970-01-01
      • 1970-01-01
      • 2013-09-22
      • 2016-04-07
      • 2015-09-16
      • 1970-01-01
      • 1970-01-01
      • 2011-09-13
      相关资源
      最近更新 更多