2

次のコードを使用して、Python Suds を使用して Aramex 配送 SOAP API に接続しようとしています。

import suds
from suds.client import Client
client = Client('file:///home/test/test_wsdl_aramex/shipments-tracking-api-wsdl.wsdl',cache=None)

しかし、開始後、次の例外が発生します。

>     raise Exception("portType '%s', not-found" % self.type)
Exception: portType 'i0:Service_dd1_0', not-found

WSDL ファイルのソースは、ここにあります。

4

1 に答える 1

2

エラーはここにあります:

<wsdl:binding type="i0:Service_1_0" name="BasicHttpBinding_Service_1_0">

binding 要素には、name と type の 2 つの属性があります。

name 属性 (任意の名前を使用できます) はバインディングの名前を定義し、type 属性はバインディングのポート (この場合は "glossaryTerms" ポート) を指します。

そのため、パーサーは port を見つけることができませんtype="i0:Service_1_0"。この wsdl ファイルには 2 つのポート定義があります。

<wsdl:portType name="Service_1_0">
    <wsdl:operation name="TrackShipments">
      <wsdl:input name="ShipmentTrackingRequest" message="tns:ShipmentTrackingRequest" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/TrackShipments"/>
      <wsdl:output name="ShipmentTrackingResponse" message="tns:ShipmentTrackingResponse" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/TrackShipmentsResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:service name="Service_1_0">
    <wsdl:port name="BasicHttpBinding_Service_1_0" binding="i0:BasicHttpBinding_Service_1_0">
      <soap:address location="http://ws.aramex.net/shippingapi/tracking/service_1_0.svc"/>
    </wsdl:port>
  </wsdl:service>

これで、何が間違っているか (wsdl:binding の型を変更) がわかったので、その検証に合格することはできません。

于 2013-08-02T12:45:13.473 に答える