Parthiv Parthiv - 10 months ago 85
Python Question

Exception in port type using Suds

I am trying to connect to Aramex shipping SOAP API using Python Suds using following code:

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

But after starting, I get the following exception:

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

The WSDL file source can be found here.

Answer Source

Error is here:

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


The binding element has two attributes - name and type.

The name attribute (you can use any name you want) defines the name of the binding, and the type attribute points to the port for the binding, in this case the "glossaryTerms" port.

So parser can't find port type="i0:Service_1_0", in this wsdl file there are two ports definition:

<wsdl:portType name="Service_1_0">
    <wsdl:operation name="TrackShipments">
      <wsdl:input name="ShipmentTrackingRequest" message="tns:ShipmentTrackingRequest" wsaw:Action=""/>
      <wsdl:output name="ShipmentTrackingResponse" message="tns:ShipmentTrackingResponse" wsaw:Action=""/>
  <wsdl:service name="Service_1_0">
    <wsdl:port name="BasicHttpBinding_Service_1_0" binding="i0:BasicHttpBinding_Service_1_0">
      <soap:address location=""/>

So now you know what is wrong(change type in wsdl:binding), and you can't pass the validation of that.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download