Question

I am new to python and using suds to consume data from a SOAP service. I face this error while making a call to the service. Other calls which do not require me to send some parameters are working fine. However this service is throwing me the following error. Can somebody please help me in understanding what this error is? primary is just a property of class devline and its a boolean.

 criteria = connection.factory.create('criteria')
 devline = connection.factory.create('devline') 

 devline.primary = True
 devline.source ="abc"
 devline.name = "xyz"
 devline.hybridType = "xyz"

 criteria.primaryDevline = devline
 criteria.pairedDevlines = []
 criteria.criteriaNumber = None

Criteria looks like this:

(criteriaKey){
   primaryDevline = 
      (devline){
         primary = None
         sourceBase = None
         devlineName = None
         hybridType = 
            (hybridType){
               value = None
            }
      }
   pairedDevlines[] = <empty>
   criteriaNumber = None
 }

When I try to call the service using response = connection.service.somemethod(criteria,criteriaState.PUBLISHED)

I get the following error:

self = <suds.mx.literal.Literal instance at 0x103fd8998>
content = (Content){
   tag = "primary"
   value = True
   type = None
 }

>   ???
E   TypeNotFound: Type not found: 'primary'

File "/Users/nkimidi/projects/firstws/cca/ezcommit-client/test/unit/service/build/bdist.macosx-10.8-intel/egg/suds/mx/literal.py", line 87
TypeNotFound
=========================== 1 failed in 0.27 seconds ===========================
Was it helpful?

Solution 2

Instead of this:

devline.primary = True
devline.source ="abc"
devline.name = "xyz"
devline.hybridType = "xyz"
cKey.primaryDevline = devline
cKey.pairedDevlines = []
cKey.criteriaNumber = None

This snippet has worked:

devline = {
    'primary':1,
    'sourceBase':sourceBase,
    'devlineName' : devlineName,
    'hybridType' : hybridType
    }
cKey['primaryDevline'] = devline
cKey['pairedDevlines'] = []
cKey['criteriaNumber'] = None

Documentation for suds says any of the methods would work, but the previous did not work for me.

OTHER TIPS

this started working when i used devline as a dictionary instead of the method used above. 1 days was wasted in this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top