簡體   English   中英

WSDL XSD和soappy

[英]WSDL XSD and soappy

我有以下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>

嘗試在您的wsdl中包含(而非導入)其他xsd

或直接使用SUDS :)它可與更新的SOAP標准一起使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM