I use suds to make SOAP requests a third-party API.
import suds.client
client = suds.client.Client(WSDL_URL, location=SERVICE_URL)
When I try to create an object for a specific type defined by WSDL (let's say TheObject):
obj = client.factory.create('TheObject')
I get an error message:
(TheObject) not-found
path: "TheObject", not-found
Traceback (most recent call last):
File "suds_test.py", line 67, in <module>
sys.exit(main(sys.argv))
File "suds_test.py", line 51, in main
obj = client.factory.create('TheObject'),
File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 234, in create
raise TypeNotFound(name)
suds.TypeNotFound: Type not found: 'TheObject'
So, I am printing the list of foam factory types available with print(client):
Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913
Service ( OrderService ) tns="http://api.example.com/services/"
Prefixes (2)
ns0 = "http://api.example.com/contracts/stuff"
ns1 = "http://api.example.com/services/"
Ports (2):
(OrderServiceSoap)
Methods (123):
... Not really relevant
Types (123):
SomeType
SomeType2
ns0:AnotherType
ns0:AnotherType2
ns0:TheObject
...
So it seems that ns1is the default namespace, and ns0is the namespace that I want to use for TheObject. If I prefix its namespace alias, it works.
obj = client.factory.create('ns0:TheObject')
ns0 , . Factory.create(), URL- - .
TheObject? URL- ns0 ? .