WSDL XSD 和肥皂

发布于 2024-10-05 01:43:57 字数 3003 浏览 0 评论 0原文

我有以下 WSDL 和 XSD

from SOAPpy import WSDL
import os

# you'll need to configure these two values;
# see http://www.google.com/apis/
WSDLFILE = os.path.join(os.path.dirname(__file__), "getiwsAesPayment.wsdl") 

_server = WSDL.Proxy(WSDLFILE)


print _server

这给了我错误:

   schema.load(reader)
  File "/home/gregory/.virtualenvs/casadeal/src/soappy/SOAPpy/wstools/XMLSchema.py", line 1205, in load
    tp.fromDom(childNode)
  File "/home/gregory/.virtualenvs/casadeal/src/soappy/SOAPpy/wstools/XMLSchema.py", line 1322, in fromDom
    raise SchemaError, 'namespace of schema and import match'
SOAPpy.wstools.XMLSchema.SchemaError: namespace of schema and import match

显然它可能来自这样的事实: wsdl 和 xsd 的 targetNamespace 相同?

WSDL

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="getiwsAesPayment" targetNamespace="http://ws.AMANTY.m2t.biz/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.AMANTY.m2t.biz/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://ws.AMANTY.m2t.biz/" schemaLocation="getiwsAesPayment.xsd"/>
    </xsd:schema>
  </types>
  <message name="getiwsaespayment">
    <part name="parameters" element="tns:getiwsaespayment">
    </part>
  </message>
  <message name="getiwsaespaymentResponse">
    <part name="parameters" element="tns:getiwsaespaymentResponse">
    </part>
  </message>
  <portType name="getiwsAesPayment">
    <operation name="getiwsaespayment">
      <input message="tns:getiwsaespayment">
    </input>
      <output message="tns:getiwsaespaymentResponse">
    </output>
    </operation>
  </portType>
  <binding name="getiwsAesPaymentPortBinding" type="tns:getiwsAesPayment">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getiwsaespayment">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="getiwsAesPaymentService">
    <port name="getiwsAesPaymentPort" binding="tns:getiwsAesPaymentPortBinding">
      <soap:address location="http://partner.ma:8080/AMANTYWebServicesWAR/getiwsAesPayment"/>
    </port>
  </service>
</definitions>

XSD

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" targetNamespace="http://ws.AMANTY.m2t.biz/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.AMANTY.m2t.biz/">

  <xs:element name="commandReg" type="tns:commandReg"/>

   .......
   </xs:schema>

I have the following WSDL and XSD

from SOAPpy import WSDL
import os

# you'll need to configure these two values;
# see http://www.google.com/apis/
WSDLFILE = os.path.join(os.path.dirname(__file__), "getiwsAesPayment.wsdl") 

_server = WSDL.Proxy(WSDLFILE)


print _server

Which gives me the error:

   schema.load(reader)
  File "/home/gregory/.virtualenvs/casadeal/src/soappy/SOAPpy/wstools/XMLSchema.py", line 1205, in load
    tp.fromDom(childNode)
  File "/home/gregory/.virtualenvs/casadeal/src/soappy/SOAPpy/wstools/XMLSchema.py", line 1322, in fromDom
    raise SchemaError, 'namespace of schema and import match'
SOAPpy.wstools.XMLSchema.SchemaError: namespace of schema and import match

Apparently it may come from the fact that the targetNamespace are the same for wsdl and xsd ?

WSDL

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="getiwsAesPayment" targetNamespace="http://ws.AMANTY.m2t.biz/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.AMANTY.m2t.biz/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://ws.AMANTY.m2t.biz/" schemaLocation="getiwsAesPayment.xsd"/>
    </xsd:schema>
  </types>
  <message name="getiwsaespayment">
    <part name="parameters" element="tns:getiwsaespayment">
    </part>
  </message>
  <message name="getiwsaespaymentResponse">
    <part name="parameters" element="tns:getiwsaespaymentResponse">
    </part>
  </message>
  <portType name="getiwsAesPayment">
    <operation name="getiwsaespayment">
      <input message="tns:getiwsaespayment">
    </input>
      <output message="tns:getiwsaespaymentResponse">
    </output>
    </operation>
  </portType>
  <binding name="getiwsAesPaymentPortBinding" type="tns:getiwsAesPayment">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getiwsaespayment">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="getiwsAesPaymentService">
    <port name="getiwsAesPaymentPort" binding="tns:getiwsAesPaymentPortBinding">
      <soap:address location="http://partner.ma:8080/AMANTYWebServicesWAR/getiwsAesPayment"/>
    </port>
  </service>
</definitions>

XSD

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" targetNamespace="http://ws.AMANTY.m2t.biz/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.AMANTY.m2t.biz/">

  <xs:element name="commandReg" type="tns:commandReg"/>

   .......
   </xs:schema>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无声静候 2024-10-12 01:43:57

尝试在您的 wsdl 中包含(而不是导入)其他 xsd

try to include (not import) other xsd's in your wsdl

空心空情空意 2024-10-12 01:43:57

或者直接使用 SUDS :)
它适用于较新的 SOAP 标准。

or simply use SUDS :)
It works with newer SOAP-Standards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文