2

I am consuming a SOAP webservice with suds (0.4). The WSDL I am using throws an error

>>> import uuid
>>> from suds.client import Client
>>> wsdl = 'https://toolkit.dnb.com/locked/resource/docs/TransactionAndMessageDefinition/ProductList.wsdl'
>>> client = Client(wsdl) 

The service I am consuming expects one parameter productListRequest, which is a complex type where you put UserId, Password and a complex type of ProductListInput.

I fill these with:

>>> productListRequest = client.factory.create('productListRequest')
>>> productListRequest.UserId = 'myusername'
>>> productListRequest.Password = 'mypassword'
>>> productListRequest.TRNUID = uuid.uuid4()
>>> ProductListInput = client.factory.create('ProductListInput')
>>> ProductListInput.DnB_DUNS_Number = ''
>>> ProductListInput.Product = 'Product Name'
>>> ProductListInput.CountryCode = 'IT'
>>> ProductListInput.TradeUp = ''
>>> ProductListInput.Reason = ''
>>> productListRequest.ProductListInput = ProductListInput

But whenever I am calling the service:

>>> print client.service.ws_ProductList(productListRequest)

I get Type not found: 'ArrayOfUPD_FLDSItem'

I am really stuck here. I have googled this error for 2 days and honestly I do not know what to do! Maybe someone with a deeper understanding of WSDL and suds can help.

So my questions:

  • Is this WSDL, which I am consuming proper defined? (If it is proper defined, I will report it to the suds maintainers)

  • If this WSDL is not proper defined, is there a workaround (e.g. suds schema doctor) to fix it on suds site?

  • Is there a alternative Python library, which I should use?

jazz
  • 2,371
  • 19
  • 23

2 Answers2

1

Suds is currently the best choice for WSDL consumption in Python. Unfortunately WSDL itself is such a complex mess that making good out of it is difficult.

Luckily Suds come with extensive logging capabilities which you can use to debug the problem and this is the first step of solving it. This earlier question answers how to enable it:

How can I output what SUDs is generating/receiving?

However, giving a complete answer for the type error would require seeing extensive logging output and/or source code, so I suggest you somehow try to narrow down the problem. To make the problem ultimately solvable a sample (non-working) schema and Python code would be nice.

(The error might hint that there is some subschema / external schema defined / missing which Suds cannot load for reason X)

Community
  • 1
  • 1
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
  • I have posted the complete logfile to http://pastebin.com/ZJJFXZaG as it is to big to include here. So my understanding is, that I am getting a response back from the service, but the reading and applying to the known datastructures by suds itself seems to fail. – jazz Aug 24 '11 at 18:26
  • Put in pdb and step through every line of code from the violating line to the failure... you should see when the type tracking machine does not follow the track anymore – Mikko Ohtamaa Aug 24 '11 at 19:19
  • I have accepted your answer although it would have been great, if you have had put some more light on the WSDL ;-) – jazz Aug 25 '11 at 05:24
  • I believe my brain is too small to comprehend WSDL :I What I'd do I'd search XML output for ArrayOfUPD_FLDSItem and try to figure if it's there and if it's there why the type of created item does not match one the element wants. – Mikko Ohtamaa Aug 25 '11 at 10:55
0

At first: It does not make sense to call the product list without a DUNS-Number. The transaction gives all avaliable products to a given DUNS. If the DUNS number is left empty, you will only get a field list of the product you stated (assuming you put a valid product name into your call, not "product name").

BUT: Even by putting all parameters in, I ran into the same problem and was not able to solve it, either.

Check with DnB and make them correct the WSDL - their WSDLs are quite buggy: Note that they have simply forgotten a whole transaction in the WSDL implementation (prodOrderRequest_3 for retrieving data from the toolkit archive)

My solution is to use the XML-Version of the Toolkit for this and the other mentioned transaction. Unfortunately.